How to keep local roles separated from downloadable due to the galaxy?

I noticed that the roles downloaded from the galaxy are installed inside the directory roles/, where we already have our own, which complicates their distribution between external and internal.

Is there a way to keep them in separate directories, so we can avoid confusion?

In most cases, I would expect a script that updates the galactic units and that we will not change them internally.

+4
source share
2 answers

I think there is no standard way to do this, but you can take advantage of Ansibles behavior.

Simple searches in two places for roles:

  • roles playbook
  • , ansible.cfg

, , , . , git.

ansible.cfg :

roles_path=./galaxy_roles

ansible-galaxy roles_path, , . roles. Ansible ./roles .

:

ansible-galaxy install --roles-path=./galaxy_roles foo
+4

@udonhan , / , , .

ansible.cfg, ansible.cfg :

[defaults]
roles_path    = ./roles:./roles_internal

"./roles" , , "./roles_internal" / .

,

ansible-galaxy install -r requeriments.yml

Galaxy "./roles"

. , envi ANSIBLE_ROLES_PATH ​​ ansible.cfg. :

unset ANSIBLE_ROLES_PATH
0

Source: https://habr.com/ru/post/1625131/


All Articles