I am running an Ansible playbook on a fresh Oracle Linux 8 system. It includes a step where it asks systemctl to activate a user Podman socket like so:
- name: Enable podman socket
vars:
userid: ansible_facts.getent_passwd.{{ ansible_user_id }}[1]
ansible.builtin.systemd:
name: podman.socket
enabled: yes
state: started
scope: user
environment:
XDG_RUNTIME_DIR: "/run/user/{{ userid }}"
This Ansible playbook is being run as the user (not root) to enable and start the user-level Podman socket.
However, running the playbook gave me this error:
fatal: [127.0.0.1]: FAILED! => {"changed": false, "cmd": "/bin/systemctl --user", "msg": "Failed to connect to bus: No such file or directory", "rc": 1, "stderr": "Failed to connect to bus: No such file or directory\n", "stderr_lines": ["Failed to connect to bus: No such file or directory"], "stdout": "", "stdout_lines": []}
If, instead of using Ansible, I manually run the following systemctl command, then the user Podman socket activates successfully:
systemctl --user enable podman.socket
What am I missing in my playbook and how do I fix it? Thanks!
0 Answers