ec2.py says I'm not being idempotent

823 views
Skip to first unread message

David Neudorfer

unread,
Jul 15, 2014, 6:59:25 AM7/15/14
to ansible...@googlegroups.com
This works on one computer just fine but even after a reinstall of ansible I'm still getting this error on my personal laptop.

- name: Launch instance
  local_action
: ec2
    key_name
={{ key_name }}
   
group={{ security_group }}
    instance_type
={{ instance_type }}
    image
={{ image }}
    wait
=true
    region
={{ region }}
    instance_tags
='{"Name":"wordpress"}'
    monitoring
=no
    instance_tags
='Name=wordpress,Group=WP'
    id
=wordpress
 
register: ec2


TASK: [aws | Launch instance] *************************************************

<127.0.0.1> REMOTE_MODULE ec2 key_name=wordpress group=wordpress instance_type=m1.small image=ami-8997afe0 wait=true region=us-east-1 instance_tags='{"Name":"wordpress"}' monitoring=no instance_tags='Name=wordpress,Group=WP' id=wordpress

<127.0.0.1> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1405421602.32-200027015393859 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1405421602.32-200027015393859 && echo $HOME/.ansible/tmp/ansible-tmp-1405421602.32-200027015393859']

<127.0.0.1> PUT /var/folders/_0/2zdl4_9j5txg1fgs3glyfxp80000gn/T/tmpwu_vPt TO /Users/davidneudorfer/.ansible/tmp/ansible-tmp-1405421602.32-200027015393859/ec2

<127.0.0.1> EXEC ['/bin/sh', '-c', u'LANG=C LC_CTYPE=C /Users/davidneudorfer/Git/ansible-venv2/bin/python /Users/davidneudorfer/.ansible/tmp/ansible-tmp-1405421602.32-200027015393859/ec2; rm -rf /Users/davidneudorfer/.ansible/tmp/ansible-tmp-1405421602.32-200027015393859/ >/dev/null 2>&1']

failed
: [localhost -> 127.0.0.1] => {"failed": true}

msg
: Instance creation failed => IdempotentParameterMismatch: Arguments on this idempotent request are inconsistent with arguments used in previous request(s).

FATAL
: all hosts have already failed -- aborting

David Neudorfer

unread,
Jul 15, 2014, 8:19:57 AM7/15/14
to ansible...@googlegroups.com
Back at my work computer now and it fails here as well.

Michael DeHaan

unread,
Jul 15, 2014, 11:37:11 AM7/15/14
to ansible...@googlegroups.com

That's a really confusing error message from AWS.







--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6dfa7911-07fa-464b-b842-b44af2921658%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

jonath...@gmail.com

unread,
Mar 24, 2015, 1:51:50 PM3/24/15
to ansible...@googlegroups.com
I just ran into this error too.  It has to do with the "id=wordpress" in your task - see: http://ansible.sivel.net/docs/ec2_module.html

id - identifier for this instance or set of instances, so that the module will be idempotent with respect to EC2 instances. This identifier is valid for at least 24 hours after the termination of the instance, and should not be reused for another call later on. For details, see the description of client token at http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Run_Instance_Idempotency.html.
 
I'm finding that the "id" is valid for a LOT more than 24 hours for me.  This is a pain since I'm destroying and recreating instances with the same name.

Instead of "id", just use something like the following to maintain the number of boxes you want/ID the boxes:
        instance_tags:
          Name: "{{ prefix }}_jumpbox"
        exact_count: 1
        count_tag:
          Name: "{{ prefix }}_jumpbox"

Best,

Jonathan
Reply all
Reply to author
Forward
0 new messages