fix indentation errors

This commit is contained in:
Alexander Grothe 2017-06-20 16:38:38 +02:00
parent b374fe4ead
commit 8a1aa945de
4 changed files with 1778 additions and 1780 deletions

View File

@ -1281,9 +1281,9 @@ systemctl --user isolate yavdr-desktop.target
#+END_SRC #+END_SRC
****** rc.xml ****** rc.xml
#+BEGIN_SRC xml :tangle roles/yavdr-xorg/templates/openbox_rc.xml.j2 :mkdirp yes :padline no #+BEGIN_SRC xml :tangle roles/yavdr-xorg/templates/openbox_rc.xml.j2 :mkdirp yes :padline no
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude"> <openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude">
<!-- Do not edit this file, it will be overwritten on install. <!-- Do not edit this file, it will be overwritten on install.
Copy the file to $HOME/.config/openbox/ instead. --> Copy the file to $HOME/.config/openbox/ instead. -->
<resistance> <resistance>
<strength>10</strength> <strength>10</strength>
@ -2075,7 +2075,7 @@ systemctl --user isolate yavdr-desktop.target
</application> </application>
# end of the example # end of the example
--> -->
<applications> <applications>
<application title="softhddevice"> <application title="softhddevice">
<decor>no</decor> <decor>no</decor>
@ -2096,7 +2096,7 @@ systemctl --user isolate yavdr-desktop.target
<skip_taskbar>yes</skip_taskbar> <skip_taskbar>yes</skip_taskbar>
</application> </application>
</applications> </applications>
</openbox_config> </openbox_config>
#+END_SRC #+END_SRC
** samba-install ** samba-install
@ -2258,21 +2258,20 @@ from http://www.vdr-portal.de/board18-vdr-hardware/board102-dvb-karten/120817-tr
The tool ubuntu-drivers is used to install the matching driver version for nvidia graphics cards, virtualbox guest additions and Intel and AMD microcode updates. The tool ubuntu-drivers is used to install the matching driver version for nvidia graphics cards, virtualbox guest additions and Intel and AMD microcode updates.
*** tasks *** tasks
#+BEGIN_SRC yaml :tangle roles/autoinstall-ubuntu-drivers/tasks/main.yml #+BEGIN_SRC yaml :tangle roles/autoinstall-ubuntu-drivers/tasks/main.yml
--- ---
# file roles/autoinstall-ubuntu-drivers/tasks/main.yml # file roles/autoinstall-ubuntu-drivers/tasks/main.yml
- name: apt | install ubuntu-drivers-common
- name: apt | install ubuntu-drivers-common
apt: apt:
name: ubuntu-drivers-common name: ubuntu-drivers-common
state: present state: present
- name: ensure /etc/yavdr exists - name: ensure /etc/yavdr exists
file: file:
path: /etc/yavdr path: /etc/yavdr
state: directory state: directory
mode: 0755 mode: 0755
- name: let ubuntu-drivers automatically install additional drivers - name: let ubuntu-drivers automatically install additional drivers
command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall command: ubuntu-drivers --package-list /etc/yavdr/autoinstalled autoinstall
#+END_SRC #+END_SRC
** autoinstall-satip ** autoinstall-satip
@ -2740,10 +2739,10 @@ fi
This section contains custom modules for the yaVDR Playbooks. They are used to collect facts about the system and configure applications and daemons. This section contains custom modules for the yaVDR Playbooks. They are used to collect facts about the system and configure applications and daemons.
** hardware_facts.py ** hardware_facts.py
#+BEGIN_SRC python :tangle library/hardware_facts.py #+BEGIN_SRC python :tangle library/hardware_facts.py
#!/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. # This Module collects the vendor- and device ids for USB- and PCI(e)-devices and currently loaded kernel modules.
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---
module: hardware_facts module: hardware_facts
short_description: collects facts for kernel modules, usb and pci devices short_description: collects facts for kernel modules, usb and pci devices
@ -2774,42 +2773,42 @@ This section contains custom modules for the yaVDR Playbooks. They are used to c
default: True default: True
description: description:
- return a list of devices of the pci gpu class (0x030000) - return a list of devices of the pci gpu class (0x030000)
notes: notes:
- requres python-pyusb and python-kmodpy - requres python-pyusb and python-kmodpy
requirements: [ ] requirements: [ ]
author: "Alexander Grothe <seahawk1986@gmx.de>" author: "Alexander Grothe <seahawk1986@gmx.de>"
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: get information about usb and pci hardware and loaded kernel modules - name: get information about usb and pci hardware and loaded kernel modules
hardware_facts: hardware_facts:
usb: True usb: True
pci: True pci: True
modules: True modules: True
- debug: - debug:
var: usb var: usb
- debug - debug
var: pci var: pci
- debug - debug
var: modules var: modules
- debug - debug
var: gpus var: gpus
''' '''
import glob import glob
import json import json
import os import os
import sys import sys
import usb.core import usb.core
from collections import namedtuple from collections import namedtuple
import kmodpy import kmodpy
from ansible.module_utils.basic import * from ansible.module_utils.basic import *
PCIDevice = namedtuple("PCIDevice", 'idVendor idProduct idClass pciPath') PCIDevice = namedtuple("PCIDevice", 'idVendor idProduct idClass pciPath')
def get_pci_devices(): def get_pci_devices():
for device in glob.glob('/sys/devices/pci*/*:*:*/'): for device in glob.glob('/sys/devices/pci*/*:*:*/'):
with open(os.path.join(device, 'device')) as d: with open(os.path.join(device, 'device')) as d:
product_id = int(d.read().strip(), 16) product_id = int(d.read().strip(), 16)
@ -2819,17 +2818,17 @@ This section contains custom modules for the yaVDR Playbooks. They are used to c
class_id = int(d.read().strip(), 16) class_id = int(d.read().strip(), 16)
yield PCIDevice(idVendor=vendor_id, idProduct=product_id, idClass=class_id, pciPath=device) yield PCIDevice(idVendor=vendor_id, idProduct=product_id, idClass=class_id, pciPath=device)
def format_device_list(iterator): def format_device_list(iterator):
return ["{:04x}:{:04x}".format(d.idVendor, d.idProduct) for d in iterator] return ["{:04x}:{:04x}".format(d.idVendor, d.idProduct) for d in iterator]
def format_gpu_device_list(iterator): def format_gpu_device_list(iterator):
def get_entries(iterator): def get_entries(iterator):
for d in iterator: for d in iterator:
if d.idClass == 0x030000: if d.idClass == 0x030000:
yield ("{:04x}:{:04x}".format(d.idVendor, d.idProduct)) yield ("{:04x}:{:04x}".format(d.idVendor, d.idProduct))
return [entry for entry in get_entries(iterator)] return [entry for entry in get_entries(iterator)]
arg_specs = { arg_specs = {
'usb': dict(default=True, type='bool', required=False), 'usb': dict(default=True, type='bool', required=False),
'pci': dict(default=True, type='bool', required=False), 'pci': dict(default=True, type='bool', required=False),
'modules': dict(default=True, type='bool', required=False), 'modules': dict(default=True, type='bool', required=False),
@ -2837,7 +2836,7 @@ This section contains custom modules for the yaVDR Playbooks. They are used to c
} }
def main(): def main():
module = AnsibleModule(argument_spec=arg_specs, supports_check_mode=True,) module = AnsibleModule(argument_spec=arg_specs, supports_check_mode=True,)
collect_usb = module.params['usb'] collect_usb = module.params['usb']
collect_pci = module.params['pci'] collect_pci = module.params['pci']
@ -2864,7 +2863,7 @@ This section contains custom modules for the yaVDR Playbooks. They are used to c
module.exit_json(changed=False, ansible_facts=data, msg=data) module.exit_json(changed=False, ansible_facts=data, msg=data)
if __name__ == '__main__': if __name__ == '__main__':
main() main()
#+END_SRC #+END_SRC
** satip_facts.py ** satip_facts.py

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude"> <openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude">
<!-- Do not edit this file, it will be overwritten on install. <!-- Do not edit this file, it will be overwritten on install.
Copy the file to $HOME/.config/openbox/ instead. --> Copy the file to $HOME/.config/openbox/ instead. -->
<resistance> <resistance>
<strength>10</strength> <strength>10</strength>
@ -792,7 +792,7 @@
</application> </application>
# end of the example # end of the example
--> -->
<applications> <applications>
<application title="softhddevice"> <application title="softhddevice">
<decor>no</decor> <decor>no</decor>
@ -813,4 +813,4 @@
<skip_taskbar>yes</skip_taskbar> <skip_taskbar>yes</skip_taskbar>
</application> </application>
</applications> </applications>
</openbox_config> </openbox_config>