molecule init role is gone
iay opened this issue Β· 11 comments
Chapter 13, page 351, "Testing a role with Molecule":
molecule init role my.test... no longer works. The molecule role init command was removed in Molecule 6.0 (I think):
Removed 'init role' command due to already being covered by ansible-galaxy
Seems as if the way to do this now is with ansible-glaxy role init foo followed by molecule init scenario inside that directory. I'm not sure about the use of my.test as a name for the role as in the book; I think for the directory to be test that needs to be the role name too.
Definitely need to tweak some of the molecule bits β a lot changed in the past few months!
a lot changed in the past few months!
No joke. I don't know what it was like before, but 6.0.x seems to check the --driver-name option and then completely ignore it (see ansible/molecule#3773) so unless you know what you're doing (and I do not) then you can waste a lot of time before you figure out that the reason it's not generating a Docker container is that it has generated the default playbooks... and even if you then add the driver name to molecule.yml it still does nothing because the create and destroy playbooks it generated before override the ones from the driver.
You have your work cut out for you, I think, writing a description of this that will work with the usual minor differences between readers because at present Molecule seems to be super brittle. If there's anything I can do to help proof the new content, please let me know. I have (finally) got something that appears to be working, but I'm sure I am still missing a lot.
I was just setting up to start using molecule for the first time as a beginner. I canβt find any version 6 introductory examples anywhere that mention virtualbox inventory, or pretty well any introductory version 6 in narrative form. I need to test against functional operating system instances, not docker. My playbooks are for configuring my developer workstations. I had been configuring Ubuntu 22.04 and Debian 12. It seems the molecule team wrote the documentation with themselves as the target audience. Missing pages in the docs site too.
Just to add that i had decided to finally give molecule a test run, and yes it has been an exercice in frustration.
Nothing works, no doc whatsoever. Happy to find this post to at least know i'm not alone and that i should just give up.
Redhat has really gone bad.
I just recently bought the book and was a bit frustrated after seeing that the molecule chapter is not really working these days. Not to blame @geerlingguy here, more the poor documentation of the molecule team at the moment. The documented getting started is not usable at all. As an example, if I follow this step by step and come to the point to change the converge.yml, the collection is not installed and so converge does not find the role. If I install the collection from local path, at least the role example works. But no luck with the playbook include.
I was happy to hear about molecule and the possibilities it brings to test against different environment, but the state of development and documentation seems to be a throwback.
I would like to get to it, can't guarantee when unfortunately: #574 (comment)
Molecule has changed a lot in the past couple years, but seems to have settled down a little, so I think it would be a good time to retry writing up that chapter.
Molecule is my secret weapon on the daily.
My showstopper is executing roles on my docker instances. While direct tasks work, including roles does not. My open issue on molecule: ansible/molecule#4256 (comment)
Maybe this could help somehow.
PR with this change: geerlingguy/ansible-for-devops-manuscript#10
