Skip to content

Instantly share code, notes, and snippets.

@wakproductions
Last active February 28, 2017 03:55
Show Gist options
  • Save wakproductions/04a6e24bb7a83d08949f7137fc8aec0f to your computer and use it in GitHub Desktop.
Save wakproductions/04a6e24bb7a83d08949f7137fc8aec0f to your computer and use it in GitHub Desktop.
Ansible Notes

Ansible Examples Repository

To see what hosts would be affected by a playbook before you run it, you can do this:

ansible-playbook playbook.yml --list-hosts

Run Ansible playbook

ansible-playbook -i hosts site.yml

Using with AWS

To use Ansible with AWS you need boto3 installed on your system, a Python scripting tool that interfaces AWS.


Scott's Example of Updating the Inventories

To run the "update all hostnames" task, he used the command:

ansible-playbook -i inventories/production2 playbook_update_hosts.yml

Test Web Server Ping

ansible-wak$ ansible webservers -i inventories -u ubuntu -m ping
54.89.216.138 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment