Make user unit handling work
This commit is contained in:
20
user.yml
20
user.yml
@@ -48,20 +48,12 @@
|
|||||||
- xdg-user-dirs-update.service
|
- xdg-user-dirs-update.service
|
||||||
- gnome-keyring-daemon.service
|
- gnome-keyring-daemon.service
|
||||||
|
|
||||||
- name: stop undesired service
|
# systemd needs a login session, machinectl handles that for us
|
||||||
systemd_service:
|
- name: stop and mask undesired services
|
||||||
name: "{{ item }}"
|
command:
|
||||||
scope: user
|
cmd: machinectl --uid {{ user.name }} shell -- .host /usr/bin/env systemctl --user mask --now "{{ item }}"
|
||||||
state: stopped
|
become: true
|
||||||
loop: "{{ undesired_user_services }}"
|
become_user: root
|
||||||
|
|
||||||
# No way to use the `systemd` module here, as it needs a logind
|
|
||||||
# session. So we have to handle the symlinks for masking ourselves.
|
|
||||||
- name: disable and mask systemd user units
|
|
||||||
file:
|
|
||||||
state: link
|
|
||||||
dest: "/home/{{ user.name }}/.config/systemd/user/{{ item }}"
|
|
||||||
src: "/dev/null"
|
|
||||||
loop: "{{ undesired_user_services }}"
|
loop: "{{ undesired_user_services }}"
|
||||||
|
|
||||||
- name: create directory for getty autologin
|
- name: create directory for getty autologin
|
||||||
|
|||||||
Reference in New Issue
Block a user