"module (pause) is missing interpreter line" error on v2 container runtime

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
Was this article helpful?
1 out of 1 found this helpful

Comments

0 comments

Please sign in to leave a comment.