From 73f20ebb5ea2b2626a19f5e8a01ce36d35d64a61 Mon Sep 17 00:00:00 2001 From: nicoo Date: Fri, 8 Jun 2018 21:19:32 +0200 Subject: [PATCH] vm/guest: Ensure no other rngd configuration lines are present --- ansible/roles/vm/guest/defaults/main.yml | 3 +++ ansible/roles/vm/guest/tasks/main.yml | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 ansible/roles/vm/guest/defaults/main.yml diff --git a/ansible/roles/vm/guest/defaults/main.yml b/ansible/roles/vm/guest/defaults/main.yml new file mode 100644 index 0000000..b4deefa --- /dev/null +++ b/ansible/roles/vm/guest/defaults/main.yml @@ -0,0 +1,3 @@ +rngd_config: + HRNGDEVICE: /dev/hwrng + RNGDOPTIONS: '"-s 256 -W 80%"' diff --git a/ansible/roles/vm/guest/tasks/main.yml b/ansible/roles/vm/guest/tasks/main.yml index 23f4ef4..780a276 100644 --- a/ansible/roles/vm/guest/tasks/main.yml +++ b/ansible/roles/vm/guest/tasks/main.yml @@ -3,14 +3,22 @@ name: rng-tools state: present -- name: Configure rngd +- name: Configure rngd [1/2] lineinfile: path: /etc/default/rng-tools line: '{{ item.key }}={{ item.value }}' regexp: '^#?{{ item.key }}={{ item.value }}' - with_dict: - HRNGDEVICE: /dev/hwrng - RNGDOPTIONS: '"-s 256 -W 80%"' + with_dict: '{{ rngd_config }}' + loop_control: + label: "{{ item.key }}" + notify: restart rngd + +- name: Configure rngd [2/2] + lineinfile: + path: /etc/default/rng-tools + regexp: '^{{ item.key }}=(?!{{ item.value }})' + state: absent + with_dict: '{{ rngd_config }}' loop_control: label: "{{ item.key }}" notify: restart rngd -- 1.7.10.4