Ansible Playbook – How to pass hostname or IP in the Command line

Today I was thinking about passing the host IP on the ansible-playbook I’m going to run to automate something. As per the documentation, it says  –i hostname in a comma separated input will work fine.

I was trying to give the IP like ansible-playbook playbook.yml -i 1.1.1.1 in the playbook command line and it was not working, then I figured out that we need to add a comma to the IP we specified even it is a single IP that I’m going to run playbook on.

So, the solution was to add a comma (,) just after the IP

ansible-playbook playbook.yml -i 1.1.1.1, –check

Hope this helps 🙂

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Scroll to Top