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

- include: custom.yml in site.yml #341

Open
niccolox opened this issue Feb 21, 2017 · 1 comment
Open

- include: custom.yml in site.yml #341

niccolox opened this issue Feb 21, 2017 · 1 comment

Comments

@niccolox
Copy link

hi

would it make sense to add a custom.yml in site.yml that hooks into the custom playbook folder? and may or may not run a custom site.yml at the end of the debops site.yml?

obviously the path to include would need to change

but, this would be a convenience

@drybjed
Copy link
Member

drybjed commented Feb 21, 2017

It's complicated. The ansible-playbook command parses all included files during a playbook execution, if a specified file does not exist (which presumably would be the default case here), Ansible stops execution.

On the other hand the design principles of DebOps dictate that the official playbooks are meant to be "read-only" to faciliate upgrades, so adding an include to a custom playbook, where this included file could be anywhere on each user's host is out of the question. There are workarounds like this in various DebOps roles to support custom files, templates or even tasks, but they rely on a custom set of lookup plugins which pretty much are required to be installed manually if you don't use the official set of playbooks.

At the moment the best workaround I can offer is this: when you run the debops command, the first argument is checked by the script to see if it's potentially a playbook. The rest are passed along to the ansible-playbook command, which supports chaining multiple playbooks together. Therefore, if you have your custom playbook in the playbooks/ directory of the DebOps project directory, you can run something like this to chain your custom playbook with the site.yml playbook:

debops site playbooks/custom.yml -l <host>

If you want to run only the custom playbook, you can even do this:

debops custom -l <host>

In the long term, the are plans to upgrade the debops scripts to allow for custom playbooks to be included automatically, among other things. Right now the existing debops script is "good enough" for my needs, I'm more focused on the Ansible roles themselves. So if you want to get a crack at it, feel free to fork the repository. :-)

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

2 participants