Hi

Let's say I have an *editor* role which contains a list (in form of a 
variable, let's call it plugins) of programming-language-agnostic plugins 
plus an editor_type variable, and additional roles for each language like 
*python*, *C++*, etc.

What is the most elegant way of organizing these roles and their tasks such 
that:


   1. some of the tasks of python are only run only when the global 
   entrypoint playbook site.yml also includes the *editor* role
   2. the role *python* is able to append its editor plugins to editor's 
   plugins variable prior to the execution of *editor*'s tasks
   3. the order in which roles are added or removed to/from the global 
   site.yml does not matter, the execution of any combination of roles should 
   lead to the execution of all the tasks that fit, e.g. initially I have 
   editor_type=vim (editor_type is a variable in the editor role) with the 
   plugins python and c++, but then I switch to editor_type=emacs, in which 
   case the roles *python* and *C++ *would not normally be executed, but 
   they have to, because they have to inject their functionality into 
   *editor*, which has changed its editor_type
   

?

I'm using ansible 2 and I'm a beginner in ansible, so a concrete example 
would be highly appreciated.

For 1. I could use register: editor_exists in the editor role, and in the 
language plugins I could check when: exitor_exists exists, but how about 
problems 2. and 3.?

I do know python, so I could extend ansible with it, but I still need an 
outline of best practices to follow, as I've never used ansible before 
(just puppet).

Please use concrete yaml keywords and/or concrete class/method names where 
necessary, so I know exactly what to research further.

Regards,
Flavius Aspra

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5c8b3ba9-440c-4a8e-9b4a-cadec891fbe3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to