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
To use Ansible with AWS you need boto3 installed on your system, a Python scripting tool that interfaces AWS.
To run the "update all hostnames" task, he used the command:
ansible-playbook -i inventories/production2 playbook_update_hosts.yml
ansible-wak$ ansible webservers -i inventories -u ubuntu -m ping
54.89.216.138 | SUCCESS => {
"changed": false,
"ping": "pong"
}