You might re-examine whether it is appropriate for a role and a playbook as it 
feels like your playbooks are too heavy.

Roles ideally should be reusable logic for a given context you can apply to 
multiple situations.  For example, you might have multiple kafka/mysql/etc 
clusters for different uses that a single role given the necessary info via 
playbook and inventory can manage.  If you need to build higher order reusable 
roles, you can have roles with dependent roles that compose them to your ends; 
leaving your playbooks thinner.  Playbooks ultimately should be highest order 
orchestration that isn’t bogged down into all of the technical details.

Say what you will about Puppet but I would consider the reasoning behind their 
roles and profiles and how it applies to Ansible: 
https://puppet.com/docs/pe/2018.1/the_roles_and_profiles_method.html


Sent from my iPhone

> On Aug 1, 2019, at 1:49 AM, Михаил Политаев <[email protected]> wrote:
> 
> Awesome! Looks like a plan! Thanks!
> 
> чт, 1 авг. 2019 г. в 07:44, Sebastian Meyer <[email protected]>:
>> On 01.08.19 07:31, Михаил Политаев wrote:
>> > I have a several projects which describing installation 2 different 
>> > applications. Each directory for application:
>> > 
>> > app1/roles/common/main.yml
>> > app2/roles/common/main.yml
>> > 
>> > But application have similar between them tasks which described in 
>> > "main.yml" of role "common"
>> > 
>> > What is the best way have only one source to those similar tasks without 
>> > having 2 or more versions and duplicate them across projects.
>> You could make use of the roles_path configuration setting [0] and have
>> a directory structure like this:
>> 
>> ansible/
>>   common/roles/
>>   app1/roles/
>>   app2/roles/
>> 
>> and in the app folders each an ansible.cfg with:
>> 
>> roles_path: ./roles:../common/roles
>> 
>> [0]
>> https://docs.ansible.com/ansible/latest/reference_appendices/config.html#default-roles-path
>> 
>> -- 
>> Sebastian Meyer
>> Linux Consultant & Trainer
>> Mail: [email protected]
>> 
>> B1 Systems GmbH
>> Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
>> GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
>> 
>> 
>> -- Deutsche OpenStack Tage 2019 -- 10% Rabatt auf den Ticketpreis ----
>> ------------------------ https://openstack-tage.de (Code DOST-B1) ----
>> 
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Ansible Project" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/ansible-project/AzH2GwEA9Ls/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/8f7c5bb5-aaa6-4de2-7031-c0cdd4a538db%40b1-systems.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 [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/CAKP%3D2uxpjLjmXm9qympt%3DsbDXMg1%3DP1DHxmh%2B0GNv3XGKRYxDg%40mail.gmail.com.

-- 
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/5DF1BE05-95B3-4A93-85D8-299B45C57436%40gmail.com.

Reply via email to