Hi,
I am doing a very straight forward testing of adding a new host dynamically.
---
- hosts: all
connection: local
gather_facts: no
tasks:
- name: add host
add_host:
name: 'testserver'
groups: all
- name: refresh
meta: refresh_inventory
- name: print
debug:
msg: "hello"
~
When i run this playbook
ansible-playbook hello.yml -i hosts
it doesnot run task for added host
ansible-playbook -i hosts hello.yml
PLAY [all] ************************************************************************************************************************
TASK [add host] *******************************************************************************************************************
changed: [localhost]
TASK [print] **********************************************************************************************************************
ok: [localhost] => {
"msg": "hello"
}
PLAY RECAP ************************************************************************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
I dont see task for testserver.
Any idea what am i missing ?