Commit edc6bc62 authored by Ophélie Gagnard's avatar Ophélie Gagnard

playbook: Add upgrade-river

parent b2b33a0c
---
dependencies:
- { role: package, package_name: fdisk, package_state: latest }
- { role: package, package_name: pip, package_state: latest }
- name: Install networkcache client
shell: pip install slapos.libnetworkcache
- name: Get target available kernel version
shell: "apt-cache policy linux-image-amd64 | grep Candidate | awk '{print $2}'"
register: target_kernel_version
- name: Convert kernel version in list format
shell: "echo {{target_kernel_version.stdout}} > /root/debug; python3 -c 'import sys; print(list(map(int, sys.argv[1].split(\"+\")[0].split(\"-\")[0].split(\".\"))))' {{target_kernel_version.stdout}}"
register: kernel_version_list_format
- name: Get EFI partition mount point
shell: fdisk -l | grep "EFI System" | awk '{print $1}'
register: efi_partition_mount_point
- name: Create image directory (if it does not exist)
shell: mkdir -p /boot/efi/EFI/Linux/
- name: Downlaod new initramfs image
shell: networkcache-download --config /etc/opt/slapos/slapos.cfg --id river "kernel-version=={{kernel_version_list_format.stdout}}" timestamp:max > /boot/efi/EFI/Linux/{{image_name}}
- name: Delete old boot option
shell: efibootmgr -b {{default_bootnum}} -B || true
- name: Set new boot option
shell: efibootmgr -b {{default_bootnum}} --create --disk {{efi_partition_mount_point.stdout}} --label "river" --loader EFI/Linux/{{image_name}}
default_bootnum: 100
image_name: river
# This is part of the OCEAN project.
# The goal of this is to download the right initramfs image from shacache
# when the kernel is upgraded.
- name: a play that runs entirely on the ansible host
hosts: 127.0.0.1
connection: local
roles:
- upgrade-river
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment