From 1117ca00f7566dfcde891d79ea10d273e501f6bc Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Sun, 22 May 2022 14:05:05 +0100 Subject: [PATCH] Add system-info role for Windows --- roles/system-info/tasks/Darwin.yaml | 4 ++ roles/system-info/tasks/Debian.yaml | 5 +++ roles/system-info/tasks/Windows.yaml | 58 ++++++++++++++++++++++++++++ roles/system-info/tasks/main.yaml | 2 + roles/system-info/vars/main.yaml | 5 +++ unix.yaml | 3 +- windows.yaml | 1 + 7 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 roles/system-info/tasks/Darwin.yaml create mode 100644 roles/system-info/tasks/Debian.yaml create mode 100644 roles/system-info/tasks/Windows.yaml create mode 100644 roles/system-info/tasks/main.yaml create mode 100644 roles/system-info/vars/main.yaml diff --git a/roles/system-info/tasks/Darwin.yaml b/roles/system-info/tasks/Darwin.yaml new file mode 100644 index 0000000..7f77c32 --- /dev/null +++ b/roles/system-info/tasks/Darwin.yaml @@ -0,0 +1,4 @@ +--- +# TODO: +# cp $script_dir/system-info.plist ~/Library/LaunchAgents/system-info.plist +# launchctl load -w ~/Library/LaunchAgents/system-info.plist diff --git a/roles/system-info/tasks/Debian.yaml b/roles/system-info/tasks/Debian.yaml new file mode 100644 index 0000000..db2188a --- /dev/null +++ b/roles/system-info/tasks/Debian.yaml @@ -0,0 +1,5 @@ +--- +# TODO: +# cp $script_dir/system-info.service ~/.config/systemd/user/system-info.service +# systemctl --user enable system-info +# systemctl --user start system-info diff --git a/roles/system-info/tasks/Windows.yaml b/roles/system-info/tasks/Windows.yaml new file mode 100644 index 0000000..cfe121d --- /dev/null +++ b/roles/system-info/tasks/Windows.yaml @@ -0,0 +1,58 @@ +--- +- name: install chocolatey packages + win_chocolatey: + name: openhardwaremonitor + state: latest + +# - TODO: update config file +# C:\ProgramData\chocolatey\lib\OpenHardwareMonitor\tools\OpenHardwareMonitor\OpenHardwareMonitor.config + +- name: create OpenHardwareMonitor scheduled task + win_scheduled_task: + path: Benie + name: OpenHardwareMonitor + state: present + enable: true + triggers: + - type: logon + enabled: true + - type: registration + enabled: true + actions: + - path: '{{openhardwaremonitor_exe}}' + working_directory: '{{openhardwaremonitor_install_dir}}' + disallow_start_if_on_batteries: false + stop_if_going_on_batteries: false + execution_time_limit: PT0S + logon_type: interactive_token + multiple_instances: 3 + run_level: highest + 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 diff --git a/roles/system-info/tasks/main.yaml b/roles/system-info/tasks/main.yaml new file mode 100644 index 0000000..6853678 --- /dev/null +++ b/roles/system-info/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include_tasks: '{{ansible_os_family}}.yaml' diff --git a/roles/system-info/vars/main.yaml b/roles/system-info/vars/main.yaml new file mode 100644 index 0000000..fb3fe7d --- /dev/null +++ b/roles/system-info/vars/main.yaml @@ -0,0 +1,5 @@ +--- +openhardwaremonitor_exe: 'OpenHardwareMonitor.exe' +openhardwaremonitor_install_dir: '{{ansible_env.ProgramData}}\chocolatey\lib\OpenHardwareMonitor\tools\OpenHardwareMonitor' + +wsl_exe: '{{ansible_env.SystemRoot}}/System32/wsl.exe' diff --git a/unix.yaml b/unix.yaml index 16ed082..57fcd1e 100644 --- a/unix.yaml +++ b/unix.yaml @@ -3,8 +3,9 @@ roles: - role: zsh - - role: tmux - role: neovim + - role: tmux + - role: system-info - role: ag - role: bat diff --git a/windows.yaml b/windows.yaml index eebcedc..19317fa 100644 --- a/windows.yaml +++ b/windows.yaml @@ -14,6 +14,7 @@ roles: - role: powershell - role: neovim + - role: system-info - role: ag - role: git