Skip the hosts when one host is exectued task successfully

22 views
Skip to first unread message

Balaji Sunku

unread,
Mar 3, 2016, 1:33:23 AM3/3/16
to Ansible Project
My Playbook:
---------------------------
- hosts: web
  vars:
    increaseCount: 0
  remote_user: root
  tasks:
  - name: Verifying HTTP endpoint
    uri:
      url: "http://{{inventory_hostname}}:{{httpd_port}}/Test"
      method: PUT
      body: "{{ lookup('file',test.json') }}"
      status_code: 200
      body_format: json
      return_content: yes
    register: http_verify_out
    failed_when: http_verify_out.status != 200


My scenario:
I am using ansible 2.0.1
In playbook hosts: web will be having multiple hosts.
If one host is executed the task successfully i want to skip the other hosts to execute the tasks.

Is there away to achieve this ?. If yes please let me know the solution 

Thanks in advance :)

Reply all
Reply to author
Forward
0 new messages