Define and Print Variables With Ansible

This blog post will show you how to define a variable and print it using two methods inside an Ansible playbook.


In the following playbook, we will define a variable called test and print it using two methods, the first is using the var option and the second is using msg.

- name: playbook
  hosts: localhost
    test: hello
    - name: dubug option 1
      debug: var=test
    - name: dubug option 2
        msg: "{{ test }}"

If you like this post make sure you visit our Ansible category page.

Success! You're on the list.