summaryrefslogtreecommitdiff
path: root/ansible-practice/system/03-playbook-print-gateway.yml
diff options
context:
space:
mode:
Diffstat (limited to 'ansible-practice/system/03-playbook-print-gateway.yml')
-rw-r--r--ansible-practice/system/03-playbook-print-gateway.yml16
1 files changed, 16 insertions, 0 deletions
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