Fix indentations

This commit is contained in:
Alexander Grothe 2017-03-02 09:06:19 +01:00
parent 5219bdc4e5
commit 54c7d091fd
6 changed files with 160 additions and 187 deletions

View File

@ -218,15 +218,16 @@ vdr:
yavdr-common executes the following tasks:
**** main.yml
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/main.yml :exports none :mkdirp yes
---
# This playbook sets up the basic packages an directories for a yaVDR installation
# file: roles/yavdr-common/tasks/main.yml
---
# This playbook sets up the basic packages an directories for a yaVDR installation
# file: roles/yavdr-common/tasks/main.yml
#+END_SRC
***** Disable default installation of recommended packages
This task prevents apt to automatically install all recommended dependencies for packages:
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/main.yml :mkdirp yes
- name: apt | prevent automatic installation of recommended packages
- name: apt | prevent automatic installation of recommended packages
template:
src: templates/90-norecommends.j2
dest: /etc/apt/apt.conf.d/90norecommends
@ -234,21 +235,21 @@ yavdr-common executes the following tasks:
#+END_SRC
***** Setting up the package repositories
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/main.yml :mkdirp yes
- name: add yaVDR PPAs
- name: add yaVDR PPAs
apt_repository:
repo: '{{ item }}'
state: present
update_cache: yes
with_items: '{{ repositories }}'
- name: upgrade existing packages
- name: upgrade existing packages
apt:
upgrade: dist
update_cache: yes
#+END_SRC
***** Installing essential packages
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/main.yml :mkdirp yes
- name: apt | install basic packages
- name: apt | install basic packages
apt:
name: '{{ item }}'
state: present
@ -267,38 +268,31 @@ yavdr-common executes the following tasks:
- wpasupplicant
- usbutils
- xfsprogs
#+END_SRC
***** install and execute local fact scripts
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/main.yml :mkdirp yes
- name: install and execute local fact scripts
- include:
- tasks/local_facts.yml
#+END_SRC
**** local_facts.yml
#+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/main.yml :exports none :mkdirp yes
---
# file: local_facts.yml
- name: create directory for local facts
- name: create directory for local facts
file:
dest: /etc/ansible/facts.d
state: directory
- name: copy facts script for USB- and PCI(e)-IDs
- name: copy facts script for USB- and PCI(e)-IDs
copy:
src: files/hardware.facts.py
dest: /etc/ansible/facts.d/hardware.facts
mode: '0775'
- name: copy facts script for Sat>IP server detection
- name: copy facts script for Sat>IP server detection
copy:
src: files/satip.facts.py
dest: /etc/ansible/facts.d/satip.facts
mode: '0775'
- name: reload ansible local facts
- name: reload ansible local facts
setup: filter=ansible_local
#+END_SRC
*** files:
#+BEGIN_SRC python :tangle roles/yavdr-common/files/hardware.facts.py :mkdirp yes
#!/usr/bin/env python3
@ -387,10 +381,10 @@ APT::Install-Suggests "0";
*** tasks
**** install the basic vdr packages
#+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes
---
# file: roles/vdr/tasks/main.yml
---
# file: roles/vdr/tasks/main.yml
- name: apt | install basic vdr packages
- name: apt | install basic vdr packages
apt:
name: '{{ item }}'
state: present
@ -402,13 +396,13 @@ APT::Install-Suggests "0";
#+END_SRC
**** Add svdrp/svdrp-disc to /etc/services
#+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes
- name: add svdrp to /etc/services
- name: add svdrp to /etc/services
lineinfile:
dest: /etc/services
state: present
line: "svdrp 6419/tcp"
- name: add svdrp-disc to /etc/services
- name: add svdrp-disc to /etc/services
lineinfile:
dest: /etc/services
state: present
@ -416,7 +410,7 @@ APT::Install-Suggests "0";
#+END_SRC
**** Set up the recording directory for the vdr user
#+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes
- name: create vdr recdir
- name: create vdr recdir
file:
state: directory
owner: '{{ vdr.user }}'
@ -424,7 +418,7 @@ APT::Install-Suggests "0";
mode: 0775
dest: '{{ vdr.recdir }}'
- name: set option to use hide-first-recording-level patch
- name: set option to use hide-first-recording-level patch
blockinfile:
dest: /etc/vdr/conf.d/04-vdr-hide-first-recordinglevel.conf
create: true
@ -434,7 +428,7 @@ APT::Install-Suggests "0";
when:
vdr.hide_first_recording_level
- name: create local dir in recdir
- name: create local dir in recdir
file:
state: directory
owner: '{{ vdr.user }}'
@ -447,7 +441,7 @@ APT::Install-Suggests "0";
**** Install additional vdr plugins
The additional plugins to install can be set in the variable ~{{vdr_plugins}}~ in the group variables
#+BEGIN_SRC yaml :tangle roles/vdr/tasks/main.yml :mkdirp yes
- name: install additional vdr plugins
- name: install additional vdr plugins
apt:
name: '{{ item }}'
state: present
@ -541,12 +535,12 @@ After=x@vt7.service
Wants=x@vt7.service
BindsTo=x@vt7.service
#+END_SRC
#+BEGIN_SRC sh :tangle roles/yavdr-xorg/templates/.xinitrc.j2 :mkdirp yes
#+BEGIN_SRC shell :tangle roles/yavdr-xorg/templates/.xinitrc.j2 :mkdirp yes
#!/bin/bash
# {{ ansible_managed_file }}
exec openbox-session
#+END_SRC
#+BEGIN_SRC sh tangle: ansible/yavdr-ansible/roles/yavdr-xorg/templates/autostart.j2 :mkdirp yes
#+BEGIN_SRC shell tangle: ansible/yavdr-ansible/roles/yavdr-xorg/templates/autostart.j2 :mkdirp yes
env | grep "DISPLAY\|DBUS_SESSION_BUS_ADDRESS\|XDG_RUNTIME_DIR" > ~/.session-env
systemctl --user import-environment
#+END_SRC
@ -787,7 +781,7 @@ system:
notify: [ 'Update GRUB' ]
#+END_SRC
*** templates
#+BEGIN_SRC sh :tangle roles/grub-config/templates/50-custom.j2 :mkdirp yes
#+BEGIN_SRC shell :tangle roles/grub-config/templates/50_custom.j2 :mkdirp yes
#!/bin/sh
exec tail -n +3 $0

View File

@ -13,7 +13,7 @@ drivers:
sundtek: auto
ddvb-dkms: auto
extra_packages:
extra_packages:
- vim
- tree
- w-scan

View File

@ -1,19 +1,19 @@
#!/usr/bin/env python3
# This script sends a multicast message and awaits responses by Sat>IP servers.
# returns the boolean variable 'satip_detected' as json
import json
import socket
import sys
import time
#!/usr/bin/env python3
# This script sends a multicast message and awaits responses by Sat>IP servers.
# returns the boolean variable 'satip_detected' as json
import json
import socket
import sys
import time
SSDP_ADDR = "239.255.255.250"
SSDP_PORT = 1900
# SSDP_MX = max delay for server response
# a value of 2s is recommended by the SAT>IP specification 1.2.2
SSDP_MX = 2
SSDP_ST = "urn:ses-com:device:SatIPServer:1"
SSDP_ADDR = "239.255.255.250"
SSDP_PORT = 1900
# SSDP_MX = max delay for server response
# a value of 2s is recommended by the SAT>IP specification 1.2.2
SSDP_MX = 2
SSDP_ST = "urn:ses-com:device:SatIPServer:1"
ssdpRequest = "\r\n".join((
ssdpRequest = "\r\n".join((
"M-SEARCH * HTTP/1.1",
"HOST: %s:%d" % (SSDP_ADDR, SSDP_PORT),
"MAN: \"ssdp:discover\"",
@ -21,23 +21,23 @@ ssdpRequest = "\r\n".join((
"ST: %s" % (SSDP_ST),
"\r\n"))
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# according to Sat>IP Specification 1.2.2, p. 20
# a client should send three requests within 100 ms with a ttl of 2
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2)
sock.settimeout(SSDP_MX + 0.5)
for _ in range(3):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# according to Sat>IP Specification 1.2.2, p. 20
# a client should send three requests within 100 ms with a ttl of 2
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2)
sock.settimeout(SSDP_MX + 0.5)
for _ in range(3):
sock.sendto(ssdpRequest.encode('ascii'), (SSDP_ADDR, SSDP_PORT))
time.sleep(0.03)
try:
try:
response = sock.recv(1000).decode()
if response and "SERVER:" in response:
got_response = True
else:
raise ValueError('No satip server detected')
except (socket.timeout, ValueError):
except (socket.timeout, ValueError):
got_response = False
finally:
finally:
print(json.dumps(
{'satip_detected': got_response}
))

View File

@ -1,15 +0,0 @@
---
# file: local_facts.yml
- name: create directory for local facts
file:
dest: /etc/ansible/facts.d
state: directory
- name: copy facts script for USB- and PCI(e)-IDs
copy:
src: files/hardware.facts.py
dest: /etc/ansible/facts.d/hardware.facts
mode: '0775'
- name: get local facts
setup:

View File

@ -1,4 +1,5 @@
---
# This playbook sets up the basic packages an directories for a yaVDR installation
# file: roles/yavdr-common/tasks/main.yml
@ -39,13 +40,6 @@
- usbutils
- xfsprogs
- name: install and execute local fact scripts
- include:
- tasks/local_facts.yml
---
# file: local_facts.yml
- name: create directory for local facts
file:
dest: /etc/ansible/facts.d