add role for samba-install, grub-config, update network and handlers
This commit is contained in:
4
roles/grub-config/defaults/main.yml
Normal file
4
roles/grub-config/defaults/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
system:
|
||||
shutdown: poweroff
|
||||
grub:
|
||||
timeout: 0
|
7
roles/grub-config/handlers/main.yml
Normal file
7
roles/grub-config/handlers/main.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
- name: Update GRUB
|
||||
command: update-grub
|
||||
failed_when: ('error' in grub_register_update.stderr)
|
||||
register: grub_register_update
|
||||
|
||||
# TODO: Do we need to use grub-set-default?
|
||||
# https://github.com/yavdr/yavdr-utils/blob/master/events/actions/update-grub
|
16
roles/grub-config/tasks/main.yml
Normal file
16
roles/grub-config/tasks/main.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
- name: custom grub configuration for timeout and reboot halt
|
||||
template:
|
||||
src: templates/50_custom.j2
|
||||
dest: /etc/grub.d/50_custom
|
||||
mode: '0775'
|
||||
notify: [ 'Update GRUB' ]
|
||||
|
||||
# TODO: add special case if plymouth is used
|
||||
- name: let the system boot quietly
|
||||
lineinfile:
|
||||
dest: /etc/default/grub
|
||||
state: present
|
||||
regexp: '^(GRUB_CMDLINE_LINUX_DEFAULT=")'
|
||||
line: '\1{{ system.grub.boot_options}}"'
|
||||
backrefs: yes
|
||||
notify: [ 'Update GRUB' ]
|
16
roles/grub-config/templates/50-custom.j2
Normal file
16
roles/grub-config/templates/50-custom.j2
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
exec tail -n +3 $0
|
||||
|
||||
# This file is configured by the ansible configuration for yaVDR
|
||||
|
||||
{% if system.shutdown is defined and system.shutdown == 'reboot' %}
|
||||
menuentry "PowerOff" {
|
||||
halt
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
if [ "${recordfail}" = 1 ]; then
|
||||
set timeout={{ 3 if system.grub.timeout < 3 else system.grub.timeout }}
|
||||
else
|
||||
set timeout={{ system.grub.timeout if system.grub.timeout is defined else 0 }}
|
||||
fi
|
Reference in New Issue
Block a user