Change location of hosts file
-
create your own ansible.cfg
[defaults] inventory = /path/to/hosts
Ping all hosts
ansible all -m ping --private-key private.pem -u ec2-user
EC2
wget https://raw.githubusercontent.com/ansible/ansible/devel/plugins/inventory/ec2.py
wget https://raw.githubusercontent.com/ansible/ansible/devel/plugins/inventory/ec2.ini
-
create boto config with AWS keys
[Credentials] aws_access_key_id = <here> aws_secret_access_key = <here>
ansible -i ec2.py -u ec2-user <region> -m ping --private-key private.pem
Restart machine
ansible -i ec2.py -u ec2-user <region> -a "/sbin/reboot" -f 10 --sudo --private-key private.pem