Refactor variable names in motd.yml for consistency and clarity
This commit is contained in:
@@ -6,19 +6,21 @@
|
||||
- name: (motd.yml) Check if /etc/motd.ORIG exist
|
||||
ansible.builtin.stat:
|
||||
path: /etc/motd.ORIG
|
||||
register: motd_orig_exist
|
||||
register: common_motd_orig_exist
|
||||
|
||||
- name: (motd.yml) Check if /etc/motd exist
|
||||
ansible.builtin.stat:
|
||||
path: /etc/motd
|
||||
register: motd_exist
|
||||
register: common_motd_exist
|
||||
|
||||
- name: (motd.yml) Backup existing file /etc/motd
|
||||
ansible.builtin.command: cp -a /etc/motd /etc/motd.ORIG
|
||||
changed_when: true
|
||||
when:
|
||||
- motd_exist.stat.exists == True
|
||||
- motd_orig_exist.stat.exists == False
|
||||
- common_motd_exist.stat.exists
|
||||
- not common_motd_orig_exist.stat.exists
|
||||
|
||||
- name: (motd.yml) create /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
|
||||
|
||||
Reference in New Issue
Block a user