Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

ansible - 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?

question from:https://stackoverflow.com/questions/65649611/is-there-a-way-to-use-galaxy-roles-without-downloading-them

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...