First run with the "-v" flag and see what the returns from the ec2 module looks like, which will help with testing how to use the resultant data.
On Tue, Apr 15, 2014 at 5:52 PM, mark david mcCreary <[email protected] > wrote: > I want to finish off an Ansible playbook by assigning a static IP address > to it. I want to do this at the end, because I think it takes a few > minutes to take effect. Not sure if doing it at the beginning would cause > Ansible to loose the connection or not. > > I launch an instance like this > > - name: Launch instance > local_action: ec2 keypair={{ keypair }} instance_type={{ instance_type > }} > image={{ image }} region={{ region }} > aws_access_key={{ aws_access_key }} > aws_secret_key={{ aws_secret_key }} > group={{ security_group }} wait=true > register: ec2 > > > I've tried a couple of different ways, both fail. > > - name: associate testing.example.com with this instance > local_action: ec2_eip instance_id={{ item.id }} ip=54.243.243.102 > region=us-east-1 > with_items: ec2.instances > > TASK: [missing | associate testing.example.com with this instance] > ****** > fatal: [54.198.204.2] => One or more undefined variables: 'str object' > has no attribute 'id' > > > > - name: associate testing.example.com with this instance > local_action: ec2_eip instance_id={{ ec2.instance_ids[0] }} > ip=54.243.243.102 region=us-east-1 > > TASK: [missing | associate testing.example.com with this instance] > ****** > fatal: [54.197.175.124] => One or more undefined variables: 'ec2' is > undefined > > > Can somebody show me the correct syntax. > > Thanks > > mark > > -- > 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/06f1b7e2-2bc3-49be-9649-aaa9769194b6%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/06f1b7e2-2bc3-49be-9649-aaa9769194b6%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CA%2BnsWgzcad9f1QkDFa9%3DZVhtWASo8fhVVX%3Di8PJFpenUtYuQAw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
