Merge "Add support for appending to package install lists"

This commit is contained in:
Zuul 2021-01-29 02:31:24 +00:00 committed by Gerrit Code Review
commit 20bf55629a
5 changed files with 139 additions and 61 deletions

View File

@ -1,64 +1,66 @@
rootfs_root: /mnt/rootfs
rootfs_arch: amd64
k8s_version: 1.18.6-00
ubuntu_packages:
- apt-file
- apt-utils
- apt-transport-https
- arptables
- bash-completion
- bc
- bridge-utils
- chrony
- cloud-init
- conntrack
- curl
- dnsutils
- dosfstools
- e2fsprogs
- ebtables
- ethtool
- file
- gettext-base
- gnupg2
#- grub2 # cannot install until after boot partition is available
- ifenslave
- isc-dhcp-client
- iproute2
- iptables
- iputils-arping
- iputils-ping
- iputils-tracepath
- ipvsadm
- less
- linux-image-generic # this will be reinstalled later when the boot partition is available
- live-boot
- locales
- locales-all
- lsb-release
- lsof
- man-db
- mbr
- netplan.io
- net-tools
- networkd-dispatcher # required for netplan post-up scripts
- openssh-server
- passwd
- python3
- python3-apt
- socat
- systemd
- systemd-sysv
- strace
- sudo
- tcpdump
- traceroute
- vim
- vlan
- xfsprogs
- xz-utils
repos:
- register_repo_with_rootfs: true
name: Ubuntu
packages:
- apt-file
- apt-utils
- apt-transport-https
- arptables
- bash-completion
- bc
- bridge-utils
- chrony
- cloud-init
- conntrack
- curl
- dnsutils
- dosfstools
- e2fsprogs
- ebtables
- ethtool
- file
- gettext-base
- gnupg2
#- grub2 # cannot install until after boot partition is available
- ifenslave
- isc-dhcp-client
- iproute2
- iptables
- iputils-arping
- iputils-ping
- iputils-tracepath
- ipvsadm
- less
- linux-image-generic # this will be reinstalled later when the boot partition is available
- live-boot
- locales
- locales-all
- lsb-release
- lsof
- man-db
- mbr
- netplan.io
- net-tools
- networkd-dispatcher # required for netplan post-up scripts
- openssh-server
- passwd
- python3
- python3-apt
- socat
- systemd
- systemd-sysv
- strace
- sudo
- tcpdump
- traceroute
- vim
- vlan
- xfsprogs
- xz-utils
packages: "{{ ubuntu_packages }}"
source: http://archive.ubuntu.com/ubuntu/
keyring_pkg: ubuntu-keyring
suite: focal
@ -95,9 +97,9 @@ repos:
- register_repo_with_rootfs: true
name: Kubernetes
packages:
- kubelet=1.18.6-00
- kubeadm=1.18.6-00
- kubectl=1.18.6-00
- kubelet={{ k8s_version }}
- kubeadm={{ k8s_version }}
- kubectl={{ k8s_version }}
source: https://apt.kubernetes.io
keyring_url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
suite: kubernetes-xenial

View File

@ -3,6 +3,16 @@
file: main.yaml
name: user-vars
- name: "Append any user-defined repos to multistrap list"
set_fact:
repos: "{{ repos + repos_append }}"
when: repos_append is defined
- name: "Append any user-defined pkgs to be installed from default Ubuntu mirrors"
set_fact:
ubuntu_packages: "{{ ubuntu_packages + ubuntu_packages_append }}"
when: ubuntu_packages_append is defined
- name: "ensuring directory {{ rootfs_root }} exists for rootfs"
file:
path: "{{ rootfs_root }}"

View File

@ -1 +1,48 @@
# This file will be overwritten by the container entrypoint with user-provided vars, if any are defined.
# Overrides to the playbook default variables may be defined in this file.
#
# The following are examples that show you how to override variables.
#
# Example 1: The following usage will *overwrite* the list of repos & packages
# defined under defaults/main.yaml with the list here:
#repos:
# - register_repo_with_rootfs: true
# name: Ubuntu
# packages:
# - package1
# - package2
# source: http://archive.ubuntu.com/ubuntu/
# keyring_pkg: ubuntu-keyring
# suite: focal
# components: main restricted universe
#
# You would do the above in the event you had a local or other controlled mirror
# you wanted to build the image from. In this case, you will have to redefine
# everything, including the package list(s) for each mirror.
#
# Example 2: The following usage will *append* to the list of default repos
# defined under defaults/main.yaml with the list here:
#repos_append:
# - register_repo_with_rootfs: true
# name: DellUtilsRepo
# packages:
# - package1
# - package2
# source: http://dell.utils.example.com
# keyring_pkg: ubuntu-keyring
# suite: focal
# components: main restricted universe
#
# You would do the above in the event you are happy with the default mirrors, but
# need to add another mirror that has additional third-party packages you require,
# such as may be needed for HW manufacturer utilities that are not published to
# the community Ubuntu mirrors.
#
# Example 3: The following usage will *append* to the list of default packages
# installed from the default Ubuntu mirror defined in defaults/main.yaml:
#ubuntu_packages_append:
# - package1
# - package2
#
# You would do the above if you are happy with the default mirrors, but need to
# install some additional packages from the same mirror, for example your preferred
# text editor, troubleshooting utilities, etc.

View File

@ -1,3 +1,8 @@
- name: "POST-INSTALL | Append any user-defined post-install pkgs to install list"
set_fact:
post_install_package_list: "{{ post_install_package_list + post_install_package_list_append }}"
when: post_install_package_list_append is defined
- name: "POST-INSTALL | DNS sanity check"
shell:
executable: /bin/bash

View File

@ -1 +1,15 @@
# This file will be overwritten by the container entrypoint with user-provided vars, if any are defined.
# NOTE: This file will be *overwritten* by the container entrypoint with user-provided vars, if any are defined.
#
# The following are examples that show you how to override variables.
#
# Example 1: The following usage will *overwrite* the list of packages
# defined under defaults/main.yaml with the list here:
#post_install_package_list:
# - package1
# - package2
#
# Example 2: The following usage will *append* to the list of default pkgs
# defined under defaults/main.yaml with the list here:
#post_install_package_list_append:
# - package1
# - package2