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!