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
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