Hello,
I have encountered an issue with using systemd in docker. I have a role
with a task like this:
- name: Start and enable apache2
systemd:
name: apache2
state: started
enabled: true
And it fails like this:
TASK [acme.molecule_reference_role : Start and enable apache2]
*****************
fatal: [ubuntu]: FAILED! => {"changed": false, "msg": "Service is in
unknown state", "status": {}}
I realize on the command like, this can be worked around with:
docker run -it --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:rw
--cgroupns=host geerlingguy/docker-ubuntu2204-ansible:latest
basically mounting /sys/fs/cgroup with rw option and adding the
parameter cgroupns with value host.
But I am unable to pass the parameter cgroupns in molecule. I tried like
this:
platforms:
- name: ubuntu
image: geerlingguy/docker-ubuntu2204-ansible
privileged: true
cgroupns: host
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
But it does not work.
I also see the open issue in the Molecule project
https://github.com/ansible-community/molecule/discussions/3349 from Dec
2021.
Is there a plan to support the flag cgroupns in Molecule? Is a new PR
expected?
-
Sudheer