summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2020-06-15 18:21:55 +0200
committerJonathan Bauer2020-06-15 18:21:55 +0200
commit750a43d588b15a17ef5d5c4aced26370189a47fa (patch)
tree70890b2c1d543e002b1bcfeca2681b42245828f1
parent[slx-builder] fix info message (diff)
downloadansible-dracut-750a43d588b15a17ef5d5c4aced26370189a47fa.tar.gz
ansible-dracut-750a43d588b15a17ef5d5c4aced26370189a47fa.tar.xz
ansible-dracut-750a43d588b15a17ef5d5c4aced26370189a47fa.zip
[slx-builder] initial work on kernel version
-rw-r--r--slx-builder/tasks/build.yml14
-rw-r--r--slx-builder/tasks/distro/Ubuntu-18.yml4
-rw-r--r--slx-builder/tasks/install.yml14
-rw-r--r--slx-builder/tasks/kernel.yml37
-rw-r--r--slx-builder/tasks/main.yml4
-rw-r--r--slx-builder/vars/distro/CentOS-7.yml2
-rw-r--r--slx-builder/vars/distro/CentOS-8.yml2
-rw-r--r--slx-builder/vars/distro/Debian-10.yml2
-rw-r--r--slx-builder/vars/distro/Ubuntu-18.yml4
9 files changed, 73 insertions, 10 deletions
diff --git a/slx-builder/tasks/build.yml b/slx-builder/tasks/build.yml
index a0a38cd..b870745 100644
--- a/slx-builder/tasks/build.yml
+++ b/slx-builder/tasks/build.yml
@@ -1,10 +1,18 @@
---
- name: OpenSLX dracut | Build initramfs
- shell: "{{ builder_path }} -s -d -p {{ builder_target }} {{ builder_extra_args }}"
+ shell: >-
+ {{ builder_path }}
+ --debug
+ --update
+ --file-path
+ {{ builder_target }}
+ {{ builder_kernel_args }}
+ {{ builder_distro_args | default() }}
+ {{ builder_extra_args | default() }}
args:
creates: "{{ builder_target }}"
-- name: OpenSLX dracut | Retrieve initramfs and kernel (+ hack for weird /@ prefix of BOOT_IMAGE)
+- name: OpenSLX dracut | Retrieve initramfs and kernel
fetch:
src: "{{ item }}"
dest: "{{ playbook_dir }}/boot_files/"
@@ -12,7 +20,7 @@
flat: yes
with_items:
- "{{ builder_target }}"
- - "{{ ansible_cmdline.BOOT_IMAGE | regex_replace('^.*(/boot/.*)+$', '\\1') }}"
+ - "{{ builder_kernel_path }}"
- name: OpenSLX dracut | Cleanup
file:
diff --git a/slx-builder/tasks/distro/Ubuntu-18.yml b/slx-builder/tasks/distro/Ubuntu-18.yml
index 0173247..ec4fe95 100644
--- a/slx-builder/tasks/distro/Ubuntu-18.yml
+++ b/slx-builder/tasks/distro/Ubuntu-18.yml
@@ -18,3 +18,7 @@
- iputils-arping
- kexec-tools
- libkmod-dev
+ - autopoint
+ - libelf-dev
+ - libtool
+ - ntpdate
diff --git a/slx-builder/tasks/install.yml b/slx-builder/tasks/install.yml
index 2cc56d7..bff8a34 100644
--- a/slx-builder/tasks/install.yml
+++ b/slx-builder/tasks/install.yml
@@ -8,9 +8,10 @@
get_url:
url: "{{ builder_url }}"
dest: "{{ builder_path }}"
- mode: 0550
+ mode: 0650
+ force: yes
-- name: OpenSLX dracut | Get distro specific tasks
+- name: OpenSLX dracut | Include distro specific tasks
include_tasks: "{{ item }}"
with_first_found:
- "{{ role_path }}/tasks/distro/{{ ansible_distribution }}-{{ ansible_distribution_version}}.yml"
@@ -25,6 +26,13 @@
- "{{ role_path }}/vars/distro/{{ ansible_distribution }}.yml"
- name: OpenSLX dracut | Initialize repository
- shell: "{{ builder_path }} --init --debug {{ builder_extra_args }}"
+ shell: >-
+ {{ builder_path }}
+ --debug
+ --update
+ --init
+ {{ builder_kernel_args }}
+ {{ builder_distro_args | default() }}
+ {{ builder_extra_args | default() }}
args:
creates: "${{ builder_path | dirname }}/dracut/dracut.sh"
diff --git a/slx-builder/tasks/kernel.yml b/slx-builder/tasks/kernel.yml
new file mode 100644
index 0000000..ae9403a
--- /dev/null
+++ b/slx-builder/tasks/kernel.yml
@@ -0,0 +1,37 @@
+---
+# determine which kernel to build against
+# custom kernel should create a /.kernel file
+# with this content:
+#
+# version=<kernel_version>
+# path=<kernel_path>
+# src=<kernel_source>
+- name: Check if a custom kernel is specified
+ stat:
+ path: /.kernel
+ register: custom_kernel_file
+
+- name: Set the custom kernel paths
+ block:
+ - shell: awk -F= '$1 == "{{ item }}" {print $2}' /.kernel
+ register: "custom_kernel"
+ with_items:
+ - path
+ - src
+ - version
+ - set_fact:
+ builder_kernel_path: "{{ custom_kernel.results[0].stdout }}"
+ builder_kernel_source: "{{ custom_kernel.results[1].stdout }}"
+ builder_kernel_version: "{{ custom_kernel.results[2].stdout }}"
+ when: custom_kernel_file.stat.exists
+
+- name: Set the running kernel paths
+ set_fact:
+ builder_kernel_path: "{{ ansible_cmdline.BOOT_IMAGE | regex_replace('^.*(/boot/.*)+$', '\\1') }}"
+ builder_kernel_version: "{{ ansible_kernel }}"
+ builder_kernel_source: "/lib/modules/{{ ansible_kernel }}/build"
+ when: not custom_kernel_file.stat.exists
+
+- name: Set the builder kernel arguments
+ set_fact:
+ builder_kernel_args: "-k {{ builder_kernel_version }} -H {{ builder_kernel_source }}"
diff --git a/slx-builder/tasks/main.yml b/slx-builder/tasks/main.yml
index c6e690f..5ba40e1 100644
--- a/slx-builder/tasks/main.yml
+++ b/slx-builder/tasks/main.yml
@@ -1,4 +1,8 @@
---
+- import_tasks: tasks/kernel.yml
+ tags:
+ - install
+
- import_tasks: tasks/install.yml
tags:
- install
diff --git a/slx-builder/vars/distro/CentOS-7.yml b/slx-builder/vars/distro/CentOS-7.yml
index eb01547..8fff905 100644
--- a/slx-builder/vars/distro/CentOS-7.yml
+++ b/slx-builder/vars/distro/CentOS-7.yml
@@ -1 +1 @@
-builder_extra_args: "--qcow-handler xmount"
+builder_distro_args: "--qcow-handler xmount"
diff --git a/slx-builder/vars/distro/CentOS-8.yml b/slx-builder/vars/distro/CentOS-8.yml
index 8532c5e..7b39927 100644
--- a/slx-builder/vars/distro/CentOS-8.yml
+++ b/slx-builder/vars/distro/CentOS-8.yml
@@ -1,4 +1,4 @@
-builder_extra_args: >-
+builder_distro_args: >-
--override-module module_dnbd3.url=git://git.openslx.org/dnbd3-ng.git
--override-module module_dnbd3.commit=b57dadc2d
--override-module module_kernel_qcow2_linux.branch=centos-4.18.x
diff --git a/slx-builder/vars/distro/Debian-10.yml b/slx-builder/vars/distro/Debian-10.yml
index e94c37c..9bb0821 100644
--- a/slx-builder/vars/distro/Debian-10.yml
+++ b/slx-builder/vars/distro/Debian-10.yml
@@ -1 +1 @@
-builder_extra_args: "--qcow-handler kernel"
+builder_distro_args: "--qcow-handler kernel"
diff --git a/slx-builder/vars/distro/Ubuntu-18.yml b/slx-builder/vars/distro/Ubuntu-18.yml
index eb01547..8adee65 100644
--- a/slx-builder/vars/distro/Ubuntu-18.yml
+++ b/slx-builder/vars/distro/Ubuntu-18.yml
@@ -1 +1,3 @@
-builder_extra_args: "--qcow-handler xmount"
+builder_distro_args: >
+ --qcow-handler kernel
+ - --add 'slx-clock slx-addons slx-runmode slx-uuid slx-splash slx-drm'