In short , I want this configuration file as an interface between
mymasterplaybook.yml and individual roles , also mymasterplaybook.yml need
to recognize this file to fill its dynamic params .

Rahul

On Wed, 22 Apr 2020 at 13:28, Rahul Kumar <rajput4u4...@gmail.com> wrote:

> Thanks stefan !
> My question how i can take these 3 dynamic values as a configuration file
> which comes with each role.
> Example: I want to invoke mymasterplaybook.yml for 10 roles , so  i invoke
> this playbook
> as >ansible-playbook -i inventory.yml  mymasterplaybook.yml     -> This
> invocation could be completed if mymasterplaybook.yml takes those 3 params
> which are dynamic from some configuration file a below
> ---
> dynamic rolename: something
> dynamic taskfromgroupname: something
> dynamic group name: something
>
> So if this is the configuration file , it will only include role only
> named with "something" and import task from that role named with
> "something" and similarly for group name.
> Though i might have 100 roles but which will be included depends on this
> configuration file .
> so my question is : where and how this configuration file should be
> written , so that my masterplaybook.yml understand this and takes all
> dynamic params from this config file in order to execute the flow.
>
> Rahul
>
>
>
> On Wed, 22 Apr 2020 at 13:12, Stefan Hornburg (Racke) <ra...@linuxia.de>
> wrote:
>
>> On 4/22/20 9:35 AM, Rahul Kumar wrote:
>> > Hi Ansible Gurus,
>> > I have below playbook in one git repository:  mymasterplaybook.yml
>> > - name: Do some test
>> >       include_role:
>> >         name: mytestrole
>> >         tasks_from: test-server-names
>> >       when: "'testing-group-name' in group_names"`
>> >
>> > Now I  invoke above playbook with a existing role named "mytestrole"
>> and task in it as "test-server-names" and group
>> > name is testing-group-name.It works fine.
>> >
>> > Now what i want tasks_from , name of role and group name as dynamic :
>> so my mymasterplaybook.yml will look like as below
>> >   - name: Do some test
>> >       include_role:
>> >         name: {{dynamic role name}
>> >         tasks_from: {{dynamic task name from role}}
>> >       when: "{{dynamic group name}' in group_names"`
>> >
>> > so that any role can be plugged into that !
>> > So whenever some one writes roles , they write 2 things
>> > 1. Role
>> > 2. some configuration file which contains  "dynamic role name",
>> "dynamic task name from role", "dynamic group name" as
>> > configurable items so that it can be plugged in master playbook named
>> mymasterplaybook.yml as shown above.
>> > and this configuration file will work as an interface between role and
>> master playbook (named mymasterplaybook.yml) for
>> > entire execution.
>> >
>> > Rahul
>>
>> Yes, and what's your question(s) ?
>>
>> The when condition wouldn't work that way as the value is virtually
>> wrapped into a Jinja template, so try:
>>
>> when: dynamic_group_name in group_names
>>
>> Regards
>>         Racke
>>
>> >
>> > --
>> > 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 <mailto:
>> ansible-project+unsubscr...@googlegroups.com>.
>> > To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/ansible-project/CAGH8rExBLxOpYKQPQMUsbXgiBt%2Bw4pgd6atCoP9TW3z%3DEUJJXg%40mail.gmail.com
>> > <
>> https://groups.google.com/d/msgid/ansible-project/CAGH8rExBLxOpYKQPQMUsbXgiBt%2Bw4pgd6atCoP9TW3z%3DEUJJXg%40mail.gmail.com?utm_medium=email&utm_source=footer
>> >.
>>
>>
>> --
>> Ecommerce and Linux consulting + Perl and web application programming.
>> Debian and Sympa administration. Provisioning with Ansible.
>>
>> --
>> 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/958b3e2e-da34-a278-3089-fc9ad0aab637%40linuxia.de
>> .
>>
>

-- 
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/CAGH8rEww17UCXuY8uOfUa%3DhZYo%2BJ%3D2WQ1_pg3Za5ANyzwBOV4Q%40mail.gmail.com.

Reply via email to