You can include roles from arbitrary paths by including the full path in
the role as follows:

roles:
  - { role: /path/to/my/role }
  - { role: /different/path/to/another/role }

etc.

When using the ansible-galaxy, it by default will save roles in the path
defined in your ansible.cfg by the variable "roles_path" (which defaults to
/etc/ansible/roles), however that is not used when the plabook looks up the
role.


On Fri, May 23, 2014 at 3:05 PM, Jason Harris <[email protected]>wrote:

> Hi All,
>
> Maybe there is already a setting for this and I am just missing it...
>
> With the ansible-playbook command line how do I specify the directory to
> use for the roles?
>
> Right now I have things set up sort of like follows:
>
>     ourhosts.ini
>     ourvariables.yml
>     deploy_nyc.yml
>     deploy_ams.yml
>     deploy_sgp.yml
>     roles/
>         common/
>         webtier/
>         monitoring/
>         fooapp/
>
> Inside each of our deploy_nyc.yml files we target different hosts with
> different roles etc. In order not to have to remember many of the details
> of each of the scripts we might turn around and have lots of these scripts.
> Eg
>
> deploy_blogsite_nyc.yml
> deploy_fullmonitoring_sgp.yml,
> etc.
>
> In that way we just tweak these scripts with the hosts and tags and roles
> etc we want... But to do this I would like to be able to have the structure:
>
>     ourhosts.ini
>     ourvariables.yml
>     deploy/
>         deploy_nyc.wml
>         deploy_ams.yml
>         deploy_sgp.yml
>     roles/
>         common/
>         webtier/
>         monitoring/
>         fooapp/
>
> And then I would like to be able to open up a command line and go
> something like:
>
> cd deploy
> ansible-playbook --inventory-file="../outhosts.ini"
> --extra-vars="../ourvariables.yml" --roles-directory="../roles"
> deploy_nyc.yml
>
> but --roles-directory doesn't exist. Does some other thing exist to do
> this? If not is this a reasonable thing to add?
>
> Thanks!
>    Jason
>
> --
> 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/9f277eae-31f4-4c39-ac6f-120940e5aecb%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/9f277eae-31f4-4c39-ac6f-120940e5aecb%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/CAMFyvFiVcx9BoAxZ-iBCXcyr1d39Zpwu1m%3DrGN1ZjEfuFdi97A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to