-
Notifications
You must be signed in to change notification settings - Fork 656
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
Molecule setup for existing Playbook with multiple roles. #1133
Comments
To provide some context, in this playbook I'd like to test against a vagrant based, 3 vm cluster with scenarios for both CentOS and Ubuntu. With the common and cassandra roles applied on all nodes and the web role applied on a single node. |
@damianoneill - may try something like this |
@r0ckyte thanks I'll look through this later today. @retr0h I read this when I went through the docs. This statement 'The role initialized with Molecule (baz in this case) would simply reference the dependant roles via it’s playbook.yml or meta dependencies.' implies that an existing role can be initialized. I tried a number of combinations of the tooling but it seemed that you had to create a new role, you couldn't init an existing role. Maybe I was doing something stupid. mkdir -p monolith-repo/{roles/{bar,baz,foo},library,plugins/filters}
cd monolith-repo/roles
$ molecule init role -r baz
--> Initializing new role baz...
ERROR: The directory baz exists. Cannot create new role. |
Similar question found when googling "molecule monolith-repo' useful text - #1010 (comment) |
Your mkdir is messing you up. If you want to create role foo, don't mkdir the directory first ;) |
@retr0h understood, point I'm making is you cant run the init command on an existing role, I was just using your example to demonstrate. I've seen a few examples online for molecule v1 where this functionality seems to exist. Is this no longer supported in v2? Thanks, |
Sure you can, you jsut need to run the proper command ;) Check the docs, Initialize an existing role with Molecule. |
@retr0h appreciate your patience. Again I had tried that previously and got an error. $ ls
bar baz foo
$ molecule init scenario --scenario-name default --role-name baz
ERROR: The role 'baz' not found. Please choose the proper role name. Is the init scenario looking for anything other than a directory name? Thanks, |
You need to be in the proper directory. Molecule verifies you are in the directory you are "initializing". |
Thankyou @retr0h, honestly that was the only combo I didnt try. |
My apologies it was confusing. I have updated the README with the screencast, and updated the docs to ensure the developer knows to cd into the role first. |
Not at all, the support from yourself and @r0ckyte has been great, thanks. |
Issue Type
Molecule and Ansible details
Molecule installation method: One of source, pip
pip
Ansible installation method: One of source, pip, OS package
pip
Desired Behaviour
Request for information - Initial setup.
Given a directory structure similar to below. For a playbook with existing roles. How should molecule be initialised. I've looked through the docs / online tutorials and a few videos but dont see any guidance on the approach that should be used.
Apologies if this is covered somewhere else.
The text was updated successfully, but these errors were encountered: