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

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f6165124-b45c-b05c-0f08-b2eb6c5fe6d4%40sudheer.net.

Reply via email to