Switch system-info to systemd on WSL

This commit is contained in:
Kenneth Benzie 2023-05-12 22:20:05 +01:00
parent 8fae111d0e
commit d4393851b1
4 changed files with 53 additions and 26 deletions

View File

@ -0,0 +1,7 @@
---
- name: restart system-info
systemd:
name: system-info
scope: user
daemon_reload: true
state: restarted

View File

@ -12,10 +12,21 @@
state: directory
dest: ~/.config/systemd/user
- set_fact:
SYSTEM_INFO_SCRIPT_DIR: '{{ansible_env.HOME}}/.config/tmux/system-info'
- when: '"WSL" not in ansible_kernel'
set_fact:
SYSTEM_INFO_SCRIPT: '{{SYSTEM_INFO_SCRIPT_DIR}}/system-info-Linux.sh'
- when: '"WSL" in ansible_kernel'
set_fact:
SYSTEM_INFO_SCRIPT: '{{SYSTEM_INFO_SCRIPT_DIR}}/system-info-WSL.sh'
- name: install system-info systemd unit
copy:
src: ~/.config/tmux/system-info/system-info.service
template:
src: templates/system-info.service.j2
dest: ~/.config/systemd/user/system-info.service
notify: restart system-info
- name: enable system-info service
systemd:

View File

@ -30,29 +30,29 @@
start_when_available: true
wake_to_run: false
- name: create system-info-WSL.sh scheduled task
win_scheduled_task:
path: Benie
name: system-info-WSL.sh
state: present
enable: true
triggers:
- type: logon
enabled: true
- type: registration
enabled: true
actions:
- path: '{{wsl_exe}}'
arguments: '-d Debian -e /home/benie/.config/tmux/system-info/system-info-WSL.sh'
disallow_start_if_on_batteries: false
stop_if_going_on_batteries: false
execution_time_limit: PT0S
logon_type: password
username: '{{ansible_user}}'
password: '{{ansible_password}}'
multiple_instances: 3
run_level: limited
start_when_available: true
wake_to_run: false
# - name: create system-info-WSL.sh scheduled task
# win_scheduled_task:
# path: Benie
# name: system-info-WSL.sh
# state: present
# enable: true
# triggers:
# - type: logon
# enabled: true
# - type: registration
# enabled: true
# actions:
# - path: '{{wsl_exe}}'
# arguments: '-d Debian -e /home/benie/.config/tmux/system-info/system-info-WSL.sh'
# disallow_start_if_on_batteries: false
# stop_if_going_on_batteries: false
# execution_time_limit: PT0S
# logon_type: password
# username: '{{ansible_user}}'
# password: '{{ansible_password}}'
# multiple_instances: 3
# run_level: limited
# start_when_available: true
# wake_to_run: false
# - TODO: configure firewall

View File

@ -0,0 +1,9 @@
[Unit]
Description=System Info
[Service]
ExecStart={{SYSTEM_INFO_SCRIPT}}
Environment=LC_ALL=C.UTF-8
[Install]
WantedBy=default.target