How to run Ansible without hosts file?

0 votes
How to run Ansible without hosts file?
Feb 1, 2019 in Ansible by Ruth
424 views

1 answer to this question.

0 votes

Hey @Ruth, you can use ansible without using the hosts file in the following way

ansible all -i "<hostname-or-ip>," -a 'uptime'

Make sure you add a ',' at the end of the IP address, or it will be considered as hosts inventory filename.

Example:

ansible all -i "192.168.56.105," -a 'uptime'

192.168.56.105 | SUCCESS | rc=0 >>
 12:05:10 up 10 min,  1 user,  load average: 0.46, 0.23, 0.08
answered Feb 1, 2019 by Anisha

Related Questions In Ansible

0 votes
1 answer

How to encrypt and existing file using Ansible Vault?

Hey @Kyraa, to encrypt an existing file ...READ MORE

answered Jan 29, 2019 in Ansible by Kavya
1,004 views
0 votes
1 answer

How to regex replace nested values in Ansible

I'm not aware of any built-in method ...READ MORE

answered Jun 16, 2018 in Ansible by shubham
• 6,910 points
1,567 views
0 votes
1 answer

How to use Ansible git module pull a branch with local changes?

You cannot achieve it using the git ...READ MORE

answered Jul 9, 2018 in Ansible by Atul
• 10,250 points
2,294 views
0 votes
1 answer

devops , how to create user using ansible playbook

root doesn't need a password to switch ...READ MORE

answered Jul 16, 2018 in Ansible by Kalgi
• 2,620 points
172 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,400 points
418 views
0 votes
1 answer
0 votes
1 answer

How to create a new encrpted file using Ansible Vault?

If you are creating a new file ...READ MORE

answered Jan 29, 2019 in Ansible by Kyraa
123 views
0 votes
1 answer

Ansible playbook to wget a file

Hey @Celia, one recommendation, try not using ...READ MORE

answered Jan 16, 2019 in Ansible by Vaishu
3,549 views