diff --git a/tasks/ram.yml b/tasks/ram.yml index e10d2be..b248910 100644 --- a/tasks/ram.yml +++ b/tasks/ram.yml @@ -40,7 +40,8 @@ mode: '0644' register: download_archive -- name: Installation Logic +- name: ram | Logic to extract and install log2ram + when: download_archive.changed # noqa: no-handler block: - name: ram | Extract log2ram ansible.builtin.unarchive: @@ -55,23 +56,18 @@ # 'creates' makes the command idempotent by checking for the binary creates: /usr/local/bin/log2ram notify: Restart log2ram - when: download_archive.changed # Configure log2ram -- name: ram | Configure log2ram size +- name: Configure log2ram settings ansible.builtin.lineinfile: path: /etc/log2ram.conf - regexp: '^#?SIZE=' - line: "SIZE={{ log2ram_size }}" + regexp: "{{ item.regexp }}" + line: "{{ item.line }}" backup: yes - notify: Restart log2ram - -- name: ram | Enable rsync sync - ansible.builtin.lineinfile: - path: /etc/log2ram.conf - regexp: '^#?USE_RSYNC=' - line: "USE_RSYNC=true" + loop: + - { regexp: '^#?SIZE=', line: "SIZE={{ log2ram_size }}" } + - { regexp: '^#?USE_RSYNC=', line: "USE_RSYNC=true" } notify: Restart log2ram # Keep journald fully in RAM