Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: move ansible playbooks to playbooks/ directory to allow direct references to them #557

Open
ednxzu opened this issue Aug 5, 2024 · 4 comments

Comments

@ednxzu
Copy link

ednxzu commented Aug 5, 2024

Could it be considered to move the playbooks to a dedicated playbooks/ directory, in order for them to be usable from outside the repository ?

Expected Behavior

As this repo is essentially an ansible collection, I would expect to be able to add it to a larger project, and run its playbooks from this large project.

Something like:

ansible-playbook -i inventory techno_tim.k3s_ansible.site

Current Behavior

Currently, the only way to do so, is to copy the playbooks to the large project's playbook dir, and then run it (or call the absolute path to the playbook (/home/user/.ansible/collections/...)

Possible Solution

The easy fix is to move the paybooks to a dedicated playbooks/ directory as per documentation

Example in a similar collection : here

@timothystewart6
Copy link
Contributor

I am fine with this change as long as it doesn't break or change existing functionality!

@ednxzu
Copy link
Author

ednxzu commented Aug 5, 2024

This should technically be transparent. People that are already running this collection most likely have the playbooks copied over to their own playbook dir. If they don't changing the run command from ansible-playbook -i inventory /path/to/playbook.yml to ansible-playbook -i inventory techno_tim.k3s_ansible.<playbook> should just work.

I don't think the current playbooks are loading specific vars due to their relative paths (everything is loaded relative to the inventory file in the current setup if I'm not mistaking), so really nothing other than the playbooks would have to be moved.

I can draft a PR for this this week I think.

@twistedgrim
Copy link

@ednxzu I was thinking the same thing as you here. I think the current example of how people are running the playbook needs to be updated and some examples shown of how to consume the playbook from a higher level playbook of your own is in order before this could really become a thing. Id love to see a PR for what you are describing. I think it would help everyone to visualize it if we had a pull request to look at, then we could add the documentation around this.

@timothystewart6
Copy link
Contributor

Related to #560

ednxzu added a commit to ednxzu/k3s-ansible that referenced this issue Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants