Hi All,

 I`m struggling to get this working without success.. Here my playbook.

First a search my machines by tag and later try to terminate them.

---

   - name: EC2 Facts
     ec2_instance_facts:
      region: us-east-1
      filters:
        "tag:Type": "staging"
      aws_access_key: "{{ lookup('env', 'AWS_ACCESS_KEY_ID') }}"
      aws_secret_key: "{{ lookup('env', 'AWS_SECRET_ACCESS_KEY') }}"
     register: ec2

   - name: Kill EC2 Instance
     ec2:
     instance_ids: "{{ ec2.instance_id }}"
     state: "{{ state }}"
     region: "{{ lookup('env', 'AWS_REGION') }}"
     aws_access_key: "{{ lookup('env', 'AWS_ACCESS_KEY_ID') }}"
     aws_secret_key: "{{ lookup('env', 'AWS_SECRET_ACCESS_KEY') }}"



Running
ansible-playbook ec2_id_kill.yml --extra-vars "state=absent"

Error:
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": 
"image parameter is required for new instance"}



Looks like I cannot able to parse the facts.




-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a9847a0f-b353-4552-844c-7b5998a6dc18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to