1
0
mirror of https://github.com/azlux/log2ram.git synced 2023-10-10 13:37:24 +02:00

Update ansible-playbook (#183)

- Adds support for missing options in the /etc/log2ram.conf (USE_RSYNC and MAIL)
- apt-key command has been deprecated, as mentioned by issue #179. Changing it to use a keyring in /usr/share/keyrings
This commit is contained in:
Guilherme Lima 2022-02-24 02:14:41 +01:00 committed by GitHub
parent 5b097683af
commit fbd8868ae1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,10 +11,14 @@
vars: vars:
apt_keyring_file: azlux.fr.log2ram.gpg log2ram_repo_url: http://packages.azlux.fr
apt_sources_file: log2ram.list log2ram_gpg: https://azlux.fr/repo.gpg
log2ram_keyring: /usr/share/keyrings/azlux-archive-keyring.gpg
log2ram_apt_repository: "deb [signed-by={{ log2ram_keyring }}] {{ log2ram_repo_url }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} main"
log2ram_size: 40M log2ram_size: 40M
log2ram_use_rsync: true
log2ram_mail: true
log2ram_path_disk: /var/log log2ram_path_disk: /var/log
log2ram_use_z2lr: true log2ram_use_z2lr: true
log2ram_comp_alg: lz4 log2ram_comp_alg: lz4
@ -22,36 +26,31 @@
tasks: tasks:
- name: "Add /etc/apt/sources.list.d/{{ apt_sources_file }}" - name: Add rsync as pre-requisite
copy: apt:
content: "deb http://packages.azlux.fr/debian/ {{ ansible_facts['distribution_release'] }} main\n" name: rsync
dest: /etc/apt/sources.list.d/{{ apt_sources_file }} when: log2ram_use_rsync
mode: 0644
owner: root
register: source_list
- name: Import apt key - name: Add gpg key
apt_key: shell:
url: https://azlux.fr/repo.gpg.key cmd: >
id: 98B824A5FA7D3A10FDB225B7CA548A0A0312D8E6 curl -fsSL {{ log2ram_gpg }} | gpg --dearmor --yes -o {{ log2ram_keyring }}
keyring: /etc/apt/trusted.gpg.d/{{ apt_keyring_file }} creates: "{{ log2ram_keyring }}"
register: dl_key
- name: Remove tilde backup file {{ apt_keyring_file }}~ - name: Add apt repository
file: apt_repository:
path: /etc/apt/trusted.gpg.d/{{ apt_keyring_file }}~ repo: "{{ log2ram_apt_repository }}"
state: absent filename: log2ram
register: log2ram_apt_repo
- name: update apt cache - name: Update apt cache
apt: apt:
update_cache: true update_cache: true
when: dl_key is changed or source_list is changed when: log2ram_apt_repo is changed
- name: Install log2ram - name: Install log2ram
apt: apt:
pkg: name: log2ram
- log2ram
register: pkg
notify: Restart log2ram notify: Restart log2ram
- name: Set config options - name: Set config options
@ -62,6 +61,8 @@
backrefs: true backrefs: true
loop: loop:
- {regexp: '^SIZE=(.*)$', line: 'SIZE={{ log2ram_size }}'} - {regexp: '^SIZE=(.*)$', line: 'SIZE={{ log2ram_size }}'}
- {regexp: 'USE_RSYNC=(.*)$', line: 'SIZE={{ log2ram_use_rsync }}'}
- {regexp: '^MAIL=(.*)$', line: 'SIZE={{ log2ram_mail }}'}
- {regexp: '^PATH_DISK=(.*)$', line: 'PATH_DISK="{{ log2ram_path_disk }}"'} - {regexp: '^PATH_DISK=(.*)$', line: 'PATH_DISK="{{ log2ram_path_disk }}"'}
- {regexp: '^ZL2R=(.*)$', line: 'ZL2R={{ log2ram_use_z2lr|lower }}'} - {regexp: '^ZL2R=(.*)$', line: 'ZL2R={{ log2ram_use_z2lr|lower }}'}
- {regexp: '^COMP_ALG=(.*)$', line: 'COMP_ALG={{ log2ram_comp_alg }}'} - {regexp: '^COMP_ALG=(.*)$', line: 'COMP_ALG={{ log2ram_comp_alg }}'}