Add some roles for autodetection of Hardware

This commit is contained in:
Alexander Grothe
2017-03-02 16:01:52 +01:00
parent 5cd3869a51
commit bcc016b7e6
12 changed files with 192 additions and 11 deletions

View File

@@ -0,0 +1,9 @@
---
# file roles/autoinstall-dvbhddevice/tasks/main.yml
- name: apt | install vdr-plugin-dvbhddevice if connected
apt:
name: vdr-plugin-dvbhddevice
when:
- '"13c2:300a" in ansible_local.hardware.pci'
- '"13c2:300b" in ansible_local.hardware.pci'

View File

@@ -0,0 +1,8 @@
---
# file roles/autoinstall-dvbsddevice/tasks/main.yml
- name: apt | install vdr-plugin-dvbsddevice if module is loaded
apt:
name: vdr-plugin-dvbsddevice
when:
- '19c2:6a11" in ansible_local.modules'

View File

@@ -0,0 +1,9 @@
---
# file roles/autoinstall-imonlcd/tasks/main.yml
- name: apt | install vdr-plugin-imonlcd if connected
apt:
name: vdr-plugin-imonlcd
when:
- '"15c2:0038" in ansible_local.hardware.usb'
- '"15c2:ffdc" in ansible_local.hardware.usb'

View File

@@ -0,0 +1,8 @@
---
# file roles/autoinstall-libcec-daemon/tasks/main.yml
- name: apt | install libcec-daemon if connected
apt:
name: libcec-daemon
when:
- '"2548:1002" in ansible_local.hardware.usb'

View File

@@ -0,0 +1,8 @@
---
# file roles/autoinstall-pvr350/tasks/main.yml
- name: apt | install vdr-plugin-pvr350 if connected
apt:
name: vdr-plugin-pvr350
when:
- '19c2:6a11" in ansible_local.hardware.pci'

View File

@@ -0,0 +1,12 @@
---
# file roles/autoinstall-satip/tasks/main.yml
- name: Display all variables/facts known for a host
debug:
var: ansible_local
verbosity: 1
- name: apt | install vdr-plugin-satip if a Sat>IP server has been detected
apt:
name: vdr-plugin-satip
when: ansible_local.satip.satip_detected

View File

@@ -0,0 +1,8 @@
---
# file roles/autoinstall-targavfd/tasks/main.yml
- name: apt | install vdr-plugin-targavfd if connected
apt:
name: vdr-plugin-targavfd
when:
- '"19c2:6a11" in ansible_local.hardware.usb'

View File

@@ -0,0 +1,9 @@
#!/usr/bin/env python2
# This script returns a list of currently loaded kernel modules
from __future__ import print_function
import json
import kmodpy
k = kmodpy.Kmod()
print(json.dumps([module[0] for module in k.loaded()]))

View File

@@ -32,6 +32,7 @@
- biosdevname
- linux-firmware
- psmisc
- python-kmodpy
- python3-usb
- software-properties-common
- ssh
@@ -48,13 +49,19 @@
- name: copy facts script for USB- and PCI(e)-IDs
copy:
src: files/hardware.facts.py
src: files/hardware.fact.py
dest: /etc/ansible/facts.d/hardware.fact
mode: '0775'
- name: copy facts script for loaded modules
copy:
src: files/modules.fact.py
dest: /etc/ansible/facts.d/modules.fact
mode: '0775'
- name: copy facts script for Sat>IP server detection
copy:
src: files/satip.facts.py
src: files/satip.fact.py
dest: /etc/ansible/facts.d/satip.fact
mode: '0775'