Add nvtop role
This commit is contained in:
parent
8810309515
commit
77a4fdcc16
@ -11,6 +11,7 @@
|
||||
- vars/environment.yaml
|
||||
roles:
|
||||
- role: gdb
|
||||
- role: nvtop
|
||||
- role: podman
|
||||
- role: system-info
|
||||
when: disable_systemd is not defined
|
||||
|
40
roles/nvtop/tasks/install-appimage.yaml
Normal file
40
roles/nvtop/tasks/install-appimage.yaml
Normal file
@ -0,0 +1,40 @@
|
||||
---
|
||||
- name: get latest github release
|
||||
uri:
|
||||
url: https://api.github.com/repos/Syllo/nvtop/releases/latest
|
||||
headers: '{{github_auth_headers}}'
|
||||
register: latest
|
||||
|
||||
- set_fact:
|
||||
asset_query: '[?contains(name, `x86_64.AppImage`)] | [0]'
|
||||
assets: '{{latest.json.assets}}'
|
||||
latest_version: '{{latest.json.tag_name}}'
|
||||
nvtop_exe: '/usr/local/bin/nvtop'
|
||||
|
||||
- name: check if already installed
|
||||
stat:
|
||||
path: '{{nvtop_exe}}'
|
||||
register: nvtop_stat
|
||||
|
||||
- name: get installed version
|
||||
when: nvtop_stat.stat.exists == True
|
||||
command: '{{nvtop_exe}} --version'
|
||||
register: nvtop_version_output
|
||||
changed_when: false
|
||||
|
||||
- when: nvtop_stat.stat.exists == True
|
||||
set_fact:
|
||||
installed_version:
|
||||
'{{nvtop_version_output.stdout.strip() | regex_replace("^.*(\d+\.\d+\.\d+).*$", "\1")}}'
|
||||
|
||||
- set_fact:
|
||||
asset: '{{assets | to_json | from_json | json_query(asset_query)}}'
|
||||
|
||||
- name: download executable
|
||||
when: installed_version is not defined or installed_version != latest_version
|
||||
become: true
|
||||
get_url:
|
||||
url: '{{asset.browser_download_url}}'
|
||||
dest: '{{nvtop_exe}}'
|
||||
mode: +x
|
||||
environment: '{{proxy_environment}}'
|
10
roles/nvtop/tasks/main.yaml
Normal file
10
roles/nvtop/tasks/main.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
- name: install dnf package
|
||||
when: ansible_os_family == 'RedHat'
|
||||
become: true
|
||||
dnf:
|
||||
state: latest
|
||||
name: nvtop
|
||||
|
||||
- when: ansible_os_family != 'RedHat'
|
||||
include_tasks: install-appimage.yaml
|
Loading…
x
Reference in New Issue
Block a user