ansibleansible-galaxy

Is there a way to use galaxy roles without downloading them?


I'm running ansible within terraform.

I downloaded a galaxy role using:

ansible-galaxy install <role>

This downloaded it to my ~/.ansible/roles directory.

But when I referenced the role name in my ansible playbook that I use with terraform, it couldn't find it.

So instead I specified a directory like so:

ansible-galaxy install --roles-path . <role>

While this now works, it's mixed in with all my other scripts that are under source control.

I'm wondering if there's a way to use a galaxy role without actually downloading it? Or if there's a way to specify in my ansible playbook where to look for additional roles besides my roles?


Solution

  • Since Ansible only knows how to retrieve roles from the local filesystem, you must download roles before you can use them.

    You can tell Ansible where to look for roles by setting the ANSIBLE_ROLES_PATH environment variable, or by setting roles_path in your ansible.cfg. See the documentation for details.