refactor ♻️: Refactor task structure and update configuration method in ram.yml
This commit refactors the task structure in `ram.yml` and updates the configuration method to improve readability and maintainability.
This commit is contained in:
@@ -31,6 +31,3 @@
|
|||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: systemd-journald
|
name: systemd-journald
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
||||||
- name: Reload sysctl
|
|
||||||
ansible.builtin.command: sysctl --system
|
|
||||||
|
|||||||
@@ -40,12 +40,13 @@
|
|||||||
mode: '0644'
|
mode: '0644'
|
||||||
register: download_archive
|
register: download_archive
|
||||||
|
|
||||||
|
- name: Installation Logic
|
||||||
|
block:
|
||||||
- name: ram | Extract log2ram
|
- name: ram | Extract log2ram
|
||||||
ansible.builtin.unarchive:
|
ansible.builtin.unarchive:
|
||||||
src: "/tmp/log2ram.tar.gz"
|
src: "/tmp/log2ram.tar.gz"
|
||||||
dest: "/tmp"
|
dest: "/tmp"
|
||||||
remote_src: yes
|
remote_src: yes
|
||||||
when: download_archive.changed
|
|
||||||
|
|
||||||
- name: ram | Install log2ram
|
- name: ram | Install log2ram
|
||||||
ansible.builtin.command: bash install.sh
|
ansible.builtin.command: bash install.sh
|
||||||
@@ -53,8 +54,8 @@
|
|||||||
chdir: "/tmp/log2ram-master"
|
chdir: "/tmp/log2ram-master"
|
||||||
# 'creates' makes the command idempotent by checking for the binary
|
# 'creates' makes the command idempotent by checking for the binary
|
||||||
creates: /usr/local/bin/log2ram
|
creates: /usr/local/bin/log2ram
|
||||||
when: download_archive.changed
|
|
||||||
notify: Restart log2ram
|
notify: Restart log2ram
|
||||||
|
when: download_archive.changed
|
||||||
|
|
||||||
# Configure log2ram
|
# Configure log2ram
|
||||||
|
|
||||||
@@ -93,11 +94,13 @@
|
|||||||
# Enable log2ram on boot
|
# Enable log2ram on boot
|
||||||
|
|
||||||
- name: ram | Configure memory tuning sysctl
|
- name: ram | Configure memory tuning sysctl
|
||||||
ansible.builtin.copy:
|
ansible.posix.sysctl:
|
||||||
dest: /etc/sysctl.d/99-proxmox-memory.conf
|
name: "{{ item.name }}"
|
||||||
content: |
|
value: "{{ item.value }}"
|
||||||
vm.swappiness = {{ vm_swappiness }}
|
state: present
|
||||||
vm.dirty_ratio = {{ vm_dirty_ratio }}
|
sysctl_file: /etc/sysctl.d/99-proxmox-memory.conf
|
||||||
vm.dirty_background_ratio = {{ vm_dirty_background_ratio }}
|
reload: yes
|
||||||
mode: '0644'
|
loop:
|
||||||
notify: Reload sysctl
|
- { name: 'vm.swappiness', value: "{{ vm_swappiness }}" }
|
||||||
|
- { name: 'vm.dirty_ratio', value: "{{ vm_dirty_ratio }}" }
|
||||||
|
- { name: 'vm.dirty_background_ratio', value: "{{ vm_dirty_background_ratio }}" }
|
||||||
|
|||||||
Reference in New Issue
Block a user