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

Regression: default playbooks missing for LXD driver #1587

Closed
HalisCz opened this issue Nov 12, 2018 · 11 comments
Closed

Regression: default playbooks missing for LXD driver #1587

HalisCz opened this issue Nov 12, 2018 · 11 comments

Comments

@HalisCz
Copy link

HalisCz commented Nov 12, 2018

Issue Type

  • Bug report

Molecule and Ansible details

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):

  • pip

Ansible installation method (one of):

  • pip

Detail any linters or test runners used:

Desired Behavior

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.

Actual Behaviour

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
@webknjaz
Copy link
Member

You call it a regression. What was the last version this worked as expected?

@HalisCz
Copy link
Author

HalisCz commented Nov 12, 2018

This is working in molecule==2.17 from pip.

@webknjaz
Copy link
Member

It looks like those files were removed via PR #1436.

@wilmardo
Copy link
Contributor

wilmardo commented Nov 14, 2018

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

@wilmardo
Copy link
Contributor

@webknjaz I try to keep updated with the Molecule issues but if needed tag me, especially LXD issues :)

@webknjaz
Copy link
Member

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.

@webknjaz
Copy link
Member

Is this documented?

@wilmardo
Copy link
Contributor

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 :)

@webknjaz
Copy link
Member

fair enough

@webknjaz
Copy link
Member

@HalisCz does the info provided by @wilmardo suit you? May we close the issue now?

@HalisCz
Copy link
Author

HalisCz commented Dec 27, 2018

@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 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants