Hello All,

I'm trying to re-use a task (by calling it for different purposes via 
include) so that I can substitute the values of one of module options.
So in one case I have dimension_name="HealthyHostCount" and in another 
dimension_name="BackendConnectionErrors" but it doesn't work as I want.
It doesn't throw error but "{{ dimension_name }}" is not substituted.

- name: Create alarm
  ec2_metric_alarm:
    region: "{{ aws_region }}"
    ...
    dimensions:
      "{{ dimension_name }}": "{{ dimension_value }}"
    ...
    state: "{{ state }}"



task 1:
- name: Create alarm
  ec2_metric_alarm:
    region: "{{ aws_region }}"
    ...
    dimensions:
      "HealthyHostCount": "{{ dimension_value }}"
    ...
    state: "{{ state }}"

task 2:
- name: Create alarm
  ec2_metric_alarm:
    region: "{{ aws_region }}"
    ...
    dimensions:
      "BackendConnectionErrors": "{{ dimension_value }}"
    ...
    state: "{{ state }}"


I want to avoid creation of 2 tasks like above with conditions rather use 
one tasks as I might have many possible values for "dimension_name" and the 
file become large and complex.
Is there any way to have a variable value substituted in left side?

Thanks,
Constantin

-- 
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/86408376-76c8-4b82-b660-6a77c64e03e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to