refactor ♻️: Refactor installation logic and configure settings using loops
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 12s
Gitleaks Scan / gitleaks (push) Successful in 4s
Markdown Lint / markdown-lint (push) Successful in 5s

This refactoring simplifies the installation process by utilizing loops to handle repetitive tasks, improving readability and maintainability of the code.
This commit is contained in:
2026-02-15 09:42:00 +01:00
parent 83febca09a
commit 7c664dfd45

View File

@@ -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