refactor setup-autocall.yml

This commit is contained in:
Tomáš Mládek 2024-09-19 14:24:42 +02:00
parent 0e20540107
commit f2ee180967

View file

@ -57,48 +57,32 @@
owner: "{{ ansible_user }}"
mode: "0755"
- name: Symlink parsifal.service to systemd user directory
- name: Symlink all service files
file:
src: "/home/{{ ansible_user }}/parsifal/parsifal.service"
dest: "/home/{{ ansible_user }}/.config/systemd/user/parsifal.service"
src: "/home/{{ ansible_user }}/parsifal/{{ item }}"
dest: "/home/{{ ansible_user }}/.config/systemd/user/{{ item }}"
state: link
loop:
- parsifal.service
- unclutter.service
- x11vnc.service
- name: Symlink unclutter.service to systemd user directory
file:
src: "/home/{{ ansible_user }}/parsifal/unclutter.service"
dest: "/home/{{ ansible_user }}/.config/systemd/user/unclutter.service"
state: link
- name: Symlink x11vnc.service to systemd user directory
file:
src: "/home/{{ ansible_user }}/parsifal/x11vnc.service"
dest: "/home/{{ ansible_user }}/.config/systemd/user/x11vnc.service"
state: link
- name: Reload systemd for the current user
command: systemctl --user daemon-reload
- name: Reload systemd user service
become: yes
become_user: "{{ ansible_user }}"
environment:
XDG_RUNTIME_DIR: "/run/user/{{ ansible_user_uid }}" # Needed for running systemctl --user
systemd:
daemon_reload: yes
scope: user
- name: Enable and start the Parsifal service
command: systemctl --user enable --now parsifal
- name: Enable and start all services
become: yes
become_user: "{{ ansible_user }}"
environment:
XDG_RUNTIME_DIR: "/run/user/{{ ansible_user_uid }}" # Needed for running systemctl --user
- name: Enable and start the Unclutter service
command: systemctl --user enable --now unclutter
become: yes
become_user: "{{ ansible_user }}"
environment:
XDG_RUNTIME_DIR: "/run/user/{{ ansible_user_uid }}" # Needed for running systemctl --user
- name: Enable and start the x11vnc service
command: systemctl --user enable --now x11vnc
become: yes
become_user: "{{ ansible_user }}"
environment:
XDG_RUNTIME_DIR: "/run/user/{{ ansible_user_uid }}" # Needed for running systemctl --user
systemd:
name: "{{ item }}"
enabled: yes
state: started
scope: user
loop:
- parsifal
- unclutter
- x11vnc