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
ansible.builtin.set_fact:
cron_root_path_candidates:
common_cron_root_path_candidates:
- /root/bin/admin-stuff
- /root/bin
- /usr/local/apache2/bin
@@ -18,16 +18,16 @@
- name: (cron.yml) Check candidate paths for root crontab PATH
ansible.builtin.stat:
path: "{{ item }}"
loop: "{{ cron_root_path_candidates }}"
register: cron_root_path_stats
loop: "{{ common_cron_root_path_candidates }}"
register: common_cron_root_path_stats
tags:
- user_crontab
- name: (cron.yml) Build validated root crontab PATH
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')
| map(attribute='stat.path')
| join(':')
@@ -38,7 +38,7 @@
- name: (cron.yml) Check if root crontab already exists
ansible.builtin.stat:
path: /var/spool/cron/crontabs/root
register: root_crontab_file
register: common_root_crontab_file
tags:
- user_crontab
@@ -69,10 +69,10 @@
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
PATH={{ cron_root_path }}
PATH={{ common_cron_root_path }}
SHELL=/bin/bash
when:
- not root_crontab_file.stat.exists
- not common_root_crontab_file.stat.exists
tags:
- user_crontab