On Tuesday, May 27, 2014 2:00:20 PM UTC-7, Brice Burgess wrote:

> In my example I have a backup role. It would like to know the path where 
> the apache-role stores websites by default so that it can back them up. 
> Lets say the apache role stores this variable as `apache_sites_dir` in its 
> default/main.yml  (and of course it can be specified as well in inentory 
> vars).
>
>
I'm curious why you would do this (not because there is anything inherently 
wrong with it, but I'm wondering what your thinking is here).

My thoughts would be that you set up hostX as a backup client with a backup 
role and backup everything...(maybe excluding certain temporary 
directories)...  Why do you want something explicitly different for web 
servers/web sites?
 

> So I currently have the backup role depending on the apache role to glean 
> this variable (I thought conventional). I didn't like this approach because 
> it runs apache tasks -- so I added the skip_task garbage.
>
> Is explicitly loading apache's agreeable in this situation? e.g.
>
> :: backup/tasks/main.yml ::
>
> - name: detect apache sites location
>   include_vars: "'path/apache/defaults/main.yml"
>   when: apache_sites_dir is not defined
>
>>
>>
 Rather than do this, IF I wanted something different (or explicit) about 
backing up web server files I would have a general purpose backup role 
(install some backup software, maybe provide some generic configuration) 
and have a role for installing the webserver software (or configuring a 
website or...) that sets up the software and then either modifies the 
backup software or (preferably) drops a configuration file in some included 
directory.  If that isn't possible (it all has to be in one file) then I 
would consider using the assemble module to create the configuration file 
from all of the pieces.  (Otherwise on your next run the backup role would 
change the configuration file back and the webserver role would change it 
again.

You could still add a dependency but it would be the other way around.  The 
web server role would "depend" on the backup role....  (instead of 
confusing terminology like dependency call it "insist that it ran after"... 
:-)

Adam

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/693221f6-d70d-4eb9-8371-b701b9df5cae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to