I'm wondering if I am misusing the ec2_vol task or if I've found a bug.
In my playbook, I create 5 ec2 instances. I then try to attach volumes to them.
tasks:
- name: get em runnning
local_action:
module: ec2
region: "{{ region }}"
group: "{{ security_group }}"
instance_type : "{{ instance_type}}"
image: "{{ image }}"
keypair: "{{ keypair }}"
wait: yes
instance_tags:
Name: installtype
value: riak
exact_count: 5
count_tag:
Name: installtype
value: riak
register: ec2
- name: debug those instance id's
debug: msg="{{item}}"
with_items: ec2.instances
when: ec2.instances
- name: attach big volumes
local_action: ec2_vol instance="{{item.id}}" volume_size=5
region="{{region}}"
with_items: ec2.instances
register: ec2_vol
when: ec2.instances
But everything explodes, with a python exception in
"ec2.get_password_data(inst.id)".
I'm running the latest from the devel branch.
Best Regards,
Bryan Hunt
TASK: [attach big volumes] ****************************************************
<127.0.0.1> REMOTE_MODULE ec2_vol instance="{u'kernel':
u'aki-88aa75e1', u'root_device_type': u'ebs', u'private_dns_name':
u'ip-172-31-28-55.ec2.internal', u'public_ip': u'54.86.133.228',
u'private_ip': u'172.31.28.55', u'id': u'i-943df4c4',
u'ebs_optimized': False, u'state': u'running', u'virtualization_type':
u'paravirtual', u'architecture': u'x86_64', u'ramdisk': None,
u'key_name': u'rtcloud', u'image_id': u'ami-a73264ce',
u'public_dns_name': u'ec2-54-86-133-228.compute-1.amazonaws.com',
u'state_code': 16, u'placement': u'us-east-1b', u'ami_launch_inde
x': u'1', u'dns_name': u'ec2-54-86-133-228.compute-1.amazonaws.com',
u'region': u'us-east-1', u'launch_time': u'2014-04-29T17:00:41.000Z',
u'instance_type': u'm1.small', u'root_device_nam e': u'/dev/sda1',
u'hypervisor': u'xen'}" volume_size=5 region="us-east-1"
<127.0.0.1> EXEC ['/bin/sh', '-c', 'mkdir -p
$HOME/.ansible/tmp/ansible-tmp-1398790871.05-68270196266360 && chmod
a+rx $HOME/.ansible/tmp/ansible-tmp-1398790871.05-68270196266360 &&
echo $HOME/.ansible/tmp/ansible-tmp-1398790871.05-68270196266360']
<127.0.0.1> PUT
/var/folders/bk/cmtcbxsj3rdfjqhjswd_zbg80000gp/T/tmp7nC5zp TO
/Users/bryan/.ansible/tmp/ansible-tmp-1398790871.05-68270196266360/ec2_vol
<127.0.0.1> EXEC ['/bin/sh', '-c', '/usr/bin/python
/Users/bryan/.ansible/tmp/ansible-tmp-1398790871.05-68270196266360/ec2_vol;
rm -rf /Users/bryan/.ansible/tmp/ansible-tmp-1398790871.05-
68270196266360/ >/dev/null 2>&1']
failed: [localhost] => (item={u'kernel': u'aki-88aa75e1',
u'root_device_type': u'ebs', u'private_dns_name':
u'ip-172-31-0-177.ec2.internal', u'public_ip': u'54.86.70.53',
u'private_ip': u'172
.31.0.177', u'id': u'i-9841adcb', u'ebs_optimized': False, u'state':
u'running', u'virtualization_type': u'paravirtual', u'architecture':
u'x86_64', u'ramdisk': None, u'key_name': u'rtcloud',
u'image_id': u'ami-a73264ce', u'public_dns_name':
u'ec2-54-86-70-53.compute-1.amazonaws.com', u'state_code': 16,
u'placement': u'us-east-1c', u'ami_launch_index': u'0', u'dns_name':
u'ec2-54
-86-70-53.compute-1.amazonaws.com', u'region': u'us-east-1',
u'launch_time': u'2014-04-29T17:36:56.000Z', u'instance_type':
u'm1.small', u'root_device_name': u'/dev/sda1', u'hypervisor': u'xe
n'}) => {"failed": true, "item": {"ami_launch_index": "0",
"architecture": "x86_64", "dns_name":
"ec2-54-86-70-53.compute-1.amazonaws.com", "ebs_optimized": false,
"hypervisor": "xen", "id":
"i-9841adcb", "image_id": "ami-a73264ce", "instance_type": "m1.small",
"kernel": "aki-88aa75e1", "key_name": "rtcloud", "launch_time":
"2014-04-29T17:36:56.000Z", "placement": "us-east-1c", $
private_dns_name": "ip-172-31-0-177.ec2.internal", "private_ip":
"172.31.0.177", "public_dns_name":
"ec2-54-86-70-53.compute-1.amazonaws.com", "public_ip": "54.86.70.53",
"ramdisk": null, "r$
gion": "us-east-1", "root_device_name": "/dev/sda1",
"root_device_type": "ebs", "state": "running", "state_code": 16,
"virtualization_type": "paravirtual"}, "parsed": false}
invalid output was: Traceback (most recent call last):
File "/Users/bryan/.ansible/tmp/ansible-tmp-1398793058.53-263257413843937/ec2_vol",
line 1722, in <module>
main()
File "/Users/bryan/.ansible/tmp/ansible-tmp-1398793058.53-263257413843937/ec2_vol",
line 353, in main
attach_volume(module, ec2, volume, inst)
File "/Users/bryan/.ansible/tmp/ansible-tmp-1398793058.53-263257413843937/ec2_vol",
line 281, in attach_volume
if not ec2.get_password_data(inst.id):
NameError: global name 'inst' is not defined