Ansible print and debug examples
Jump to navigation
Jump to search
#!/usr/bin/env ansible-playbook - hosts: localhost gather_facts: no vars: my_var: MY_VALUE tasks: - name: my task for executing hello world command: echo test - name: my debug message name debug: msg: "my debug text" - name: my debug message name debug: msg: "my debug text including var {{ my_var }}"
Output
PLAY [localhost] ************************************************************************************************************************************* TASK [my task for executing hello world] ************************************************************************************************************* changed: [localhost] TASK [my debug message name] ************************************************************************************************************************* ok: [localhost] => { "msg": "my debug text" } TASK [my debug message name] ************************************************************************************************************************* ok: [localhost] => { "msg": "my debug text including var MY_VALUE" } PLAY RECAP ******************************************************************************************************************************************* localhost : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
See also
- Ansible: modules, plugins, Playbooks (examples)
ansible-playbook
,ansible-vault
,ansible-inventory
,ansible-config
, Ansible Tower, Ansible Galaxy (Roles) (ansible-galaxy
),ansible-cmdb
,gather facts
,ansible.cfg
,Ansible Molecule
, Ansible collections,register
,template
,--ask-pass
,--ask-become-pass
,remote_user:
,/etc/ansible/hosts
,ansible-doc
,ansible-lint
,.ansible/
,--forks
,--start-at-task
,changelog
,inventory
,Notify:
,ansible HOSTNAME -m ping
,gathering
,/usr/bin/ansible
,ansible -m ping
,ansible.builtin
,hosts: (Ansible)
,set fact:
,when:
,blockinfile:
,become method:
,include:
,git:
, AWX,ansible --help
, Tags, Ansible variables, versions
Advertising: