[Ansible Galaxy] Use Ansible with Paramiko
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.
Direct use of Paramiko itself is only intended for users who need advanced/low-level primitives or want to run an in-Python sshd.
Installation
The recommended way to get Paramiko is to install the latest stable release via pip:
1 | pip install paramiko |
Usages
First, create or edit a hosts.ini
inventory file.
1 | # hosts.ini |
Use -c paramiko
options to specify paramiko.
1 | ansible-playbook -i hosts.ini -c paramiko myplaybook.yml |
Or provide password argument with --ask-pass
options.
1 | ansible-playbook -i hosts.ini -c paramiko --ask-pass myplaybook.yml |
References
[1] Welcome to Paramiko! — Paramiko documentation - https://www.paramiko.org/