This commit is contained in:
2023-06-13 10:48:57 +02:00
parent d5e943f1a0
commit 455f608de7

22
01_delegate.yml Normal file
View 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