add_host is meant to be used **runtime** thus it does not perform any 
operations making change persistent. Adding hosts to the inventory could be 
done via one of the "file" modules. 

On Sunday, July 17, 2016 at 5:02:26 AM UTC-7, Patrick van Haren wrote:
>
> I try to add a hos to my inventory with the command below:
>
> ansible localhost -m add_host -a "name=demo groups=containers"
>
> This is the output:
> localhost | SUCCESS => {
>     "add_host": {
>         "groups": [
>             "containers"
>         ],
>         "host_name": "demo",
>         "host_vars": {}
>     },
>     "changed": true
> }
>
> Unfortunately, Ansible doesn't add the new host to my inventory file which 
> is defined in /etc/ansible/ansible.cfg
> Also it doesn't work when I add "-i /path/to/hosts" in the command.
>
> Anyone suggestions? :)
> Thank you!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a0afb73f-0e64-41a6-8f4b-a57fcf34ccdf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to