New "kexec" role
authorAlexander Barton <alexander.barton@tomas-daily.de>
Fri, 2 Mar 2018 13:34:54 +0000 (14:34 +0100)
committerAlexander Barton <alexander.barton@tomas-daily.de>
Fri, 2 Mar 2018 13:34:54 +0000 (14:34 +0100)
This role sets up the Linux kexec tools.

roles/kexec/defaults/main.yml [new file with mode: 0644]
roles/kexec/tasks/main.yml [new file with mode: 0644]

diff --git a/roles/kexec/defaults/main.yml b/roles/kexec/defaults/main.yml
new file mode 100644 (file)
index 0000000..be7ab6e
--- /dev/null
@@ -0,0 +1,4 @@
+---
+# defaults file for kexec
+
+kexec_use_grub_config: 'true'
diff --git a/roles/kexec/tasks/main.yml b/roles/kexec/tasks/main.yml
new file mode 100644 (file)
index 0000000..39393ec
--- /dev/null
@@ -0,0 +1,24 @@
+---
+# tasks file for kexec
+
+- name: install kexec tools
+  tags:
+    - packages
+    - kexec
+  apt: >
+    state=installed
+    name={{ item }}
+  with_items:
+    - kexec-tools
+
+- name: configure kexec tools
+  tags:
+    - kexec
+  lineinfile: >
+    insertafter='^# Load the default kernel from grub'
+    line='USE_GRUB_CONFIG={{ kexec_use_grub_config }}'
+    path=/etc/default/kexec
+    regexp='USE_GRUB_CONFIG='
+
+# kexec service/init files are run on shutdown/reboot/kexec only, so no need
+# to reload/restart any services right now.