Ansible
Get ansible facts
Section titled “Get ansible facts”ansible localhost -m setup
Run direct commands
Section titled “Run direct commands”ansible all -a "whereis python"
Create a role
Section titled “Create a role”# flag --init-path is optional, default is current pathansible-galaxy init {role_name} --init-path {path}
Find ansible roles by author
Section titled “Find ansible roles by author”ansible-galaxy search web --author Te4g
Install a role
Section titled “Install a role”ansible-galaxy install {role}
Use ansible with a passphrase protected ssh key
Section titled “Use ansible with a passphrase protected ssh key”ansible all -i inventory.yml -m ping --ask-pass
Speficy host directly on command line (the ”,” is not a typo)
Section titled “Speficy host directly on command line (the ”,” is not a typo)”ansible-playbook -i localhost:2222, playbooks/secure-vps.yml -u ubuntu --ask-become