Skip to content

Ansible

Terminal window
ansible localhost -m setup
Terminal window
ansible all -a "whereis python"
Terminal window
# flag --init-path is optional, default is current path
ansible-galaxy init {role_name} --init-path {path}
Terminal window
ansible-galaxy search web --author Te4g
Terminal window
ansible-galaxy install {role}

Use ansible with a passphrase protected ssh key

Section titled “Use ansible with a passphrase protected ssh key”
Terminal window
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)”
Terminal window
ansible-playbook -i localhost:2222, playbooks/secure-vps.yml -u ubuntu --ask-become