Inventory group not getting created when using add_host and one of the 
iteration of task fails.

Below is the playbook

--
- hosts: localhost
  connection: local
  # become: yes
  # become_method: sudo 

  tasks:    
- set_fact:
         hosts:
           - name: "web1"
             change: "chg6556"
             num: "654"
           - name: "web2"
             num: "466"
    - add_host:
        name: "{{ item.name }}"
        groups: webs
        change: "{{ item.change}}"
        number: "{{ item.num}}"
      ignore_errors: true
      with_items: "{{ hosts }}"    

- debug:
        msg: "{{ groups }}"

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/c287fbd1-a6c9-4bac-b79c-fb97ea5bc796n%40googlegroups.com.

Reply via email to