In this tutorial, find out ansible type of state. Ansible the essential for DevOps Roles.
Ansible task type of state
skip
– The skip task and nothing. using when: false
do –> ok
– The task is successful.
do -> changed
– The status when a change occurred in the task. Using “changed_when: yes”
do -> failed -> exit
– Using “failed_when: yes”. This task return failed and exit.
Ansible playbook task
- hosts: - localhost tasks: - name: skip debug: msg: skipped when: false - name: do -> ok debug: msg: task done and return ok - name: do -> changed debug: msg: task has done and return changed changed_when: yes - name: do -> failed -> exit debug: msg: return failed, and exit failed_when: yes
The terminal output as below
Conclusion
Thought the article, you can use Ansible task type of state. I hope will this your helpful. More details refer to Ansible tutorial.