Ansible ec2 module for adhoc terminate...

Hey Guys,

I am having problems terminating ec2 instances with the following invocation:

$ AWS_PROFILE=npu-root ansible -i ec2.py -u ec2-user --private-key ~/.ssh/BeteNar.pem tag_db_postgres -m ec2 -a ‘state=absent region=us-east-1’ -vvv

Which yielded the following, which seemed to imply there was an issue with my creds… however I can manually successfully ssh to each instance with ec2-user with the BeteNar.pem private key… Any help would be greatly appreciated.

Using /etc/ansible/ansible.cfg as config file
<ec2-54-226-249-100.compute-1.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ec2-user
<ec2-54-146-228-170.compute-1.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ec2-user
<ec2-54-159-45-6.compute-1.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ec2-user
<ec2-54-226-249-100.compute-1.amazonaws.com> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o ‘IdentityFile=“/home/sonnychee/.ssh/BeteNar.pem”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ec2-user -o ConnectTimeout=10 -o ControlPath=/home/sonnychee/.ansible/cp/%h-%p-%r ec2-54-226-249-100.compute-1.amazonaws.com ‘/bin/sh -c ‘"’"’( umask 77 && mkdir -p “echo $HOME/.ansible/tmp/ansible-tmp-1476998334.12-260908329559293” && echo ansible-tmp-1476998334.12-260908329559293=“echo $HOME/.ansible/tmp/ansible-tmp-1476998334.12-260908329559293” ) && sleep 0’“'”‘’
<ec2-54-159-45-6.compute-1.amazonaws.com> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o ‘IdentityFile=“/home/sonnychee/.ssh/BeteNar.pem”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ec2-user -o ConnectTimeout=10 -o ControlPath=/home/sonnychee/.ansible/cp/%h-%p-%r ec2-54-159-45-6.compute-1.amazonaws.com ‘/bin/sh -c ‘"’"’( umask 77 && mkdir -p “echo $HOME/.ansible/tmp/ansible-tmp-1476998334.12-91272603271631” && echo ansible-tmp-1476998334.12-91272603271631=“echo $HOME/.ansible/tmp/ansible-tmp-1476998334.12-91272603271631” ) && sleep 0’“'”‘’
<ec2-54-146-228-170.compute-1.amazonaws.com> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o ‘IdentityFile=“/home/sonnychee/.ssh/BeteNar.pem”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ec2-user -o ConnectTimeout=10 -o ControlPath=/home/sonnychee/.ansible/cp/%h-%p-%r ec2-54-146-228-170.compute-1.amazonaws.com ‘/bin/sh -c ‘"’"’( umask 77 && mkdir -p “echo $HOME/.ansible/tmp/ansible-tmp-1476998334.12-151598906640500” && echo ansible-tmp-1476998334.12-151598906640500=“echo $HOME/.ansible/tmp/ansible-tmp-1476998334.12-151598906640500” ) && sleep 0’“'”‘’
<ec2-54-226-249-100.compute-1.amazonaws.com> PUT /tmp/tmpAFySYk TO /home/ec2-user/.ansible/tmp/ansible-tmp-1476998334.12-260908329559293/ec2
<ec2-54-226-249-100.compute-1.amazonaws.com> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o ‘IdentityFile=“/home/sonnychee/.ssh/BeteNar.pem”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ec2-user -o ConnectTimeout=10 -o ControlPath=/home/sonnychee/.ansible/cp/%h-%p-%r ‘[ec2-54-226-249-100.compute-1.amazonaws.com]’
<ec2-54-159-45-6.compute-1.amazonaws.com> PUT /tmp/tmpeI7RXc TO /home/ec2-user/.ansible/tmp/ansible-tmp-1476998334.12-91272603271631/ec2
<ec2-54-159-45-6.compute-1.amazonaws.com> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o ‘IdentityFile=“/home/sonnychee/.ssh/BeteNar.pem”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ec2-user -o ConnectTimeout=10 -o ControlPath=/home/sonnychee/.ansible/cp/%h-%p-%r ‘[ec2-54-159-45-6.compute-1.amazonaws.com]’
<ec2-54-146-228-170.compute-1.amazonaws.com> PUT /tmp/tmpsnzihx TO /home/ec2-user/.ansible/tmp/ansible-tmp-1476998334.12-151598906640500/ec2
<ec2-54-146-228-170.compute-1.amazonaws.com> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o ‘IdentityFile=“/home/sonnychee/.ssh/BeteNar.pem”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ec2-user -o ConnectTimeout=10 -o ControlPath=/home/sonnychee/.ansible/cp/%h-%p-%r ‘[ec2-54-146-228-170.compute-1.amazonaws.com]’
<ec2-54-226-249-100.compute-1.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ec2-user
<ec2-54-226-249-100.compute-1.amazonaws.com> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o ‘IdentityFile=“/home/sonnychee/.ssh/BeteNar.pem”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ec2-user -o ConnectTimeout=10 -o ControlPath=/home/sonnychee/.ansible/cp/%h-%p-%r ec2-54-226-249-100.compute-1.amazonaws.com ‘/bin/sh -c ‘"’“‘chmod u+x /home/ec2-user/.ansible/tmp/ansible-tmp-1476998334.12-260908329559293/ /home/ec2-user/.ansible/tmp/ansible-tmp-1476998334.12-260908329559293/ec2 && sleep 0’”’“‘’
<ec2-54-159-45-6.compute-1.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ec2-user
<ec2-54-159-45-6.compute-1.amazonaws.com> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile=”/home/sonnychee/.ssh/BeteNar.pem"’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ec2-user -o ConnectTimeout=10 -o ControlPath=/home/sonnychee/.ansible/cp/%h-%p-%r ec2-54-159-45-6.compute-1.amazonaws.com ‘/bin/sh -c ‘"’“‘chmod u+x /home/ec2-user/.ansible/tmp/ansible-tmp-1476998334.12-91272603271631/ /home/ec2-user/.ansible/tmp/ansible-tmp-1476998334.12-91272603271631/ec2 && sleep 0’”’“‘’
<ec2-54-226-249-100.compute-1.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ec2-user
<ec2-54-226-249-100.compute-1.amazonaws.com> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile=”/home/sonnychee/.ssh/BeteNar.pem"’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ec2-user -o ConnectTimeout=10 -o ControlPath=/home/sonnychee/.ansible/cp/%h-%p-%r -tt ec2-54-226-249-100.compute-1.amazonaws.com ‘/bin/sh -c ‘"’“‘LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/ec2-user/.ansible/tmp/ansible-tmp-1476998334.12-260908329559293/ec2; rm -rf “/home/ec2-user/.ansible/tmp/ansible-tmp-1476998334.12-260908329559293/” > /dev/null 2>&1 && sleep 0’”’“‘’
<ec2-54-146-228-170.compute-1.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ec2-user
<ec2-54-146-228-170.compute-1.amazonaws.com> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile=”/home/sonnychee/.ssh/BeteNar.pem"’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ec2-user -o ConnectTimeout=10 -o ControlPath=/home/sonnychee/.ansible/cp/%h-%p-%r ec2-54-146-228-170.compute-1.amazonaws.com ‘/bin/sh -c ‘"’“‘chmod u+x /home/ec2-user/.ansible/tmp/ansible-tmp-1476998334.12-151598906640500/ /home/ec2-user/.ansible/tmp/ansible-tmp-1476998334.12-151598906640500/ec2 && sleep 0’”’“‘’
<ec2-54-159-45-6.compute-1.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ec2-user
<ec2-54-159-45-6.compute-1.amazonaws.com> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile=”/home/sonnychee/.ssh/BeteNar.pem"’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ec2-user -o ConnectTimeout=10 -o ControlPath=/home/sonnychee/.ansible/cp/%h-%p-%r -tt ec2-54-159-45-6.compute-1.amazonaws.com ‘/bin/sh -c ‘"’“‘LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/ec2-user/.ansible/tmp/ansible-tmp-1476998334.12-91272603271631/ec2; rm -rf “/home/ec2-user/.ansible/tmp/ansible-tmp-1476998334.12-91272603271631/” > /dev/null 2>&1 && sleep 0’”’“‘’
<ec2-54-146-228-170.compute-1.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ec2-user
<ec2-54-146-228-170.compute-1.amazonaws.com> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o 'IdentityFile=”/home/sonnychee/.ssh/BeteNar.pem"’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ec2-user -o ConnectTimeout=10 -o ControlPath=/home/sonnychee/.ansible/cp/%h-%p-%r -tt ec2-54-146-228-170.compute-1.amazonaws.com ‘/bin/sh -c ‘"’“‘LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/ec2-user/.ansible/tmp/ansible-tmp-1476998334.12-151598906640500/ec2; rm -rf “/home/ec2-user/.ansible/tmp/ansible-tmp-1476998334.12-151598906640500/” > /dev/null 2>&1 && sleep 0’”’"‘’
ec2-54-226-249-100.compute-1.amazonaws.com | FAILED! => {
“changed”: false,
“failed”: true,
“invocation”: {
“module_args”: {
“assign_public_ip”: false,
“aws_access_key”: null,
“aws_secret_key”: null,
“count”: 1,
“count_tag”: null,
“ebs_optimized”: false,
“ec2_url”: null,
“exact_count”: null,
“group”: null,
“group_id”: null,
“id”: null,
“image”: null,
“instance_ids”: null,
“instance_profile_name”: null,
“instance_tags”: null,
“instance_type”: null,
“kernel”: null,
“key_name”: null,
“monitoring”: false,
“network_interfaces”: null,
“placement_group”: null,
“private_ip”: null,
“profile”: null,
“ramdisk”: null,
“region”: “us-east-1”,
“security_token”: null,
“source_dest_check”: true,
“spot_launch_group”: null,
“spot_price”: null,
“spot_type”: “one-time”,
“spot_wait_timeout”: “600”,
“state”: “absent”,
“tenancy”: “default”,
“termination_protection”: false,
“user_data”: null,
“validate_certs”: true,
“volumes”: null,
“vpc_subnet_id”: null,
“wait”: false,
“wait_timeout”: “300”,
“zone”: null
},
“module_name”: “ec2”
},
“msg”: “No handler was ready to authenticate. 1 handlers were checked. [‘HmacAuthV4Handler’] Check your credentials”
}
ec2-54-159-45-6.compute-1.amazonaws.com | FAILED! => {
“changed”: false,
“failed”: true,
“invocation”: {
“module_args”: {
“assign_public_ip”: false,
“aws_access_key”: null,
“aws_secret_key”: null,
“count”: 1,
“count_tag”: null,
“ebs_optimized”: false,
“ec2_url”: null,
“exact_count”: null,
“group”: null,
“group_id”: null,
“id”: null,
“image”: null,
“instance_ids”: null,
“instance_profile_name”: null,
“instance_tags”: null,
“instance_type”: null,
“kernel”: null,
“key_name”: null,
“monitoring”: false,
“network_interfaces”: null,
“placement_group”: null,
“private_ip”: null,
“profile”: null,
“ramdisk”: null,
“region”: “us-east-1”,
“security_token”: null,
“source_dest_check”: true,
“spot_launch_group”: null,
“spot_price”: null,
“spot_type”: “one-time”,
“spot_wait_timeout”: “600”,
“state”: “absent”,
“tenancy”: “default”,
“termination_protection”: false,
“user_data”: null,
“validate_certs”: true,
“volumes”: null,
“vpc_subnet_id”: null,
“wait”: false,
“wait_timeout”: “300”,
“zone”: null
},
“module_name”: “ec2”
},
“msg”: “No handler was ready to authenticate. 1 handlers were checked. [‘HmacAuthV4Handler’] Check your credentials”
}
ec2-54-146-228-170.compute-1.amazonaws.com | FAILED! => {
“changed”: false,
“failed”: true,
“invocation”: {
“module_args”: {
“assign_public_ip”: false,
“aws_access_key”: null,
“aws_secret_key”: null,
“count”: 1,
“count_tag”: null,
“ebs_optimized”: false,
“ec2_url”: null,
“exact_count”: null,
“group”: null,
“group_id”: null,
“id”: null,
“image”: null,
“instance_ids”: null,
“instance_profile_name”: null,
“instance_tags”: null,
“instance_type”: null,
“kernel”: null,
“key_name”: null,
“monitoring”: false,
“network_interfaces”: null,
“placement_group”: null,
“private_ip”: null,
“profile”: null,
“ramdisk”: null,
“region”: “us-east-1”,
“security_token”: null,
“source_dest_check”: true,
“spot_launch_group”: null,
“spot_price”: null,
“spot_type”: “one-time”,
“spot_wait_timeout”: “600”,
“state”: “absent”,
“tenancy”: “default”,
“termination_protection”: false,
“user_data”: null,
“validate_certs”: true,
“volumes”: null,
“vpc_subnet_id”: null,
“wait”: false,
“wait_timeout”: “300”,
“zone”: null
},
“module_name”: “ec2”
},
“msg”: “No handler was ready to authenticate. 1 handlers were checked. [‘HmacAuthV4Handler’] Check your credentials”
}