*[I detest the groups interface, btw]*

Let's try that again.

You've got some convoluted variable definitions. Consider doing this instead

  vars:
    clfrecord:
      prod: "prod-{{ carrier }}"
      stage: "stage-{{ carrier }}"

Then in your task you can say

    record: "{{ clfrecord[env] }}"

Cheers,
On Wednesday, February 1, 2023 at 11:49:02 AM UTC-5 Todd Lewis wrote:

> You've got some convoluted variable definitions. Consider doing this 
> instead
>   vars:
>     clfrecord:
>       prod: "prod-{{ carrier }}"
>       stage: "stage-{{ carrier }}"
> Then in your task you can say
>
>
> On Wednesday, February 1, 2023 at 11:40:31 AM UTC-5 ema...@gmail.com 
> wrote:
>
>> Hi all, i need to understand how to work with this scenario.
>>
>> I have this:
>>
>> - name: "Creating DNS Record In CloudFlare"
>>  hosts: localhost
>>  gather_facts: no
>>  vars:
>>    "prod":
>>       clfrecord-prod: "prod-{{ carrier }}"
>>    "stage":
>>       clfrecord-stage: "stage-{{ carrier }"
>>  tasks:
>>      community.general.cloudflare_dns:
>>        zone: domain.net
>>        record: "{{HERE ADD clfrecord}}"
>>        type: CNAME
>>        value: x-x-xxx.elb.x-x-x.amazonaws.com
>>        account_email:
>>        account_api_key:
>>        proxied: yes
>>
>> I passed the vars "carriers" and "env" from console.
>>
>> I need to compare the console variable "{{ env }}" and if it matches prod 
>> add the value of clfrecord-prod to the "record" field, and if it is stage 
>> its corresponding value.
>>
>> any helps?
>>
>

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/237f9eb2-61ae-4800-81c6-f711926b63f6n%40googlegroups.com.

Reply via email to