Getting "Service is in unknown state" when I run ansible in docker container for ubuntu20

I am currently using ansible 3.0.0 in my local environment. I am trying to do the deployment from ubuntu20 docker container to ubuntu20 container. But deployments are failing with the below error.

   "changed": false,
    "invocation": {
        "module_args": {
            "daemon_reexec": false,
            "daemon_reload": false,
            "enabled": null,
            "force": null,
            "masked": null,
            "name": "supervisor",
            "no_block": false,
            "scope": "system",
            "state": "stopped"
        }
    },
    "msg": "Service is in unknown state",
    "status": {}
- name: Stop supervisor
      service: name=supervisor state=stopped

I tried ansible 3.1.0, ansible 3.2.0, ansible 3.3.0. But getting same error . Can someone please help me to fix this error.

Hi,

I have a hard time trying to understand what you’re trying to achieve.

Supposing your second codeblock is the task you’re running, and the first block being the output, you are effectively telling Ansible to ensure a service named “supervisor” is stopped on your targets.

So if I get you right, you’re running your playbook from an Ubuntu:20 container to target another Ubuntu:20 container ? What init system is in use in your target container ? When checking manually, is your supervisor service indeed stopped on your target ?

Lastly, you’re using a very old Ansible version, I think installed from distro package manager; would it be possible for you to try a more recent one (> 7.7.0) ?