Cleanup empty lines at beginning of file

This commit is contained in:
Alexander Grothe 2017-06-20 16:19:08 +02:00
parent 5e5f9f346a
commit ddf59c34f1
46 changed files with 899 additions and 958 deletions

View File

@ -1,4 +1,3 @@
# file: group_vars/all
# this is the standard text to put in templates

View File

@ -1,4 +1,3 @@
- name: Restart Samba
systemd:
name: smbd.service

View File

@ -1,5 +1,4 @@
#!/bin/bash
if (( $EUID != 0 )); then
echo "This script must be run using sudo or as root"
exit

View File

@ -1,127 +1,126 @@
#!/usr/bin/env python
#!/usr/bin/env python
# This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules.
DOCUMENTATION = '''
---
module: hardware_facts
short_description: collects facts for kernel modules, usb and pci devices
description:
- This Module collects the vendor- and device ids for USB- and PCI(e)-devices and
currently loaded kernel modules.
options:
usb:
required: False
default: True
description:
- return a list of vendor- and device ids for usb devices in '04x:04x' notation
# This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules.
DOCUMENTATION = '''
---
module: hardware_facts
short_description: collects facts for kernel modules, usb and pci devices
description:
- This Module collects the vendor- and device ids for USB- and PCI(e)-devices and
currently loaded kernel modules.
options:
usb:
required: False
default: True
description:
- return a list of vendor- and device ids for usb devices in '04x:04x' notation
pci:
required: False
default: True
description:
- return a list of vendor- and device ids for pci devices in '04x:04x' notation
pci:
required: False
default: True
description:
- return a list of vendor- and device ids for pci devices in '04x:04x' notation
modules:
required: False
default: True
description:
- return a list of currently loaded kernel modules
modules:
required: False
default: True
description:
- return a list of currently loaded kernel modules
gpus:
required: False
default: True
description:
- return a list of devices of the pci gpu class (0x030000)
notes:
- requres python-pyusb and python-kmodpy
requirements: [ ]
author: "Alexander Grothe <seahawk1986@gmx.de>"
'''
gpus:
required: False
default: True
description:
- return a list of devices of the pci gpu class (0x030000)
notes:
- requres python-pyusb and python-kmodpy
requirements: [ ]
author: "Alexander Grothe <seahawk1986@gmx.de>"
'''
EXAMPLES = '''
- name: get information about usb and pci hardware and loaded kernel modules
hardware_facts:
usb: True
pci: True
modules: True
- debug:
var: usb
- debug
var: pci
- debug
var: modules
- debug
var: gpus
'''
EXAMPLES = '''
- name: get information about usb and pci hardware and loaded kernel modules
hardware_facts:
usb: True
pci: True
modules: True
- debug:
var: usb
- debug
var: pci
- debug
var: modules
- debug
var: gpus
'''
import glob
import json
import os
import sys
import usb.core
from collections import namedtuple
import glob
import json
import os
import sys
import usb.core
from collections import namedtuple
import kmodpy
from ansible.module_utils.basic import *
import kmodpy
from ansible.module_utils.basic import *
PCIDevice = namedtuple("PCIDevice", 'idVendor idProduct idClass pciPath')
PCIDevice = namedtuple("PCIDevice", 'idVendor idProduct idClass pciPath')
def get_pci_devices():
for device in glob.glob('/sys/devices/pci*/*:*:*/'):
with open(os.path.join(device, 'device')) as d:
product_id = int(d.read().strip(), 16)
with open(os.path.join(device, 'vendor')) as d:
vendor_id = int(d.read().strip(), 16)
with open(os.path.join(device, 'class')) as d:
class_id = int(d.read().strip(), 16)
yield PCIDevice(idVendor=vendor_id, idProduct=product_id, idClass=class_id, pciPath=device)
def get_pci_devices():
for device in glob.glob('/sys/devices/pci*/*:*:*/'):
with open(os.path.join(device, 'device')) as d:
product_id = int(d.read().strip(), 16)
with open(os.path.join(device, 'vendor')) as d:
vendor_id = int(d.read().strip(), 16)
with open(os.path.join(device, 'class')) as d:
class_id = int(d.read().strip(), 16)
yield PCIDevice(idVendor=vendor_id, idProduct=product_id, idClass=class_id, pciPath=device)
def format_device_list(iterator):
return ["{:04x}:{:04x}".format(d.idVendor, d.idProduct) for d in iterator]
def format_device_list(iterator):
return ["{:04x}:{:04x}".format(d.idVendor, d.idProduct) for d in iterator]
def format_gpu_device_list(iterator):
def get_entries(iterator):
for d in iterator:
if d.idClass == 0x030000:
yield ("{:04x}:{:04x}".format(d.idVendor, d.idProduct))
return [entry for entry in get_entries(iterator)]
def format_gpu_device_list(iterator):
def get_entries(iterator):
for d in iterator:
if d.idClass == 0x030000:
yield ("{:04x}:{:04x}".format(d.idVendor, d.idProduct))
return [entry for entry in get_entries(iterator)]
arg_specs = {
'usb': dict(default=True, type='bool', required=False),
'pci': dict(default=True, type='bool', required=False),
'modules': dict(default=True, type='bool', required=False),
'gpus': dict(default=True, type='bool', required=False),
}
arg_specs = {
'usb': dict(default=True, type='bool', required=False),
'pci': dict(default=True, type='bool', required=False),
'modules': dict(default=True, type='bool', required=False),
'gpus': dict(default=True, type='bool', required=False),
}
def main():
module = AnsibleModule(argument_spec=arg_specs, supports_check_mode=True,)
collect_usb = module.params['usb']
collect_pci = module.params['pci']
collect_modules = module.params['modules']
collect_gpus = module.params['gpus']
if collect_usb:
usb_devices = format_device_list(usb.core.find(find_all=True))
else:
usb_device = []
if collect_pci:
pci_devices = format_device_list(get_pci_devices())
else:
pci_devices = []
if collect_modules:
k = kmodpy.Kmod()
modules = [m[0] for m in k.loaded()]
else:
modules = []
if collect_gpus:
gpus = format_gpu_device_list(get_pci_devices())
else:
gpus = []
data = {'usb': usb_devices, 'pci': pci_devices, 'modules': modules, 'gpus': gpus}
module.exit_json(changed=False, ansible_facts=data, msg=data)
def main():
module = AnsibleModule(argument_spec=arg_specs, supports_check_mode=True,)
collect_usb = module.params['usb']
collect_pci = module.params['pci']
collect_modules = module.params['modules']
collect_gpus = module.params['gpus']
if collect_usb:
usb_devices = format_device_list(usb.core.find(find_all=True))
else:
usb_device = []
if collect_pci:
pci_devices = format_device_list(get_pci_devices())
else:
pci_devices = []
if collect_modules:
k = kmodpy.Kmod()
modules = [m[0] for m in k.loaded()]
else:
modules = []
if collect_gpus:
gpus = format_gpu_device_list(get_pci_devices())
else:
gpus = []
data = {'usb': usb_devices, 'pci': pci_devices, 'modules': modules, 'gpus': gpus}
module.exit_json(changed=False, ansible_facts=data, msg=data)
if __name__ == '__main__':
main()
if __name__ == '__main__':
main()

View File

@ -1,4 +1,3 @@
#!/usr/bin/env python2
DOCUMENTATION = '''

View File

@ -1,4 +1,3 @@
#!/usr/bin/env python2
from __future__ import print_function
import ast

View File

@ -1,3 +1,2 @@
[localhost]
localhost connection=local

View File

@ -1,4 +1,3 @@
---
# file roles/autoinstall-dvbhddevice/tasks/main.yml

View File

@ -1,4 +1,3 @@
---
# file roles/autoinstall-dvbsddevice/tasks/main.yml

View File

@ -1,4 +1,3 @@
---
# file roles/autoinstall-imonlcd/tasks/main.yml

View File

@ -1,4 +1,3 @@
---
# file roles/autoinstall-libcec-daemon/tasks/main.yml

View File

@ -1,4 +1,3 @@
---
# file roles/autoinstall-pvr350/tasks/main.yml

View File

@ -1,4 +1,3 @@
---
# file roles/autoinstall-satip/tasks/main.yml

View File

@ -1,4 +1,3 @@
---
# file roles/autoinstall-targavfd/tasks/main.yml

View File

@ -1,17 +1,16 @@
---
# file roles/autoinstall-ubuntu-drivers/tasks/main.yml
---
# file roles/autoinstall-ubuntu-drivers/tasks/main.yml
- name: apt | install ubuntu-drivers-common
apt:
name: ubuntu-drivers-common
state: present
- name: apt | install ubuntu-drivers-common
apt:
name: ubuntu-drivers-common
state: present
- name: ensure /etc/yavdr exists
file:
path: /etc/yavdr
state: directory
mode: 0755
- name: ensure /etc/yavdr exists
file:
path: /etc/yavdr
state: directory
mode: 0755
- name: let ubuntu-drivers automatically install additional drivers
command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall
- name: let ubuntu-drivers automatically install additional drivers
command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall

View File

@ -1,4 +1,3 @@
---
# file: roles/dvd/tasks/main.yml

View File

@ -1,4 +1,3 @@
system:
shutdown: poweroff
grub:

View File

@ -1,4 +1,3 @@
- name: Update GRUB
command: update-grub
failed_when: ('error' in grub_register_update.stderr)

View File

@ -1,4 +1,3 @@
- name: custom grub configuration for timeout and reboot halt
template:
src: templates/50_custom.j2

View File

@ -1,4 +1,3 @@
#!/bin/sh
exec tail -n +3 $0

View File

@ -1,4 +1,3 @@
---
- name: change udev rule to allow KODI to eject optical disks

View File

@ -1,4 +1,3 @@
[Unit]
Description=Start kodi in user session

View File

@ -1,4 +1,3 @@
- name: install nfs server packages
apt:
name: '{{ item }}'

View File

@ -1,5 +1,4 @@
/srv *(rw,fsid=0,sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }})
{% for name, path in media_dirs.iteritems() %}
{{ path }} *(rw,fsid={{ loop.index }},sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}{{ ',insecure' if nfs.insecure else '' }})
{% endfor %}
/srv *(rw,fsid=0,sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }})
{% for name, path in media_dirs.iteritems() %}
{{ path }} *(rw,fsid={{ loop.index }},sync,no_subtree_check,all_squash,anongid={{ vdr.gid }},anonuid={{ vdr.uid }}{{ ',insecure' if nfs.insecure else '' }})
{% endfor %}

View File

@ -1,4 +1,3 @@
# file: roles/samba-config/tasks/main.yml
# TODO:

View File

@ -1,4 +1,3 @@
{{ ansible_managed_file | comment }}
#======================= Global Settings =======================

View File

@ -1,4 +1,3 @@
# file: roles/samba-install/tasks/main.yml
- name: install samba server

View File

@ -1,4 +1,3 @@
foo:
- bar
- baz

View File

@ -1,4 +1,3 @@
---
- name: show vars
debug:

View File

@ -1,5 +0,0 @@
vars:
foo:
- bar
- baz
- spam

View File

@ -1,4 +1,3 @@
---
# file: roles/vdr/tasks/main.yml

View File

@ -1,4 +1,3 @@
---
# file: roles/yavdr-common/defaults/main.yml
@ -14,10 +13,10 @@ drivers:
sundtek: auto
ddvb-dkms: auto
extra_packages:
- vim
- tree
- w-scan
extra_packages:
- vim
- tree
- w-scan
vdr:
user: vdr

View File

@ -1,4 +0,0 @@
// {{ ansible_managed_file }}
// Recommends are as of now still abused in many packages
APT::Install-Recommends "0";
APT::Install-Suggests "0";

View File

@ -1,4 +1,3 @@
- name: apt | prevent automatic installation of recommended packages
template:
src: templates/90-norecommends.j2

View File

@ -1,4 +1,3 @@
{{ ansible_managed_file | comment('c') }}
// Recommends are as of now still abused in many packages
APT::Install-Recommends "0";

View File

@ -1,2 +1 @@
install_avahi: true

View File

@ -1,4 +1,3 @@
---
# this playbook sets up network services for a yaVDR installation

View File

@ -1,4 +1,3 @@
---
# file: roles/yavdr-xorg/tasks/main.yml

View File

@ -1,4 +1,3 @@
#!/bin/bash
# {{ ansible_managed_file }}
exec openbox-session

View File

@ -1,4 +1,3 @@
env | grep "DISPLAY\|DBUS_SESSION_BUS_ADDRESS\|XDG_RUNTIME_DIR" > ~/.session-env
systemctl --user import-environment DISPLAY XAUTHORITY XDG_RUNTIME_DIR DBUS_SESSION_BUS_ADDRESS

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
# file: roles/yavdr-xorg/templates/vdr-xorg.conf
# {{ ansible_managed_file }}

View File

@ -1,8 +0,0 @@
[Unit]
Description=X with verbose logging on %I
Wants=graphical.target
Before=graphical.target
[Service]
Type=forking
ExecStart=/usr/bin/x-daemon -logverbose 6 -noreset %I

View File

@ -1,4 +1,3 @@
[Unit]
Description=X with verbose logging on %I
Wants=graphical.target

View File

@ -1,4 +1,3 @@
[Unit]
Description=yaVDR Desktop
Requires=default.target

View File

@ -1,4 +1,3 @@
---
# file: yavdr07.yml
# this playbook sets up a complete yaVDR 0.7 installation