Hi
Is there a document describing the best practices to organise a complex Ansible project ?
Here is the project that I'm thinking about :
- Project has been designed as a collection of reusable modules (= role) which are living under by example this folder "complexproject/roles" fo the modules part of the main project
- Project could include roles created and managed by external teams and git cloned locally under "complexproject/imported/projectA/roles, complexproject/imported/projectB/roles"
- Users access the main playbooks using this command "ansible-playbook -i inventory complexproject/playbooks/main.yml
- main.yml file contains roles tagged to be called
E.g.
---
- hosts: "{{ openshift_node }}"
gather_facts: "{{ gathering_host_info | bool == true }}"
roles:
- { role: 'enable_cluster_admin', tags: 'enable_cluster_admin', when: target_platform == 'cloud' }
- { role: 'create_projects', tags: 'create_projects'}
- { role: 'persistence', tags: 'persistence', when: target_platform == 'cloud' }
Questions
- Is this approach coherent/consistent ?
- Can we set up a var to tell to Ansible where all the roles are located: complexproject/roles:complexproject/imported/projectA/roles:complexproject/imported/projectB/roles
- Should we adopt a different approach where different projects which contain roles are imported using "import_playbook" --> see `openshift-ansible` project -
https://goo.gl/KXDWXN ?
Regards
Charles