Forked from lilongen/run-ansible-with-any-host-without-inventory
Created
December 17, 2019 03:23
-
-
Save fujohnwang/73931ec028a01f7f32b29fd18d846892 to your computer and use it in GitHub Desktop.
How to run Ansible without specifying the inventory but the host directly?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question: | |
. How to run Ansible without specifying the inventory but the host directly? | |
. Run a playbook or command with arbitrary host not in the inventory hosts list? | |
. run ansible with arbitrary host/ip without inventory? | |
Answer: | |
Surprisingly, the trick is to append a , | |
The host parameter preceding the , can be either a hostname or an IPv4/v6 address. | |
ansible all -i example.com, | |
ansible all -i 93.184.216.119, | |
ansible-playbook -i example.com, playbook.yml # Requires 'hosts: all' in the playbook |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment