Maybe I'm misunderstanding the dependency model if the current way is
working in the most logical way. I consider
roles as jobs and tasks as things the job needs to do.
If I have two jobs: being a parent and a restaurant cook, one of the tasks
of both of these jobs is doing the dishes. If I
stop being a restaurant cook this doesn't mean I get to stop doing dishes
as a parent.
Would love to understand this model more and why skipping a role would mean
that any others roles who have explicitly
defined dependencies would be ignored.
A more real world example of my problem is we are experimenting with both
gunicorn and uwsgi and so depending on some
facts gathered we want to install one or the other:
- surveymonkey.com
- {role: gunicorn, when use_gunicorn=true }
- {role: uwsgi, when not use_gunicorn=true }
- gunicorn
- { role: python }
- uwsgi
- { role: python }
So in this use case, when we decided a specific server should be uwsgi
ansible has decided that uwsgi doesn't depend on python because gunicorn
depended on it and we don't want to be a gunicorn server.
On Monday, July 28, 2014 7:06:17 AM UTC-7, Michael DeHaan wrote:
>
> The "when" conditional is properly being applied to both tasks in this
> scenario, by design.
>
> This seems like the most logical behavior, because the parent role has
> decided to not be included, so the dependencies should have the same
> conditions.
>
>
>
>
> On Mon, Jul 28, 2014 at 1:03 AM, John Anderson <[email protected]
> <javascript:>> wrote:
>
>> So if I have a role with this as their meta:
>>
>>
>> dependencies:
>> - { role: pythonapp, when: is_legacy is not defined }
>> - { role: rubyapp, when: is_legacy is defined }
>>
>>
>> If pythonapp and rubyapp share a common dependency like the role "dbaccess"
>> then when pythonapp gets skipped, it currently sets the dbaccess role to be
>> skipped even though rubyapp depends on it. The only way I have been able
>> to fix this is by setting `allow_duplicates: yes` on all roles that may be
>> inherited by both but this makes the runtime of my playbooks pretty slow
>> because its re-running a bunch of tasks.
>>
>>
>> Is there a way I could get this inheritance model to work where the dbaccess
>> role doesn't get skipped if the role running it does depend on it?
>>
>>
>>
>> --
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/7ed0e1a6-9bc8-4e71-8fdf-316c0d714b80%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/ansible-project/7ed0e1a6-9bc8-4e71-8fdf-316c0d714b80%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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/84a3fc0a-671c-4ed8-bad0-5591a8d05b9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.