ec2_metric_alarm is failling when passing dimensions argument

257 views
Skip to first unread message

Douglas Lopes Pereira

unread,
Jun 25, 2014, 1:29:00 PM6/25/14
to ansible...@googlegroups.com
I need to create an alarm associated with one of my AWS instances. For that I'm using the following task:

- name: Create CPU utilization metric alarm
  sudo: false
  local_action: ec2_metric_alarm state=present region=us-east-1 name="Alarm Name" metric="CPUUtilization" statistic=Average comparison=">=" threshold=80.0 unit="Percent" period=300 evaluation_periods=1 description="It will be triggered when CPU utilization is more than 80% for 5 minutes" dimensions={'InstanceId':'i-abcdefg'}

And it is failling with this error:

failed: [ec2-54-237-178-129.compute-1.amazonaws.com] => {"failed": true, "parsed": false}
invalid output was: Traceback (most recent call last):
  File "/home/douglas/.ansible/tmp/ansible-tmp-1403716886.08-63354845163799/ec2_metric_alarm", line 1670, in <module>
    main()
  File "/home/douglas/.ansible/tmp/ansible-tmp-1403716886.08-63354845163799/ec2_metric_alarm", line 1655, in main
    module = AnsibleModule(argument_spec=argument_spec)
  File "/home/douglas/.ansible/tmp/ansible-tmp-1403716886.08-63354845163799/ec2_metric_alarm", line 337, in __init__
    self._check_argument_types()
  File "/home/douglas/.ansible/tmp/ansible-tmp-1403716886.08-63354845163799/ec2_metric_alarm", line 837, in _check_argument_types
    (result, exc) = self.safe_eval(value, dict(), include_exceptions=True)
AttributeError: 'AnsibleModule' object has no attribute 'safe_eval'

FATAL: all hosts have already failed -- aborting



Looks like it is trying to parse the dimensions argument as dict() but cannot do that.
Any help is appreciated.

Regards,
Douglas

Michael DeHaan

unread,
Jun 25, 2014, 8:14:41 PM6/25/14
to ansible...@googlegroups.com
This sounds like this may be a mixed version of Ansible to me, an old library or something half running out of devel and half an install.




--
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/19c8305f-522e-4ad2-994b-4dc760012634%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Douglas Lopes Pereira

unread,
Jun 26, 2014, 6:33:07 AM6/26/14
to ansible...@googlegroups.com
Is it possible to force upgrading all dependencies? All I did to get 1.6.5 was running:

$ sudo pip install boto --upgrade
$ sudo pip install ansible --upgrade

Thanks for your time.
Regards,
Douglas

Douglas Lopes Pereira

unread,
Jun 26, 2014, 6:46:52 AM6/26/14
to ansible...@googlegroups.com
I just read this blog post (http://blog.willmer.org/2007/12/attributeerror-module-object-has-no-attribute-blah/) and started thinking this might be a problem.
Do we need the __init__.py file copied over to the directory where the ec2_metric_alarm script runs?

Hope to hear from you.
Thanks.

Douglas Lopes Pereira

unread,
Jun 26, 2014, 6:53:23 AM6/26/14
to ansible...@googlegroups.com
Sorry for top posting over and over.
A bug was already reported and should cover this error:

https://github.com/ansible/ansible/issues/7679

Any known workarround?

Thanks.
Regards,
Douglas
Reply all
Reply to author
Forward
0 new messages