From 4170935a5aa60a782585ad8beb3369a02f94fb25 Mon Sep 17 00:00:00 2001 From: Alexander Grothe Date: Fri, 3 Aug 2018 10:32:02 +0200 Subject: [PATCH] use debconf module instead of shell command --- Manual.org | 23 +++++++++++++++---- roles/grub-config/handlers/main.yml | 5 ++++ roles/yavdr-common/tasks/configure_system.yml | 23 +++++++++++++++---- 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/Manual.org b/Manual.org index 63bebe9..12df9ea 100644 --- a/Manual.org +++ b/Manual.org @@ -462,10 +462,25 @@ yavdr-common executes the following tasks: #+END_SRC ***** Use bash instead of dash #+BEGIN_SRC yaml :tangle roles/yavdr-common/tasks/configure_system.yml :mkdirp yes -- name: use bash instead of dash - shell: | - echo "set dash/sh false" | debconf-communicate - dpkg-reconfigure -f noninteractive dash +#- name: use bash instead of dash +# shell: | +# echo "set dash/sh false" | debconf-communicate +# dpkg-reconfigure -f noninteractive dash + +- name: ensure debconf and debconf-utils are installed + apt: + name: "{{ packages }}" + vars: + packages: + - debconf + - debconf-utils + +- name: use bash instead of dash by default + debconf: + name: dash + question: dash/sh + value: 'false' + vtype: select #+END_SRC ***** create user vdr diff --git a/roles/grub-config/handlers/main.yml b/roles/grub-config/handlers/main.yml index b6d741c..21185fc 100644 --- a/roles/grub-config/handlers/main.yml +++ b/roles/grub-config/handlers/main.yml @@ -1,5 +1,10 @@ --- +- name: Update Initramfs + command: "update-initramfs -u" + failed_when: ('error' in initramfs_register_update.stderr) + register: initramfs_register_update + - name: Update GRUB command: update-grub failed_when: ('error' in grub_register_update.stderr) diff --git a/roles/yavdr-common/tasks/configure_system.yml b/roles/yavdr-common/tasks/configure_system.yml index da3184f..ea00d1e 100644 --- a/roles/yavdr-common/tasks/configure_system.yml +++ b/roles/yavdr-common/tasks/configure_system.yml @@ -1,7 +1,22 @@ -- name: use bash instead of dash - shell: | - echo "set dash/sh false" | debconf-communicate - dpkg-reconfigure -f noninteractive dash +#- name: use bash instead of dash +# shell: | +# echo "set dash/sh false" | debconf-communicate +# dpkg-reconfigure -f noninteractive dash + +- name: ensure debconf and debconf-utils are installed + apt: + name: "{{ packages }}" + vars: + packages: + - debconf + - debconf-utils + +- name: use bash instead of dash by default + debconf: + name: dash + question: dash/sh + value: 'false' + vtype: select - name: create vdr group group: gid: '{{ vdr.gid }}'