feat(role): Initial commit
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
.idea
|
||||||
@@ -1,3 +1,49 @@
|
|||||||
# role-service-hardware_sensors
|
[//]: # (SPDX-License-Identifier: MIT)
|
||||||
|
# Role Name
|
||||||
|
|
||||||
On Linux hardware configure fan and temp sensors
|
role-service-hardware_sensors
|
||||||
|
|
||||||
|
# Description
|
||||||
|
|
||||||
|
On Linux hardware configure fan and temp sensors.
|
||||||
|
|
||||||
|
# Requirements
|
||||||
|
|
||||||
|
Your target machines must be Linux.
|
||||||
|
|
||||||
|
# Role Variables
|
||||||
|
|
||||||
|
Per [defaults/main.yml](defaults/main.yml) this role is equipped to deal with Arch Linux and Debian.
|
||||||
|
|
||||||
|
- `packages_linux_sensors_all_families`: Place package names in this list that are identical across all Linux flavors. While we do install packages we don't have any that have identical names across all Linux flavors so this variable defaults to an empty list.
|
||||||
|
```
|
||||||
|
packages_linux_sensors_all_families: []
|
||||||
|
```
|
||||||
|
- `packages_linux_sensors_*`: Add package names to an operating system-specific list if it's unique to that operating system. The asterisk (`*`) is a placeholder for `ansible_facts['os_family'] | lower`. If `ansible_facts['os_family']` equals `Debian` then this becomes `debian` and the list turns into `packages_linux_sensors_debian`; same for `packages_linux_sensors_archlinux` etc. Note that for Arch Linux these are official packages only, not packages from the Arch User Repository.
|
||||||
|
```
|
||||||
|
packages_linux_sensors_archlinux:
|
||||||
|
- 'lm_sensors'
|
||||||
|
|
||||||
|
packages_linux_sensors_debian:
|
||||||
|
- 'lm-sensors'
|
||||||
|
- 'fancontrol'
|
||||||
|
```
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
|
# Example Playbook
|
||||||
|
|
||||||
|
In your `playbook.yml` call it like so:
|
||||||
|
|
||||||
|
```
|
||||||
|
- name: 'Awesome playbook'
|
||||||
|
hosts: all
|
||||||
|
roles:
|
||||||
|
- 'role-service-hardware_sensors'
|
||||||
|
```
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
MIT
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
packages_linux_sensors_all_families:
|
||||||
|
|
||||||
|
|
||||||
|
packages_linux_sensors_archlinux:
|
||||||
|
- 'lm_sensors'
|
||||||
|
|
||||||
|
packages_linux_sensors_debian:
|
||||||
|
- 'lm-sensors'
|
||||||
|
- 'fancontrol'
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
# Configuration file generated by pwmconfig, changes will be lost
|
||||||
|
INTERVAL=10
|
||||||
|
# DEVPATH=hwmon1=devices/platform/nct6775.656
|
||||||
|
# DEVNAME=hwmon1=nct6799
|
||||||
|
FCTEMPS=/sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm7=/sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/temp7_input /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm5=/sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/temp7_input /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm2=/sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/temp7_input /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm4=/sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/temp7_input
|
||||||
|
FCFANS=/sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm7=/sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/fan7_input /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm5=/sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/fan5_input /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm2=/sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/fan2_input /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm4=/sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/fan4_input
|
||||||
|
MINTEMP=/sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm7=70 /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm5=70 /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm2=70 /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm4=70
|
||||||
|
MAXTEMP=/sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm7=90 /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm5=90 /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm2=90 /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm4=90
|
||||||
|
MINSTART=/sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm7=100 /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm5=100 /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm2=100 /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm4=100
|
||||||
|
MINSTOP=/sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm7=100 /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm5=100 /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm2=100 /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm4=100
|
||||||
|
MINPWM=/sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm7=100 /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm5=100 /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm2=100 /sys/devices/platform/nct6775.[[:print:]]*/hwmon/hwmon[[:print:]]*/pwm4=100
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
options nct6775 force_id=0xd802
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
nct6775
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
- name: 'Reboot machine'
|
||||||
|
ansible.builtin.reboot:
|
||||||
|
test_command: 'qm list'
|
||||||
|
|
||||||
|
- name: 'Restart fancontrol.service'
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: 'fancontrol.service'
|
||||||
|
state: 'restarted'
|
||||||
|
enabled: true
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
galaxy_info:
|
||||||
|
author: 'hygienic-books'
|
||||||
|
description: 'On Linux hardware configure fan and temp sensors'
|
||||||
|
license: MIT
|
||||||
|
min_ansible_version: 2.18.1
|
||||||
|
galaxy_tags:
|
||||||
|
- 'sensors'
|
||||||
|
dependencies: []
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
- import_tasks: 'mainboard-amd-am5-b650m-hdv_m.2.yml'
|
||||||
|
when: 'ansible_facts[''product_name''] | lower == ''b650m-hdv/m.2'''
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
- name: 'If mainboard is ASRock B650M-HDV/M.2 (with Nuvoton NCT6796D-S SuperIO chip) and OS is a Linux flavor and install Linux-specific packages for sensors and fan control'
|
||||||
|
when: 'ansible_facts[''system''] | lower == ''linux'''
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: '{{ packages_linux_sensors_all_families }}'
|
||||||
|
state: 'present'
|
||||||
|
|
||||||
|
- name: 'If mainboard is ASRock B650M-HDV/M.2 (with Nuvoton NCT6796D-S SuperIO chip) and ''os_family'' is ''{{ ansible_facts[''os_family''] | lower }}'' install {{ ansible_facts[''os_family''] | lower }}-specific packages for sensors and fan control'
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: '{{ vars[''packages_linux_sensors_'' + ansible_facts[''os_family''] | lower] }}'
|
||||||
|
state: 'present'
|
||||||
|
|
||||||
|
- name: 'If mainboard is ASRock B650M-HDV/M.2 (with Nuvoton NCT6796D-S SuperIO chip) add fan control config'
|
||||||
|
loop_control:
|
||||||
|
loop_var: 'file'
|
||||||
|
index_var: 'i'
|
||||||
|
label: 'Store ''{{ file.dst }}'' {{ file.purpose_human_readable }}'
|
||||||
|
loop:
|
||||||
|
- { src: 'etc/fancontrol-fans-2-4-5-7-bound-to-cpu-die-temp', dst: '/etc/fancontrol', purpose_human_readable: 'to supply sane fan control settings' }
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: '{{ file.src }}'
|
||||||
|
dest: '{{ file.dst }}'
|
||||||
|
notify:
|
||||||
|
- 'Restart fancontrol.service'
|
||||||
|
|
||||||
|
- name: 'If mainboard is ASRock B650M-HDV/M.2 (with Nuvoton NCT6796D-S SuperIO chip) add kernel module config'
|
||||||
|
loop_control:
|
||||||
|
loop_var: 'file'
|
||||||
|
index_var: 'i'
|
||||||
|
label: 'Store ''/{{ file.path }}'' {{ file.purpose_human_readable }}'
|
||||||
|
loop:
|
||||||
|
- { path: 'etc/modules-load.d/lm-sensors.conf', purpose_human_readable: 'to auto-load the ''nct6775'' kernel module on boot' }
|
||||||
|
- { path: 'etc/modprobe.d/lm-sensors.conf', purpose_human_readable: 'for the ''nct6775'' kernel module to work with this mainboard' }
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: '{{ file.path }}'
|
||||||
|
dest: '/{{ file.path }}'
|
||||||
|
notify:
|
||||||
|
- 'Reboot machine'
|
||||||
Reference in New Issue
Block a user