I am learning Ansible and started using Adhoc command first. I created a custom inventory file as below.
[ansible-node@ansible-node Ansible]$ cat inventory.ini [app]
[email protected] [email protected][database] [email protected]
When i try to run the command as below, I am getting an error.
[ansible-node@ansible-node Ansible]$ ansible -i inventory.ini -m “yum”
-a “name=httpd state=present” app [email protected] | FAILED! => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/bin/python3”
},
“changed”: false,
“msg”: “This command has to be run under the root user.”,
“results”: [] } [email protected] | FAILED! => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/bin/python3”
},
“changed”: false,
“msg”: “This command has to be run under the root user.”,
“results”: [] }
Any suggestions as to what wrong am I doing here?