# https://stackoverflow.com/questions/53253879/ansible-vars-files-vs-include-vars # https://docs.ansible.com/ansible/2.7/user_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable # https://www.middlewareinventory.com/blog/run-ansible-playbook-locally/ # https://nixzie.com/run-ansible-playbook-locally/#Run_Ansible_Playbook_Locally_Using_Local_Action # https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_delegation.html#delegating-facts # https://docs.ansible.com/ansible/latest/collections/ansible/builtin/debug_module.html # https://docs.ansible.com/ansible-core/2.15/reference_appendices/interpreter_discovery.html --- - name: "06" hosts: localhost # hosts: "*" 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 - name: Print the ansible python interpreter ansible.builtin.debug: msg: - "ansible_playbook_python = {{ ansible_playbook_python }}" # - "ansible_python_interpreter = {{ ansible_python_interpreter }}" - name: Print the ansible python interpreter - for the localhost ansible.builtin.debug: msg: - "ansible_playbook_python = {{ ansible_playbook_python }}" - "ansible_host = {{ ansible_host }}" # - "ansible_python_interpreter = {{ ansible_python_interpreter }}" delegate_to: localhost run_once: true - name: Print the ansible python interpreter - using 'local_action' local_action: module: ansible.builtin.debug var: ansible_playbook_python run_once: true - name: Print the group variable ansible.builtin.debug: msg: prefix variable = {{ prefix_dir }}