Open 0x4d4c opened 1 year ago
Same here.
I am using 6.0.1
. Seems like --driver-name
is not processed. I tried with docker,podman,vagrant,ec2
they all create the exact same files.
@SamDecrock and @andycui66
There are two ways to use molecule
.
molecule-plugins
feel free to leave your comments in #4019
I haven’t used molecule in a long time but I ran into this behavior today. It definitely used to work with molecule 3.0 and lower.
I stumbled upon the fact that the code for this is likely found in the molecule-plugins project rather than here. There, I was able to find the Dockerfile.j2 template which has all that you need to spin up a container and run it in rootless mode (don't forget to add the blurb from docs to the bottom of the file - that's still required).
Needless to say, I opted to pip uninstall molecule, the old molecule-docker, molecule-plugins, molecule-plugins[docker] and then reinstalled it all (minus the older molecule[docker] code as that's now replaced by molecule-plugins[docker]). That still did not work.
INFO Initializing new scenario newblah...
PLAY [Create a new molecule scenario] ******************************************
TASK [Check if destination folder exists] **************************************
changed: [localhost]
TASK [Check if destination folder is empty] ************************************
ok: [localhost]
TASK [Fail if destination folder is not empty] *********************************
skipping: [localhost]
TASK [Expand templates] ********************************************************
skipping: [localhost] => (item=molecule/newblah/destroy.yml)
changed: [localhost] => (item=molecule/newblah/molecule.yml)
changed: [localhost] => (item=molecule/newblah/converge.yml)
skipping: [localhost] => (item=molecule/newblah/create.yml)
PLAY RECAP *********************************************************************
localhost : ok=3 changed=2 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
$ ls -lah ./molecule/newblah/
total 16
drwx------ 4 128B Mar 6 07:48 .
drwx------ 5 160B Mar 6 07:48 ..
-rw-r--r-- 1 203B Mar 6 07:48 converge.yml
-rw-r--r-- 1 124B Mar 6 07:48 molecule.yml
But, copying and pasting the Dockerfile.j2 from the previous link works like a charm.
I've also just hit this issue. I have a working ansible user install through pip3 with ansible-lint. Ran pip3 install --user molecule "molecule-plugins[docker]"
to install both and unfortunately it's not creating the Dockerfile.j2 file.
Also just tested with a fresh install of Docker in case that was causing a problem, but not successful.
Spec/versions:
Ubuntu Server 22.04 64 bit
pip 24.0 from /home/ansible/.local/lib/python3.9/site-packages/pip (python 3.9)
Python 3.9.18
ansible [core 2.15.9]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.9.18 (main, Aug 25 2023, 13:20:14) [GCC 11.4.0] (/usr/bin/python3.9)
jinja version = 3.1.3
libyaml = True
Issue Type
Molecule and Ansible details
Molecule installation method (one of):
(I tried both, pip and directly from source.)
Ansible installation method:
Detail any linters or test runners used:
Desired Behavior
The documentation states that a
Dockerfile.j2
template will be "generated atmolecule init scenario
-time when--driver-name
isdocker
." This does not happen for me, when I use this command in a roles directory of a collection:molecule init scenario --driver-name docker --role-name somename
ormolecule init scenario --driver-name docker --role-name somename somescenario
. I only getconverge.yml
,molecule.yml
andverify.yml
.I think either the
Dockerfile.j2
should be generated or the documentation should be adjusted. In the latter case, instead of stating that a template will be generated, an example template would be nice (as the one in the repo).