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 }}"