autostart: Template the autostart target unit file

This commit is contained in:
2021-10-02 10:52:59 +02:00
parent d9dd1e7acf
commit b9a9097f95
2 changed files with 25 additions and 1 deletions

View File

@@ -7,7 +7,9 @@ Wants=discord.service
Wants=dpms.service Wants=dpms.service
Wants=dunst.service Wants=dunst.service
Wants=element.service Wants=element.service
Wants=firefox.service {% for profile in user.firefox_profiles|default([]) %}
Wants=firefox@{{ profile.name }}.service
{% endfor %}
Wants=gpg-agent.service Wants=gpg-agent.service
Wants=gnome-keyring.service Wants=gnome-keyring.service
Wants=keepassx.service Wants=keepassx.service

View File

@@ -478,5 +478,27 @@
group: "{{ user_group_name }}" group: "{{ user_group_name }}"
with_fileglob: /var/lib/dotfiles/autostart/services/* with_fileglob: /var/lib/dotfiles/autostart/services/*
- name: get state of autostart.target
stat:
path: "/home/{{ user.name }}/.config/systemd/user/autostart.target"
register: autostart_target_stat
- name: remove invalid autostart.target
file:
path: "/home/{{ user.name }}/.config/systemd/user/autostart.target"
state: absent
when:
- autostart_target_stat.stat.exists
- not autostart_target_stat.stat.isreg
- name: deploy autostart.target
template:
src: ./autostart/autostart.target.j2
dest: "/home/{{ user.name }}/.config/systemd/user/autostart.target"
owner: "{{ user.name }}"
group: "{{ user_group_name }}"
force: true
follow: false
tags: tags:
- autostart - autostart