Add role to install nfs-server, cleanup roles and configuration

- use generic media_dirs including vdr recdir, loop over them to
  create directories, configure samba, nfs, etc.
- add role to install an configure nfs-kernel-server
- cleanup roles
- add custom fact modules
This commit is contained in:
Alexander Grothe
2017-03-13 10:40:35 +01:00
parent d6647e1613
commit 10c3d12215
16 changed files with 385 additions and 81 deletions

View File

@@ -1,5 +1,5 @@
system:
shutdown: poweroff
grub:
timeout: 0
boot_options: quiet nosplash
grub:
timeout: 0
boot_options: quiet nosplash

View File

@@ -11,6 +11,6 @@
dest: /etc/default/grub
state: present
regexp: '^(GRUB_CMDLINE_LINUX_DEFAULT=")'
line: '\1{{ system.grub.boot_options}}"'
line: '\1{{ grub.boot_options}}"'
backrefs: yes
notify: [ 'Update GRUB' ]

View File

@@ -10,7 +10,7 @@ menuentry "PowerOff" {
{% endif %}
if [ "${recordfail}" = 1 ]; then
set timeout={{ 3 if system.grub.timeout < 3 else system.grub.timeout }}
set timeout={{ 3 if grub.timeout < 3 else grub.timeout }}
else
set timeout={{ system.grub.timeout if system.grub.timeout is defined else 0 }}
set timeout={{ grub.timeout if grub.timeout is defined else 0 }}
fi

View File

@@ -0,0 +1,14 @@
- name: install nfs server packages
apt:
name: '{{ item }}'
state: present
install_recommends: no
with_items:
- nfs-kernel-server
- nfs-common
- name: create /etc/exports
template:
src: templates/nfs-exports.j2
dest: /etc/exports
notify: [ 'Restart NFS Kernel Server' ]

View File

@@ -0,0 +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 %}

View File

@@ -0,0 +1,3 @@
samba:
workgroup: YAVDR
windows_compatible: true # disable unix extensions, enable follow symlinks and wide links

View File

@@ -3,7 +3,7 @@
# TODO:
#- name: divert original smbd.conf
- name: create smb.conf.custom
- name: touch smb.conf.custom
file:
state: touch
dest: '/etc/samba/smb.conf.custom'

View File

@@ -71,11 +71,17 @@
# to anonymous connections
map to guest = bad user
{% if samba.windows_compatible %}
# disable unix extensions and enable following symlinks
unix extensions = no
follow symlinks= yes
wide links= yes
{% endif %}
{% for name, path in media_dirs.iteritems() %}
[{{ name }}]
path = {{ path }}
comment = {{ name }} on %h
browseable = yes
guest ok = yes
writeable = yes
browseable = yes

View File

@@ -58,16 +58,3 @@
install_recommends: no
with_items:
'{{ vdr_plugins | default({}) }}'
- name: create directories for media files
file:
state: directory
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
mode: 0777
dest: '{{ item }}'
with_items:
- /srv/videos
- /srv/music
- /srv/picture
- /srv/backups

View File

@@ -56,6 +56,23 @@
- usbutils
- xfsprogs
- name: apt | install extra packages
apt:
name: '{{ item }}'
state: present
install_recommends: no
with_items:
'{{ extra_packages }}'
- name: create media directories
file:
dest: '{{ item.value }}'
owner: '{{ vdr.user }}'
group: '{{ vdr.group }}'
state: directory
mode: '0777'
with_dict: '{{ media_dirs }}'
- name: get information about usb and pci hardware and loaded kernel modules
hardware_facts:
usb: True