Overview
Running an Ansible playbook on the v2 container runtime sometimes results in the following error:
fatal: [127.0.0.1]: FAILED! => {"msg": "module (pause) is missing interpreter line"}
Solution
In the v1 runtime, the service module worked by luck. It detects the init system and tries to use that. Containers don't have init systems. It is supposed to fall back to using the equivalent of "use: service" , but it seems to pick up pid 1 and try to use it regardless. Whilst pid 1 wasn't a supported init system, it just so happened to be usable as if it were in v1. In the v2 runtime, pid 1 is not usable in such a way. This is why this error occurs. It is also called pause, which is why the error message mentions it. So by adding "use: service" you can skip that pid 1 detection and use the fallback method as it is supposed to.
- name: restart xxx-agent
service:
name: xxx-agent
state: restarted
use: service
Comments
Please sign in to leave a comment.