Hi All,
I'm trying to create a terminate AWS EC2 play using the dynamic inventory
script but I keep getting fatal: [remote_host_ip]: FAILED! => {"changed":
false, "failed": true, "msg": "boto required for this module"}.
I created the instance using another play and that works perfectly.
My terminate play looks like this:
---
- name: Find instances
hosts: tag_Environment_goji
gather_facts: False
tasks:
- name: Create group
group_by: key=mark_terminate
- hosts: mark_terminate
connection: local
gather_facts: false
tasks:
- name: Terminate instance(s)
ec2:
profile: china
region: cn-north-1
instance_ids: "{{ ec2_id }}"
state: absent
I'm running Ansible 2.0.0-beta.
I run the playbook using this from my local laptop:
ansible-playbook -i china_aws_inventory/ec2.py
roles/terminate_environment.yml -e "env=goji" --limit tag_Environment_goji
-vvvv
Using /Users/Etherdaemon/personal/coderepos/ansible/ansible.cfg as config
file
2 plays in roles/terminate_environment.yml
Loaded callback default of type stdout, v2.0
PLAY [Find instances]
**********************************************************
TASK [Create group]
************************************************************
changed: [10.237.3.62] => {"add_group": "mark_terminate", "changed": true}
PLAY
***************************************************************************
TASK [Terminate instance(s)]
***************************************************
ESTABLISH LOCAL CONNECTION FOR USER: ubuntu
10.237.3.62 EXEC (umask 22 && mkdir -p
"$HOME/.ansible/tmp/ansible-tmp-1445473215.44-14684358660357" && echo
"$HOME/.ansible/tmp/ansible-tmp-1445473215.44-14684358660357")
10.237.3.62 PUT /var/folders/vh/rdc7pnkj2kz6vs9vhb844c480000gn/T/tmpCoE5zB
TO
/Users/Etherdaemon/.ansible/tmp/ansible-tmp-1445473215.44-14684358660357/ec2
10.237.3.62 EXEC LANG=C LC_MESSAGES=C LC_CTYPE=C /usr/bin/python
/Users/Etherdaemon/.ansible/tmp/ansible-tmp-1445473215.44-14684358660357/ec2;
rm -rf
"/Users/Etherdaemon/.ansible/tmp/ansible-tmp-1445473215.44-14684358660357/"
> /dev/null 2>&1
fatal: [10.237.3.62]: FAILED! => {"changed": false, "failed": true, "msg":
"boto required for this module"}
PLAY RECAP
*********************************************************************
10.237.3.62 : ok=1 changed=1 unreachable=0 failed=1
The part I'm confused about is that I thought connection: local ran the
terminate command from my local laptop - not from the remote host I want to
terminate? The above output look like it's trying to run it from the
remote??
If I change hosts to localhost in the playbook then I get skipping: no
hosts matched when trying to find the instances.
If I run the inventory first using python china_aws_inventory/ec2.py
--refresh-cache it finds all the instances, but running the play still says
skipping due to no hosts found.
I'm running on:
- MAC OSX 10.10.5
- Ansible v2.0.0-0.3.beta1
- boto: 2.38.0
Launch scripts using the same ec2 module and boto profile works fine.
Any help greatly appreciated.
Karen
--
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/9a7c1710-1ec5-4374-b92b-0f6caa2c3ed5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.