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
****** rc.xml
#+BEGIN_SRC xml :tangle roles/yavdr-xorg/templates/openbox_rc.xml.j2 :mkdirp yes :padline no
<?xml version="1.0" encoding="UTF-8"?>
<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.
<?xml version="1.0" encoding="UTF-8"?>
<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.
Copy the file to $HOME/.config/openbox/ instead. -->
<resistance>
<strength>10</strength>
@ -2075,7 +2075,7 @@ systemctl --user isolate yavdr-desktop.target
</application>
# end of the example
-->
-->
<applications>
<application title="softhddevice">
<decor>no</decor>
@ -2096,7 +2096,7 @@ systemctl --user isolate yavdr-desktop.target
<skip_taskbar>yes</skip_taskbar>
</application>
</applications>
</openbox_config>
</openbox_config>
#+END_SRC
** 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.
*** tasks
#+BEGIN_SRC yaml :tangle roles/autoinstall-ubuntu-drivers/tasks/main.yml
---
# file roles/autoinstall-ubuntu-drivers/tasks/main.yml
- name: apt | install ubuntu-drivers-common
---
# file roles/autoinstall-ubuntu-drivers/tasks/main.yml
- name: apt | install ubuntu-drivers-common
apt:
name: ubuntu-drivers-common
state: present
- name: ensure /etc/yavdr exists
- name: ensure /etc/yavdr exists
file:
path: /etc/yavdr
state: directory
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
#+END_SRC
** 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.
** 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.
DOCUMENTATION = '''
# 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
@ -2774,42 +2773,42 @@ This section contains custom modules for the yaVDR Playbooks. They are used to c
default: True
description:
- return a list of devices of the pci gpu class (0x030000)
notes:
notes:
- requres python-pyusb and python-kmodpy
requirements: [ ]
author: "Alexander Grothe <seahawk1986@gmx.de>"
'''
requirements: [ ]
author: "Alexander Grothe <seahawk1986@gmx.de>"
'''
EXAMPLES = '''
- name: get information about usb and pci hardware and loaded kernel modules
EXAMPLES = '''
- name: get information about usb and pci hardware and loaded kernel modules
hardware_facts:
usb: True
pci: True
modules: True
- debug:
- debug:
var: usb
- debug
- debug
var: pci
- debug
- debug
var: modules
- debug
- 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():
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)
@ -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)
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]
def format_gpu_device_list(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 = {
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),
@ -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,)
collect_usb = module.params['usb']
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)
if __name__ == '__main__':
if __name__ == '__main__':
main()
#+END_SRC
** 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.
DOCUMENTATION = '''
# 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
@ -32,42 +32,42 @@
default: True
description:
- return a list of devices of the pci gpu class (0x030000)
notes:
notes:
- requres python-pyusb and python-kmodpy
requirements: [ ]
author: "Alexander Grothe <seahawk1986@gmx.de>"
'''
requirements: [ ]
author: "Alexander Grothe <seahawk1986@gmx.de>"
'''
EXAMPLES = '''
- name: get information about usb and pci hardware and loaded kernel modules
EXAMPLES = '''
- name: get information about usb and pci hardware and loaded kernel modules
hardware_facts:
usb: True
pci: True
modules: True
- debug:
- debug:
var: usb
- debug
- debug
var: pci
- debug
- debug
var: modules
- debug
- 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():
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)
@ -77,17 +77,17 @@
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):
def format_device_list(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):
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 = {
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),
@ -95,7 +95,7 @@
}
def main():
def main():
module = AnsibleModule(argument_spec=arg_specs, supports_check_mode=True,)
collect_usb = module.params['usb']
collect_pci = module.params['pci']
@ -122,5 +122,5 @@
module.exit_json(changed=False, ansible_facts=data, msg=data)
if __name__ == '__main__':
if __name__ == '__main__':
main()

View File

@ -1,16 +1,15 @@
---
# file roles/autoinstall-ubuntu-drivers/tasks/main.yml
- name: apt | install ubuntu-drivers-common
---
# file roles/autoinstall-ubuntu-drivers/tasks/main.yml
- name: apt | install ubuntu-drivers-common
apt:
name: ubuntu-drivers-common
state: present
- name: ensure /etc/yavdr exists
- name: ensure /etc/yavdr exists
file:
path: /etc/yavdr
state: directory
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

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.
<?xml version="1.0" encoding="UTF-8"?>
<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.
Copy the file to $HOME/.config/openbox/ instead. -->
<resistance>
<strength>10</strength>
@ -792,7 +792,7 @@
</application>
# end of the example
-->
-->
<applications>
<application title="softhddevice">
<decor>no</decor>
@ -813,4 +813,4 @@
<skip_taskbar>yes</skip_taskbar>
</application>
</applications>
</openbox_config>
</openbox_config>