ansible 2.7.1
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/user/.virtualenvs/nix-ansible/lib/python3.7/site-packages/ansible
executable location = /home/user/.virtualenvs/nix-ansible/bin/ansible
python version = 3.7.1 (default, Nov 5 2018, 14:07:04) [GCC 8.2.1 20181011 (Red Hat 8.2.1-4)]
molecule, version 2.19.0
Molecule installation method (one of):
Ansible installation method (one of):
Detail any linters or test runners used:
After running molecule init role --role-name basic_server --driver-name lxd, there should be default playbooks as this:
basic_server
โโโ defaults
โย ย โโโ main.yml
โโโ handlers
โย ย โโโ main.yml
โโโ meta
โย ย โโโ main.yml
โโโ molecule
โย ย โโโ default
โย ย โโโ tests
โย ย โย ย โโโ __pycache__
โย ย โย ย โย ย โโโ test_default.cpython-37.pyc
โย ย โย ย โโโ test_default.py
โย ย โโโ create.yml
โย ย โโโ destroy.yml
โย ย โโโ INSTALL.rst
โย ย โโโ molecule.yml
โย ย โโโ playbook.yml
โย ย โโโ prepare.yml
โโโ tasks
โย ย โโโ main.yml
โโโ vars
โย ย โโโ main.yml
โโโ README.md
9 directories, 14 files
This is working in molecule==2.17 from pip.
Playbooks create.yml, destroy.yml and prepare.yml are missing.
basic_server
โโโ defaults
โย ย โโโ main.yml
โโโ handlers
โย ย โโโ main.yml
โโโ meta
โย ย โโโ main.yml
โโโ molecule
โย ย โโโ default
โย ย โโโ tests
โย ย โย ย โโโ __pycache__
โย ย โย ย โย ย โโโ test_default.cpython-37.pyc
โย ย โย ย โโโ test_default.py
โย ย โโโ INSTALL.rst
โย ย โโโ molecule.yml
โย ย โโโ playbook.yml
โโโ tasks
โย ย โโโ main.yml
โโโ vars
โย ย โโโ main.yml
โโโ README.md
9 directories, 11 files
You call it a regression. What was the last version this worked as expected?
This is working in molecule==2.17 from pip.
It looks like those files were removed via PR #1436.
After running molecule init role --role-name basic_server --driver-name lxd, there should be default playbooks as this
Nope ;)
Default playbooks are moved to molecule/provisioner/ansible/playbooks/<drivername>/ since Molecule V2. These playbooks are used unless you create a create.yml playbook in the scenario directory, this overrides the default create.yml in that directory.
For LXD I implemented this in the PR #1436 and it is available since Molecule v2.18.
This is the same behavior as Docker and Vagrant (and all the other when they get updated to the new standard).
This behavior has the advantage that patches to the playbook can be made upstream and you should not have to backport a ton of playbooks in your roles ๐
But if you want to maintain these playbooks, just copy them to the scenario directory and the behavior is the same as Molecule <2.17
@webknjaz I try to keep updated with the Molecule issues but if needed tag me, especially LXD issues :)
Nope ;)
Why? If you keep those in the molecule resources, rather than a generated dir structure, the behavior may become unreproducible, because of Molecule upgrade and users would not expect such change of behavior.
Is this documented?
Is this documented?
Yeah somewhat. It was implemented in #1278 and the documentation is found under provisioner/ansible in the docs:
The playbook loading order is:
provisioner.playbooks.$driver_name.$action
provisioner.playbooks.$action
bundled_playbook.$driver_name.$action
Why?
More then the above explanation by @retr0h in the PR I don't know.
I personally do not see that much of a problem as long as semver is correctly used. As I stated before for most users this resolves the whole problem of keeping all the playbooks in one place and DRY the roles. This without resulting in the use of submodules or gilt.
Not keeping the playbooks up to date could also result in errors since the cerberus validation of Mocule changes or even the module upstream in Ansible.
I am interested in the view of the others though @dj-wasabi @lwm @gundalow :)
fair enough
@HalisCz does the info provided by @wilmardo suit you? May we close the issue now?
@webknjaz I finally understand the motive behind these changes. Therefore, I consider this closed, although from the documentation piece
The playbook loading order is:
provisioner.playbooks.$driver_name.$action
provisioner.playbooks.$action
bundled_playbook.$driver_name.$action
I am not sure where to look for the default file. (I know just because I found out from PR #1278 )
Most helpful comment
@webknjaz I finally understand the motive behind these changes. Therefore, I consider this closed, although from the documentation piece
I am not sure where to look for the default file. (I know just because I found out from PR #1278 )