Hi guys, I'm still pretty new to Ansible and was wondering if you could
answer a question I have.
I'm trying to create an AWS scaling policy and attach a metric alarm to it.
>From what I understand, the ec2_metric_alarm module needs the ARN of the
scaling policy so that it can associate itself with it. However, I can't
seem to get the ARN after creating a new scaling policy from the
ec2_scaling_policy module's output. Currently I'm trying to register the
result of the ec2_scaling policy module. For example, my playbook looks
something like this:
- name: Create scaling policy and associate it with autoscaling group
ec2_scaling_policy:
state: present
region: us-east-1
name: "test-scaleup-policy"
adjustment_type: "ChangeInCapacity"
asg_name: "test-asg"
scaling_adjustment: 1
min_adjustment_step: 1
cooldown: 300
register: sp_result
- name: Debug result of scaling policy creation
debug: var=sp_result
- name: Create metric alarm and associate it with autoscaling policy
action:
module: ec2_metric_alarm
state: present
alarm_actions: ["{{ sp_result.arn }}"]
etc...
The debug module prints this:
TASK: [Debug]
*****************************************************************
ok: [localhost] => {
"sg_result": {
"changed": false,
"invocation": {
"module_args": "",
"module_name": "ec2_scaling_policy"
}}}
According to this merged pull request
<https://github.com/ansible/ansible/pull/7829>, the ARN should be included
in the data the module returns. Am I trying to capturing this information
in the wrong way, e.g. using register when I should be using something
else? Otherwise, is there something else I should be doing?
--
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/f3ca0fa1-2b9b-4de1-a0a4-61f2c58e27a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.