[Ansible Galaxy] Ansible host inventory
Host Inventory
Ansible works against multiple managed nodes or “hosts” in your infrastructure at the same time, using a list or group of lists known as inventory. Once your inventory is defined, you use patterns to select the hosts or groups you want Ansible to run against.
FAQs
to use the ‘ssh’ connection type with passwords, you must install the sshpass program
1 | TASK [Gathering Facts] *************************************************************************************************************** |
You have to install sshpass
package in your ansible control machine.
Or Use Paramiko
Paramiko is a pure-Python (2.7, 3.4+) implementation of the SSHv2 protocol, providing both client and server functionality. It provides the foundation for the high-level SSH library Fabric, which is what we recommend you use for common client use-cases such as running remote shell commands or transferring files.
First, install Paramiko
by pip
.
1 | pip install paramiko |
Use -c paramiko
options.
1 | ansible-playbook -i hosts -c paramiko --ask-pass myplaybook.yml |