I agree that it's annoying, especially if you try to organize by includes
and reusable playbooks, it's hard to tell, looking at a list of *.yml files
which ones are the top-level and which are meant to be included.
If you're not using roles and only using tasks, you can put your tasks in a
tasks/ subfolder and then include them and everything will use the dir of
the playbook as the ansible root.
However, if you're using roles, the roles are assumed to be in a subdir of
the playbook, so you can either create a playbooks/ subdir and reference
your roles like:
./stuff.yml
---
- include: playbooks/wtfstuff.yml
playbooks/wtfstuff.yml
--
- name: Do wtf stuff
roles:
- role: ../roles/wtf
or put roles as a subdir of your playbook subdir and then require that any
top-level playbooks must only include playbooks from the playbooks/ subdir:
project
├── inventory
├── site.yml
└── playbooks
├── ansible.cfg
├── webservers.yml
├── databases.yml
└── roles
├── nginx
├── php
└── mysql
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/4b54bd1b-e1d9-4b54-a470-3880e0350758%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.