From d8a7729358a2fd3b911022e45d0197fda3e5da94 Mon Sep 17 00:00:00 2001 From: boom2 Date: Fri, 8 Dec 2023 14:12:33 -0500 Subject: - add exeriments for: - roles - variables - inventory changes - config changes --- ansible-practice/system/03-playbook-print-gateway.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 ansible-practice/system/03-playbook-print-gateway.yml (limited to 'ansible-practice/system/03-playbook-print-gateway.yml') diff --git a/ansible-practice/system/03-playbook-print-gateway.yml b/ansible-practice/system/03-playbook-print-gateway.yml new file mode 100644 index 0000000..7fd2277 --- /dev/null +++ b/ansible-practice/system/03-playbook-print-gateway.yml @@ -0,0 +1,16 @@ +# display some per host info using 'magic variables' +# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/debug_module.html +# https://docs.ansible.com/ansible/latest/inventory/implicit_localhost.html +# https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_delegation.html +# + +--- +- name: "03 - display some per host info" + hosts: all +# hosts: localhost +# connection: local + tasks: + - name: Print the gateway for each host when defined + ansible.builtin.debug: + msg: System {{ inventory_hostname }} has gateway {{ ansible_default_ipv4.gateway }} + when: ansible_default_ipv4.gateway is defined \ No newline at end of file -- cgit v1.2.3-54-g00ecf