let me try this thanks,

On Wed, 17 Apr 2024 at 19:31, Todd Lewis <[email protected]> wrote:

> I don't know what consumes this ("template_run"?), but you could try this:
>         extra_vars:
>           sat_client_id: "{{ sat_client_id }}"
>           sat_client_secret: "{{ sat_client_secret }}"
>           websec_prod_id: "{{ websec_prod_id }}"
>           websec_prod_secret: "{{ websec_prod_secret }}"
>           radius_secret: "{{ radius_secret }}"
>           ansible_distribution: '{{ "RedHat" if "oracle" in job_temp_name
> else omit }}'
>           patch_enablerepo: '{{ "value" if "oracle" in job_temp_name else
> omit }}'
>           standard_enablerepo: '{{ "value" if "oracle" in job_temp_name
> else omit }}'
>
> but I don't really expect that to work.
>
> You'd have to be pretty desperate to use this, but I would handle it using
> my "logical" filter:
>
>     - name: Run PPS Patch
>       template_run:
>         awx_url: "{{ awx_url }}"
>         username: "{{ username }}"
>         password: "{{ password }}"
>         scm_branch_for_agent: "{{ scm_branch_for_PPS }}"
>         project_name: "{{ project_name }}"
>         template_name: "{{ job_temp_name }}"
>         customEE_name: "{{ customEE_name }}"
>         inventory_name: "{{ inventory_name }}"
>         ip_add: "{{ vm_ipv4_address }}"
>         skip_tags: "{{ skip_tags }}"
>         *# requires "ansible-galaxy collection install utoddl.logical"
>         extra_vars: "{{ extra_vars_ | utoddl.logical.logical }}"*
>         playbook: "{{ patch_playbook }}"
>       when: not is_pps_template or ('FAILED' in status_check.tie_patch)
>       vars:
>         extra_vars_:
>           sat_client_id: "{{ sat_client_id }}"
>           sat_client_secret: "{{ sat_client_secret }}"
>           websec_prod_id: "{{ websec_prod_id }}"
>           websec_prod_secret: "{{ websec_prod_secret }}"
>           radius_secret: "{{ radius_secret }}"
>           *<<tmp:
>             - if:
>               - "{{ 'oracle' in job_temp_name }}"
>               - ansible_distribution: "RedHat"
>               - patch_enablerepo: "value"
>               - standard_enablerepo: "value"*
>       register: ppsstatus_check
>       until: "'patch.yml completed successfully' in ppsstatus_check.output"
>       retries: 3
>       delay: 10
>       tags:
>        - pps_update
>        - pps-patch
>
>
>
>
> On 4/17/24 3:22 AM, Thirumalai Raja A wrote:
>
> hi all,
>
> below is my playbook ia m trying to add some variable in extra_vars:
> argument and based on the condition but its giving error can some guide me
> how can we mention this like if string 'oracle' is there in template_name
> variable i need to add some extra var otherwise it should not add.
>
>     - name: Run PPS Patch
>       template_run:
>         awx_url: "{{ awx_url }}"
>         username: "{{ username }}"
>         password: "{{ password }}"
>         scm_branch_for_agent: "{{ scm_branch_for_PPS }}"
>         project_name: "{{ project_name }}"
>         template_name: "{{ job_temp_name }}"
>         customEE_name: "{{ customEE_name }}"
>         inventory_name: "{{ inventory_name }}"
>         ip_add: "{{ vm_ipv4_address }}"
>         skip_tags: "{{ skip_tags }}"
>         extra_vars:
>           sat_client_id: "{{ sat_client_id }}"
>           sat_client_secret: "{{ sat_client_secret }}"
>           websec_prod_id: "{{ websec_prod_id }}"
>           websec_prod_secret: "{{ websec_prod_secret }}"
>           radius_secret: "{{ radius_secret }}"
>           {% if oracle in job_temp_name %}
>           ansible_distribution: "RedHat"
>           patch_enablerepo: "value"
>           standard_enablerepo: "value"
>           {% endif %}
>         playbook: "{{ patch_playbook }}"
>       when: not is_pps_template or ('FAILED' in status_check.tie_patch)
>       register: ppsstatus_check
>       until: "'patch.yml completed successfully' in
> ppsstatus_check.output"
>       retries: 3
>       delay: 10
>       tags:
>        - pps_update
>        - pps-patch
> --
> 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/CALyK%3Dg-%3DUYkSKUZJ8CXSaBbAne0KoyVErx0LcEzZK2VCZ7Z7hg%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CALyK%3Dg-%3DUYkSKUZJ8CXSaBbAne0KoyVErx0LcEzZK2VCZ7Z7hg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
> Todd
>
> --
> 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/3f3a4b1b-fe02-4cbf-b7e0-feb95d6c2f57%40gmail.com
> <https://groups.google.com/d/msgid/ansible-project/3f3a4b1b-fe02-4cbf-b7e0-feb95d6c2f57%40gmail.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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALyK%3Dg_Y6sgvTZqn1QF_XbL6vUVqb9DZh7Rjk96t2BDhstgQdw%40mail.gmail.com.

Reply via email to