58 lines
1.5 KiB
YAML
58 lines
1.5 KiB
YAML
---
|
|
|
|
- name: (root_files_scripts.yml) Ensure directory /root/bin exists
|
|
ansible.builtin.file:
|
|
path: /root/bin
|
|
owner: root
|
|
group: root
|
|
mode: '0700'
|
|
state: directory
|
|
when:
|
|
- groups['file_server'] | string is search(inventory_hostname)
|
|
|
|
- name: (root_files_scripts.yml) Ensure script 'wakeup_lan.sh' is present
|
|
ansible.builtin.template:
|
|
src: "{{ role_path + '/files/' + nis_domain + '/root/bin/wakeup_lan.sh' }}"
|
|
dest: /root/bin/wakeup_lan.sh
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
when:
|
|
- groups['file_server'] | string is search(inventory_hostname)
|
|
tags:
|
|
- wakeup_lan
|
|
|
|
- name: (root_files_scripts.yml) Check file '/etc/motd.ORIG' exists
|
|
ansible.builtin.stat:
|
|
path: /etc/motd.ORIG
|
|
register: common_etc_motd_orig
|
|
when:
|
|
- groups['file_server'] | string is search(inventory_hostname)
|
|
tags:
|
|
- etc_motd
|
|
|
|
- name: (basic.yml) Backup installation version of file '/etc/motd'
|
|
ansible.builtin.copy:
|
|
src: /etc/motd
|
|
dest: /etc/motd.ORIG
|
|
remote_src: true
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
force: false
|
|
when:
|
|
- groups['file_server'] | string is search(inventory_hostname)
|
|
- not common_etc_motd_orig.stat.exists
|
|
tags:
|
|
- etc_motd
|
|
|
|
- name: (root_files_scripts.yml) Write new '/etc/motd' file..
|
|
ansible.builtin.shell: >
|
|
figlet '{{ nis_server_name.split(".")[0] }}' > /etc/motd
|
|
changed_when: true
|
|
when:
|
|
- groups['file_server'] | string is search(inventory_hostname)
|
|
- not common_etc_motd_orig.stat.exists
|
|
tags:
|
|
- etc_motd
|