81398e847e
- Updated all tasks to use fully qualified module names (e.g., ansible.builtin.shell, ansible.builtin.copy) for clarity and to avoid ambiguity. - Replaced deprecated 'yum' module with 'dnf' for package management on RedHat-based systems. - Improved formatting and consistency in task definitions, including the use of double quotes for strings and consistent indentation. - Removed unnecessary comments and whitespace to enhance readability. - Ensured that conditions and loops are consistently formatted across all tasks.
25 lines
628 B
YAML
25 lines
628 B
YAML
---
|
|
# ----------
|
|
# /etc/motd
|
|
# ----------
|
|
|
|
- name: (motd.yml) Check if /etc/motd.ORIG exist
|
|
ansible.builtin.stat:
|
|
path: /etc/motd.ORIG
|
|
register: motd_orig_exist
|
|
|
|
- name: (motd.yml) Check if /etc/motd exist
|
|
ansible.builtin.stat:
|
|
path: /etc/motd
|
|
register: motd_exist
|
|
|
|
- name: (motd.yml) Backup existing file /etc/motd
|
|
ansible.builtin.command: cp -a /etc/motd /etc/motd.ORIG
|
|
when:
|
|
- motd_exist.stat.exists == True
|
|
- motd_orig_exist.stat.exists == False
|
|
|
|
- name: (motd.yml) create /etc/motd
|
|
ansible.builtin.shell: figlet {{ ansible_hostname }} > /etc/motd
|
|
when: motd_orig_exist.stat.exists == False
|