I’ve being trying to get the tag “Name” I’ve created for my ec2 instance using the ec2_tag module with this task file:
$cat getTagTask.yml
-
name: Testing
action: ec2_facts
tags: [metric-alarms] -
name: list resource tags
local_action: ec2_tag resource=ansible_ec2_instance-id region=us-east-1 state=list
tags: [metric-alarms]
I’m running this task file as part of a playbook. Something like:
$ cat myEnv.yml
#!./ansi-playbook
- include: playbooks/config/component.yml env_tag=tag_environment_perf
The command I’m using to run this specific ansible tag is:
./myEnv.yml -l tag_Name_myInstanceName-0 -t metric-alarms -vvvvv
Which means run tag ‘metric-alarms’ for all instances that have the tag Name equals myInstanceName-0
Unfortunately I get this error:
failed: [ec2-11-222-333-444.compute-1.amazonaws.com] => {“failed”: true, “parsed”: false}
invalid output was: [sudo via ansible, key=yuojjsthkixxxxircogegeobqhnzhqmp] password:
FATAL: all hosts have already failed – aborting
If I change local_action to action, I then get this other error:
failed: [ec2-11-222-333-444.compute-1.amazonaws.com] => {“failed”: true}
msg: No handler was ready to authenticate. 1 handlers were checked. [‘QuerySignatureV2AuthHandler’] Check your credentials
FATAL: all hosts have already failed – aborting
Can someone help me to fix it?