Hi Pawan, Gajendra,

You can use Anchors in YAML, like

https://github.com/ansible-collections/vmware/blob/main/tests/integration/targets/vmware_about_facts/tasks/main.yml#L37
https://support.atlassian.com/bitbucket-cloud/docs/yaml-anchors/
https://github.com/Akasurde/ansible-reproducers/blob/master/useful_pbs/debug_anchor.yml

On Tue, Jul 21, 2020 at 8:27 PM Pawan Kumar <[email protected]> wrote:

> Thanks Gajendra ,will test on the mentioned suggestions &  revert back.
>
>
> On Tue, Jul 21, 2020 at 12:51 AM Gajendra Gaikwad <
> [email protected]> wrote:
>
>> Yes check if this logic works
>> 1. Create a one group in inventory  with all child group masters,
>> organization and doxy
>> So that you can run the restart role
>>
>> 2. Set the variables on group level masters, organization and doxy
>> So that your role will automatically  read this variables while executing
>>
>> So it will be only two plays
>> Remember running role sequence  is in your hand
>>
>> Regards
>> Gg
>>
>>
>>
>> On Mon, 20 Jul 2020, 21:42 Pawan Kumar, <[email protected]> wrote:
>>
>>> Hi Team
>>>
>>> Any thoughts on reducing this repetition !!
>>>
>>> Thanks
>>>
>>> On Mon, 20 Jul 2020, 00:28 Pawan Kumar, <[email protected]> wrote:
>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Hi ,Team
>>>>
>>>> Require your help to reduce repeated steps , in the following playbook
>>>> ,3 roles are common ,but 2 roles(  permission.yml &
>>>> reload_base_service.yml)  variable value is different
>>>>
>>>>  - hosts: masters
>>>>   gather_facts: yes
>>>>   vars:
>>>>     - owner: "roks"
>>>>     - mode: "0644"
>>>>     - base_service: "mot-idm"
>>>>   tasks:
>>>>     - include_role:
>>>>         name: motors
>>>>         tasks_from: "{{ item }}"
>>>>       with_items:
>>>>         - permission.yml
>>>>         - reload_base_service.yml
>>>>         - restart_component.yaml
>>>>
>>>> - hosts: organization
>>>>   gather_facts: yes
>>>>   vars:
>>>>     - owner: "taxi"
>>>>     - mode: "0755"
>>>>     - base_service: "mzee-org"
>>>>   tasks:
>>>>     - include_role:
>>>>         name: motors
>>>>         tasks_from: "{{ item }}"
>>>>       with_items:
>>>>         - permission.yml
>>>>         - reload_base_service.yml
>>>>         - restart_component.yaml
>>>>
>>>> - hosts: doxy
>>>>   gather_facts: yes
>>>>   vars:
>>>>     - owner: "matter"
>>>>     - mode: "0644"
>>>>     - base_service: "rater-x"
>>>>   tasks:
>>>>     - include_role:
>>>>         name: motors
>>>>         tasks_from: "{{ item }}"
>>>>       with_items:
>>>>         - permission.yml
>>>>         - reload_base_service.yml
>>>>         - restart_component.yaml
>>>>
>>>>
>>>> Thanks
>>>>
>>>> --
>>>> 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/12f8588f-4bdd-487c-9761-024b39d9591eo%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/ansible-project/12f8588f-4bdd-487c-9761-024b39d9591eo%40googlegroups.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/CAEM0ThHLNFPYhKxvAhOM4stk0GfFJ6%3DSBs2r0yx4%2BhzbZY-URQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/ansible-project/CAEM0ThHLNFPYhKxvAhOM4stk0GfFJ6%3DSBs2r0yx4%2BhzbZY-URQ%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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAG_8SgMO%2B6kRchBOqXwRAXs6ZoVAB4V2oMoPQaYWzhoNQ1WYRQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAG_8SgMO%2B6kRchBOqXwRAXs6ZoVAB4V2oMoPQaYWzhoNQ1WYRQ%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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAEM0ThHL9ojBAaWc9j9iZ5666b_cgF3echNtSpifrFrpn1w6xA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAEM0ThHL9ojBAaWc9j9iZ5666b_cgF3echNtSpifrFrpn1w6xA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Thanks,
Abhijeet Kasurde

-- 
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/CAFwWkHpQ7Qa05LiAeULqfDFCzpdUq6Z%2BKruj03NGtKP-WzUv8Q%40mail.gmail.com.

Reply via email to