On Thu, 7 Mar 2024 at 16:02, Prady A <[email protected]> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAF8BbLbpJmFkf_2wvny6EBWRRhb%3DdF0PLfYW_MqRsicCkDroPA%40mail.gmail.com.