Refactor variable names in cron.yml for consistency and clarity

This commit is contained in:
2026-07-21 00:25:21 +02:00
parent 924e6bbf03
commit 618eaa0bf7
+8 -8
View File
@@ -1,7 +1,7 @@
--- ---
- name: (cron.yml) Define candidate paths for root crontab PATH - name: (cron.yml) Define candidate paths for root crontab PATH
ansible.builtin.set_fact: ansible.builtin.set_fact:
cron_root_path_candidates: common_cron_root_path_candidates:
- /root/bin/admin-stuff - /root/bin/admin-stuff
- /root/bin - /root/bin
- /usr/local/apache2/bin - /usr/local/apache2/bin
@@ -18,16 +18,16 @@
- name: (cron.yml) Check candidate paths for root crontab PATH - name: (cron.yml) Check candidate paths for root crontab PATH
ansible.builtin.stat: ansible.builtin.stat:
path: "{{ item }}" path: "{{ item }}"
loop: "{{ cron_root_path_candidates }}" loop: "{{ common_cron_root_path_candidates }}"
register: cron_root_path_stats register: common_cron_root_path_stats
tags: tags:
- user_crontab - user_crontab
- name: (cron.yml) Build validated root crontab PATH - name: (cron.yml) Build validated root crontab PATH
ansible.builtin.set_fact: ansible.builtin.set_fact:
cron_root_path: >- common_cron_root_path: >-
{{ {{
cron_root_path_stats.results common_cron_root_path_stats.results
| selectattr('stat.exists') | selectattr('stat.exists')
| map(attribute='stat.path') | map(attribute='stat.path')
| join(':') | join(':')
@@ -38,7 +38,7 @@
- name: (cron.yml) Check if root crontab already exists - name: (cron.yml) Check if root crontab already exists
ansible.builtin.stat: ansible.builtin.stat:
path: /var/spool/cron/crontabs/root path: /var/spool/cron/crontabs/root
register: root_crontab_file register: common_root_crontab_file
tags: tags:
- user_crontab - user_crontab
@@ -69,10 +69,10 @@
# at 5 a.m every week with: # at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ # 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# #
PATH={{ cron_root_path }} PATH={{ common_cron_root_path }}
SHELL=/bin/bash SHELL=/bin/bash
when: when:
- not root_crontab_file.stat.exists - not common_root_crontab_file.stat.exists
tags: tags:
- user_crontab - user_crontab