diff options
author | Jonathan Bauer | 2018-08-21 13:52:53 +0200 |
---|---|---|
committer | Jonathan Bauer | 2018-08-21 13:52:53 +0200 |
commit | 0be73fee39dad71d2efb34abaddfa6f66c772dbd (patch) | |
tree | 0db35446f63d3e3c9fa87a6e6fcc78d53992b5ba /slx-builder | |
parent | [dracut-initramfs-builder] add kmod headers to fulfill dracut v47 (diff) | |
download | ansible-dracut-0be73fee39dad71d2efb34abaddfa6f66c772dbd.tar.gz ansible-dracut-0be73fee39dad71d2efb34abaddfa6f66c772dbd.tar.xz ansible-dracut-0be73fee39dad71d2efb34abaddfa6f66c772dbd.zip |
renamed 'dracut-initramfs-builder' to 'slx-builder'
same with the playbook including this role
Diffstat (limited to 'slx-builder')
-rw-r--r-- | slx-builder/meta/main.yml | 4 | ||||
-rw-r--r-- | slx-builder/tasks/distro.yml | 32 | ||||
-rw-r--r-- | slx-builder/tasks/dnbd3-fixes.yml | 17 | ||||
-rw-r--r-- | slx-builder/tasks/main.yml | 34 | ||||
-rw-r--r-- | slx-builder/vars/main.yml | 2 |
5 files changed, 89 insertions, 0 deletions
diff --git a/slx-builder/meta/main.yml b/slx-builder/meta/main.yml new file mode 100644 index 0000000..bfd43d5 --- /dev/null +++ b/slx-builder/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - { role: setup-dev-tools } + - { role: disable-selinux, when: ansible_os_family == 'RedHat' } diff --git a/slx-builder/tasks/distro.yml b/slx-builder/tasks/distro.yml new file mode 100644 index 0000000..2cc6f0c --- /dev/null +++ b/slx-builder/tasks/distro.yml @@ -0,0 +1,32 @@ +--- +- set_fact: + pkgnames: + - kernel-devel + - fuse-devel + - jansson-devel + - glib2-devel + - pixman-devel + - libewf-devel + - afflib-devel + - device-mapper + - wget + - systemd-networkd + - systemd-resolved + - kexec-tools + - kmod-devel + when: + - ansible_distribution == "CentOS" +- set_fact: + pkgnames: + - libfuse-dev + - libglib2.0-dev + - libpixman-1-dev + - libewf-dev + - libafflib-dev + - libjansson-dev + - dmsetup + - iputils-arping + - kexec-tools + - libkmod-dev + when: + - ansible_distribution == "Ubuntu" diff --git a/slx-builder/tasks/dnbd3-fixes.yml b/slx-builder/tasks/dnbd3-fixes.yml new file mode 100644 index 0000000..e9bd6dd --- /dev/null +++ b/slx-builder/tasks/dnbd3-fixes.yml @@ -0,0 +1,17 @@ +--- +- name: Hack fix dnbd3 blk.c for Ubuntu newer kernels + replace: + dest: "{{ gittarget }}/builder/modules.d/dnbd3-rootfs/scripts/build.sh" + regexp: 'make -j4 dnbd3 dnbd3-client' + replace: 'sed -i "s/backing_dev_info.ra_pages/backing_dev_info->ra_pages/g" blk.c && make -j4 dnbd3 dnbd3-client' + backup: yes + when: + - ansible_distribution == "Ubuntu" +- name: Hack fix dnbd3 blk.h for CentOS kernels with backports + replace: + dest: "{{ gittarget }}/builder/modules.d/dnbd3-rootfs/scripts/build.sh" + regexp: 'make -j4 dnbd3 dnbd3-client' + replace: 'sed -i "s/KERNEL_VERSION.*/KERNEL_VERSION\(3, 10, 0\)/g" blk.h && make -j4 dnbd3 dnbd3-client' + backup: yes + when: + - ansible_distribution == "CentOS" diff --git a/slx-builder/tasks/main.yml b/slx-builder/tasks/main.yml new file mode 100644 index 0000000..fe64b37 --- /dev/null +++ b/slx-builder/tasks/main.yml @@ -0,0 +1,34 @@ +--- +- include: tasks/distro.yml + +- name: Install dependencies for OpenSLX dracut module + package: name={{ item }} state=installed + with_items: "{{ pkgnames }}" + +- name: Checkout repository of OpenSLX dracut module + git: + repo: "{{ gitsource }}" + dest: "{{ gittarget }}" + depth: 1 + +- include: tasks/dnbd3-fixes.yml + +- name: Build initramfs with dracut + shell: "{{ gittarget }}/builder/build-initramfs.sh -s -d -p {{ gittarget }}/initramfs - --add 'kexec-reboot'" + args: + creates: "{{ gittarget }}/initramfs" + +- name: Fetch built initramfs and kernel (+ hack for weird /@ prefix of BOOT_IMAGE) + fetch: + src: "{{ item }}" + dest: "{{ playbook_dir }}/boot_files/" + fail_on_missing: yes + flat: yes + with_items: + - "{{ gittarget }}/initramfs" + - "{{ ansible_cmdline.BOOT_IMAGE | regex_replace('^/@(/boot/.*)+$', '\\1') }}" + +- name: Cleanup + file: + path: "{{ gittarget }}" + state: absent diff --git a/slx-builder/vars/main.yml b/slx-builder/vars/main.yml new file mode 100644 index 0000000..e8f7c48 --- /dev/null +++ b/slx-builder/vars/main.yml @@ -0,0 +1,2 @@ +gitsource: "git://git.openslx.org/openslx-ng/systemd-init" +gittarget: "/opt/systemd-init" |