fix errors with missing TTY by switching to sudo method

This commit is contained in:
2025-09-24 14:32:48 +02:00
parent e59fc5f9a8
commit d0838e4954

View File

@@ -11,7 +11,7 @@
- name: Install required dependencies
ansible.builtin.apt:
pkg:
- systemd-container # necessary to use machinectl become_method
- systemd-container # necessary to use machinectl
install_recommends: false
- name: Register user info of {{ user }}
@@ -65,4 +65,7 @@
scope: user
become: true
become_user: "{{ user }}"
become_method: community.general.machinectl # in order to get XDG_RUNTIME_DIR and user's DBUS session
become_method: ansible.builtin.sudo
environment:
XDG_RUNTIME_DIR: "/run/user/{{ user_info.uid }}"
DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/{{ user_info.uid }}/bus"