From 85a821af075d5edd19a813bdf78549271afed14b Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 19 May 2021 10:13:49 +0200 Subject: [mltk-*] update core mltk roles --- TODO | 3 -- .../disable-distro-kernel-updates.pref | 11 ++++++ mltk-bwlp/files/etc/profile.d/00-slx-env.sh | 1 + mltk-bwlp/tasks/distro.yml | 15 -------- mltk-bwlp/tasks/main.yml | 38 ++++++++++++++++---- mltk-bwlp/templates/kernel.j2 | 3 ++ mltk-core/defaults/main.yml | 6 ++++ mltk-core/tasks/distro/Ubuntu-20.yml | 13 +++++++ mltk-core/tasks/main.yml | 41 ++++++++++++++++++++-- mltk-core/tasks/repo.yml | 5 --- mltk-core/templates/mltk-config.j2 | 4 +++ .../templates/pin-xalt7x-chromium-deb-vaapi.j2 | 3 ++ mltk-nvidia/tasks/main.yml | 2 +- 13 files changed, 113 insertions(+), 32 deletions(-) delete mode 100644 TODO create mode 100644 mltk-bwlp/files/etc/apt/preferences.d/disable-distro-kernel-updates.pref create mode 100644 mltk-bwlp/files/etc/profile.d/00-slx-env.sh delete mode 100644 mltk-bwlp/tasks/distro.yml create mode 100644 mltk-bwlp/templates/kernel.j2 create mode 100644 mltk-core/defaults/main.yml create mode 100644 mltk-core/tasks/distro/Ubuntu-20.yml delete mode 100644 mltk-core/tasks/repo.yml create mode 100644 mltk-core/templates/mltk-config.j2 create mode 100644 mltk-core/templates/pin-xalt7x-chromium-deb-vaapi.j2 diff --git a/TODO b/TODO deleted file mode 100644 index 1d1651d..0000000 --- a/TODO +++ /dev/null @@ -1,3 +0,0 @@ -** Configurable kernel version for mltk's kernel-vanilla module -* Native Linux desktop environments -* Configuration thereof for bwLehrpool purposes diff --git a/mltk-bwlp/files/etc/apt/preferences.d/disable-distro-kernel-updates.pref b/mltk-bwlp/files/etc/apt/preferences.d/disable-distro-kernel-updates.pref new file mode 100644 index 0000000..9cae92d --- /dev/null +++ b/mltk-bwlp/files/etc/apt/preferences.d/disable-distro-kernel-updates.pref @@ -0,0 +1,11 @@ +Package: linux-generic +Pin: release o=Ubuntu +Pin-Priority: 1 + +Package: linux-image-generic +Pin: release o=Ubuntu +Pin-Priority: 1 + +Package: linux-headers-generic +Pin: release o=Ubuntu +Pin-Priority: 1 diff --git a/mltk-bwlp/files/etc/profile.d/00-slx-env.sh b/mltk-bwlp/files/etc/profile.d/00-slx-env.sh new file mode 100644 index 0000000..0991c7e --- /dev/null +++ b/mltk-bwlp/files/etc/profile.d/00-slx-env.sh @@ -0,0 +1 @@ +export PATH="$PATH:/opt/openslx/sbin:/opt/openslx/bin" diff --git a/mltk-bwlp/tasks/distro.yml b/mltk-bwlp/tasks/distro.yml deleted file mode 100644 index 1db174d..0000000 --- a/mltk-bwlp/tasks/distro.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# TODO other distros if needed -- set_fact: - pkgnames: - - build-essential - - automake - - cmake - - lsof - - m4 - - rsync - - pkg-config - - xserver-xorg - when: - - ansible_distribution == "Ubuntu" -# TODO QT diff --git a/mltk-bwlp/tasks/main.yml b/mltk-bwlp/tasks/main.yml index e6e7cf7..55cffcd 100644 --- a/mltk-bwlp/tasks/main.yml +++ b/mltk-bwlp/tasks/main.yml @@ -1,11 +1,37 @@ --- -- import_tasks: tasks/distro.yml - - name: mltk | Install dependencies package: - name: "{{ item }}" + name: "{{ mltk_deps }}" state: present - with_items: "{{ pkgnames }}" + vars: + mltk_deps: + - build-essential + - automake + - cmake + - lsof + - m4 + - rsync + - pkg-config + - xserver-xorg + +- name: mltk | Process kernel version if specified + replace: + path: "{{ mltk_git_target }}/core/modules/kernel-vanilla/module.conf" + regexp: '^(REQUIRED_KERNEL=).*' + replace: '\1"{{ kernel_version }}"' + when: kernel_version is defined + +- name: mltk | Build and install stage4-bwlp target + shell: "{{ mltk_git_target }}/mltk stage4 -b -i" + +- name: mltk | Save kernel to /.kernel + template: + src: "templates/kernel.j2" + dest: "/.kernel" + when: kernel_version is defined -- name: mltk | Build and install bwlp target - shell: "{{ mltk_git_target }}/mltk bwlp -b -i" +- name: Copy static files + copy: + src: files/ + dest: / + become: yes diff --git a/mltk-bwlp/templates/kernel.j2 b/mltk-bwlp/templates/kernel.j2 new file mode 100644 index 0000000..57e5dc1 --- /dev/null +++ b/mltk-bwlp/templates/kernel.j2 @@ -0,0 +1,3 @@ +version={{ kernel_version }}-openslx+ +path={{ mltk_git_target }}/var/builds/kernel/kernel +src={{ mltk_git_target }}/tmp/work/kernel/ksrc diff --git a/mltk-core/defaults/main.yml b/mltk-core/defaults/main.yml new file mode 100644 index 0000000..9441637 --- /dev/null +++ b/mltk-core/defaults/main.yml @@ -0,0 +1,6 @@ +mltk_git_source: "git://git.openslx.org/openslx-ng/mltk" +mltk_git_target: "/opt/build-env/mltk" +mltk_git_branch: "installer" +mltk_nvidia_versions: "390.143 460.73.01" +mltk_vmware_version: "16.1.1" +mltk_vbox_version: "6.1.22" diff --git a/mltk-core/tasks/distro/Ubuntu-20.yml b/mltk-core/tasks/distro/Ubuntu-20.yml new file mode 100644 index 0000000..23b1219 --- /dev/null +++ b/mltk-core/tasks/distro/Ubuntu-20.yml @@ -0,0 +1,13 @@ +- name: Add PPA chromium repo for Ubuntu 20.x + apt_repository: + repo: ppa:xalt7x/chromium-deb-vaapi + +- name: Pin release + template: + src: templates/pin-xalt7x-chromium-deb-vaapi.j2 + dest: /etc/apt/preferences.d/pin-xalt7x-chromium-deb-vaapi + +- name: Run apt update + apt: + update_cache: yes + diff --git a/mltk-core/tasks/main.yml b/mltk-core/tasks/main.yml index 95a7cd7..8440943 100644 --- a/mltk-core/tasks/main.yml +++ b/mltk-core/tasks/main.yml @@ -1,6 +1,4 @@ --- -- import_tasks: tasks/repo.yml - - name: mltk | Install git package: name: git @@ -11,4 +9,43 @@ repo: "{{ mltk_git_source }}" dest: "{{ mltk_git_target }}" version: "{{ mltk_git_branch }}" + force: yes + update: yes depth: 1 + +- name: mltk | Create mltk configuration file + template: + src: templates/mltk-config.j2 + dest: "{{ mltk_git_target }}/config" + +- name: mltk | Patch virtualbox version + replace: + path: "{{ mltk_git_target }}/core/modules/vbox-src/module.conf" + regexp: '^(REQUIRED_VBOX_VERSION=).*' + replace: '\g<1>{{ mltk_vbox_version }}' + +- name: mltk | Patch vmware16 version + replace: + path: "{{ mltk_git_target }}/core/modules/vmware16/module.conf" + regexp: '^(REQUIRED_VERSION=).*' + replace: '\g<1>{{ mltk_vmware_version }}' + +- name: mltk | HACKS patch packagemanager.inc to prevent installing recommended packages + replace: + path: "{{ mltk_git_target }}/core/includes/packagemanager.inc" + regexp: '(apt-get install) (-y \${PKG})' + replace: '\1 --no-install-recommends \2' + +- name: mltk | HACKS patch chroot.inc to include the build environment mount point + replace: + path: "{{ mltk_git_target }}/core/includes/chroot.inc" + regexp: '^(declare -rg CHROOT_BINDMOUNTS=")(/dev[^"]+")' + replace: '\1/opt/build-env \2' + +- name: mltk | Distro-specific tasks + include_tasks: "{{ item }}" + with_first_found: + - "{{ role_path }}/tasks/distro/{{ ansible_distribution }}-{{ ansible_distribution_version}}.yml" + - "{{ role_path }}/tasks/distro/{{ ansible_distribution }}-{{ ansible_distribution_major_version}}.yml" + - "{{ role_path }}/tasks/distro/{{ ansible_distribution }}.yml" + ignore_errors: yes diff --git a/mltk-core/tasks/repo.yml b/mltk-core/tasks/repo.yml deleted file mode 100644 index b16f97a..0000000 --- a/mltk-core/tasks/repo.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- set_fact: - mltk_git_source: "git://git.openslx.org/openslx-ng/mltk" - mltk_git_target: "/opt/mltk" - mltk_git_branch: "installer" diff --git a/mltk-core/templates/mltk-config.j2 b/mltk-core/templates/mltk-config.j2 new file mode 100644 index 0000000..d3334cc --- /dev/null +++ b/mltk-core/templates/mltk-config.j2 @@ -0,0 +1,4 @@ +export http_proxy=http://132.230.4.234:8123/ +sourceforge_mirror=netcologne + +NVIDIA_VERSIONS="{{ mltk_nvidia_versions }}" diff --git a/mltk-core/templates/pin-xalt7x-chromium-deb-vaapi.j2 b/mltk-core/templates/pin-xalt7x-chromium-deb-vaapi.j2 new file mode 100644 index 0000000..7adc90d --- /dev/null +++ b/mltk-core/templates/pin-xalt7x-chromium-deb-vaapi.j2 @@ -0,0 +1,3 @@ +Package: * +Pin: release o=LP-PPA-xalt7x-chromium-deb-vaapi +Pin-Priority: 1337 diff --git a/mltk-nvidia/tasks/main.yml b/mltk-nvidia/tasks/main.yml index cc55bac..da36344 100644 --- a/mltk-nvidia/tasks/main.yml +++ b/mltk-nvidia/tasks/main.yml @@ -1,3 +1,3 @@ --- - name: mltk | Build and install nvidia target - shell: "{{ mltk_git_target }}/mltk nvidia-libs@NVIDIA_VERSIONS -b -i" + shell: "{{ mltk_git_target }}/mltk nvidia-libs@NVIDIA_VERSIONS -b -i -d" \ No newline at end of file -- cgit v1.2.3-55-g7522