1
This commit is contained in:
22
01_delegate.yml
Normal file
22
01_delegate.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
- name: Task Delegation
|
||||||
|
hosts: linuxservers
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Debug Facts Hostname
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "{{ ansible_facts['nodename'] }}"
|
||||||
|
|
||||||
|
- name: Set x on set_server_offline.sh
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: ~/ansibleclass/set_server_offline.sh
|
||||||
|
state: touch
|
||||||
|
mode: +x
|
||||||
|
delegate_to: localhost
|
||||||
|
|
||||||
|
- name: Write File
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: ~/ansibleclass/set_server_offline.sh "{{ ansible_facts['nodename'] }}" "{{ ansible_facts['all_ipv4_addresses'][0] }}"
|
||||||
|
register: output
|
||||||
|
changed_when: output.rc == 0
|
||||||
|
delegate_to: localhost
|
||||||
Reference in New Issue
Block a user