Thanks Dick that’s what I needed

On Fri, 8 Mar 2024 at 00:36, Dick Visser <dnmvis...@gmail.com> wrote:

>
>
> On Thu, 7 Mar 2024 at 16:02, Prady A <pradyumna....@gmail.com> wrote:
>
>> Hi again
>>
>> For simplicity I thought to do like this.
>>
>> Current code
>> - name: Subscribe my repo
>>    shell: |
>>       subscription-manager register bla bla
>>
>>
>> *After*
>>
>> - name: Subscribe US REPO
>>    shell: |
>>       subscription-manager register US server
>>     When:
>>         IS_UK = false
>>
>> - name: Subscribe UK REPO
>>    shell: |
>>       subscription-manager register UK server
>>     When:
>>         IS_UK = True
>>
>> Regards
>> PD
>>
>>
> I would use a helper variable to you can reuse in some places, for example
> in the task title:
>
>
>   vars:
>     IS_UK: false
>     server: "{{ IS_UK | ternary('UK-server', 'US-server') }}"
>
>   tasks:
>     - name: "Subscribe to {{ server }} repo"
>       ansible.builtin.shell:
>         echo subscription-managed register {{ server }}
>
>
>
> --
> 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/CAF8BbLbpJmFkf_2wvny6EBWRRhb%3DdF0PLfYW_MqRsicCkDroPA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAF8BbLbpJmFkf_2wvny6EBWRRhb%3DdF0PLfYW_MqRsicCkDroPA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAEuB3ApzLQBmHWkem%3D716BBJ6MXwgq1g4h%3Dd59ifToKo%3Dst_Tg%40mail.gmail.com.

Reply via email to