0

I facing an issue on my Molecule Test. I have begin to study this tool 2 days ago for information.

on a Ubuntu VM running with Vagrant,I have create a role and initialze Molecule's folder and create a testinfra test file ( with the docker provider ).

The error is when my task's role are running, at the step of checking service running, it failed.

fatal: [instance]: FAILED! => {"changed": false, "msg": "Could not find the requested service httpd: "}

I was design to simply install 2 packages including httpd on a Centos Image.

When im loggin directly to the Molecule VM ( so through docker ), when i simply type systemctl the error message is

Failed to get D-Bus connection: Operation not permitted

As adviced Geerlingguy, i have specify volume mapped on cgroup folder

platforms:
  - name: instance
    #image: docker.io/pycontribs/centos:7
    image: geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest
    volumes:
      - /sys/fs/cgroup:/sys/fs/cgroup:ro

The error is not related to Testinfra but only the docker built image.

Could someone help me to understand why this error message ?

Is that because im on a VirtualBox ran by Vagrant ?

Thanks all for reading :-)

Baki7512
  • 1
  • 1

1 Answers1

0

I have added that on my mocule.yml file config according molecule documentation ( https://molecule.readthedocs.io/en/latest/examples.html#docker ) :

platforms: - name: instance #image: docker.io/pycontribs/centos:7 image: geerlingguy/docker-centos7-ansible:latest capabilities: - SYS_ADMIN command: /sbin/init

systemctl working fine now

Baki7512
  • 1
  • 1