Refactor variable names in motd.yml for consistency and clarity

This commit is contained in:
2026-07-21 00:48:33 +02:00
parent ab4ef8f831
commit baba4c4b7d
+7 -5
View File
@@ -6,19 +6,21 @@
- name: (motd.yml) Check if /etc/motd.ORIG exist - name: (motd.yml) Check if /etc/motd.ORIG exist
ansible.builtin.stat: ansible.builtin.stat:
path: /etc/motd.ORIG path: /etc/motd.ORIG
register: motd_orig_exist register: common_motd_orig_exist
- name: (motd.yml) Check if /etc/motd exist - name: (motd.yml) Check if /etc/motd exist
ansible.builtin.stat: ansible.builtin.stat:
path: /etc/motd path: /etc/motd
register: motd_exist register: common_motd_exist
- name: (motd.yml) Backup existing file /etc/motd - name: (motd.yml) Backup existing file /etc/motd
ansible.builtin.command: cp -a /etc/motd /etc/motd.ORIG ansible.builtin.command: cp -a /etc/motd /etc/motd.ORIG
changed_when: true
when: when:
- motd_exist.stat.exists == True - common_motd_exist.stat.exists
- motd_orig_exist.stat.exists == False - not common_motd_orig_exist.stat.exists
- name: (motd.yml) create /etc/motd - name: (motd.yml) create /etc/motd
ansible.builtin.shell: figlet {{ ansible_hostname }} > /etc/motd ansible.builtin.shell: figlet {{ ansible_hostname }} > /etc/motd
when: motd_orig_exist.stat.exists == False changed_when: true
when: not common_motd_orig_exist.stat.exists