Ansible task type of state

In this tutorial, find out ansible type of state. Ansible the essential for DevOps Roles.

Ansible task type of state


– 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
    - name: skip
        msg: skipped
      when: false

    - name: do -> ok
        msg: task done and return ok

    - name: do -> changed
        msg: task has done and return changed
      changed_when: yes

    - name: do -> failed -> exit
        msg: return failed, and exit
      failed_when: yes

The terminal output as below

Ansible task type of state


Thought the article, you can use Ansible task type of state. I hope will this your helpful. More details refer to Ansible tutorial.

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.