[lxc-devel] [distrobuilder/master] doc/examples: Update Ubuntu example

monstermunchkin on Github lxc-bot at linuxcontainers.org
Mon Jun 29 09:46:06 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 384 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200629/3a6710f9/attachment-0001.bin>
-------------- next part --------------
From 64c12d04f1d699cefeab9d72edef43a9f03b8282 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Mon, 29 Jun 2020 11:04:48 +0200
Subject: [PATCH] doc/examples: Update Ubuntu example

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 doc/examples/ubuntu.yaml | 503 ++++++++++++++++++++++++++-------------
 1 file changed, 340 insertions(+), 163 deletions(-)

diff --git a/doc/examples/ubuntu.yaml b/doc/examples/ubuntu.yaml
index f9e9827..c18f5b3 100644
--- a/doc/examples/ubuntu.yaml
+++ b/doc/examples/ubuntu.yaml
@@ -1,7 +1,7 @@
 image:
   name: ubuntu-disco-x86_64
   distribution: ubuntu
-  release: disco
+  release: focal
   description: |-
     Ubuntu {{ image.release }}
   architecture: x86_64
@@ -12,7 +12,8 @@ source:
   url: http://archive.ubuntu.com/ubuntu
   keyserver: keyserver.ubuntu.com
   keys:
-    - 0x790BC7277767219C42C86F933B4FE6ACC0B21F32
+  - 0x790BC7277767219C42C86F933B4FE6ACC0B21F32
+  - 0xf6ecb3762474eda9d21b7022871920d1991bc93c
 
 targets:
   lxc:
@@ -21,179 +22,355 @@ targets:
 
       To enable SSH, run: apt install openssh-server
       No default root or user password are set by LXC.
-
     config:
-      - type: all
-        before: 5
-        content: |-
-          lxc.include = LXC_TEMPLATE_CONFIG/ubuntu.common.conf
-
-      - type: user
-        before: 5
-        content: |-
-          lxc.include = LXC_TEMPLATE_CONFIG/ubuntu.userns.conf
-
-      - type: all
-        after: 4
-        content: |-
-          lxc.include = LXC_TEMPLATE_CONFIG/common.conf
-
-          # For Ubuntu 14.04
-          lxc.mount.entry = /sys/kernel/debug sys/kernel/debug none bind,optional 0 0
-          lxc.mount.entry = /sys/kernel/security sys/kernel/security none bind,optional 0 0
-          lxc.mount.entry = /sys/fs/pstore sys/fs/pstore none bind,optional 0 0
-          lxc.mount.entry = mqueue dev/mqueue mqueue rw,relatime,create=dir,optional 0 0
-
-      - type: user
-        after: 4
-        content: |-
-          lxc.include = LXC_TEMPLATE_CONFIG/userns.conf
-
-          # For Ubuntu 14.04
-          lxc.mount.entry = /sys/firmware/efi/efivars sys/firmware/efi/efivars none bind,optional 0 0
-          lxc.mount.entry = /proc/sys/fs/binfmt_misc proc/sys/fs/binfmt_misc none bind,optional 0 0
-
-      - type: all
-        content: |-
-          lxc.arch = {{ image.architecture_personality }}
+    - type: all
+      before: 5
+      content: |-
+        lxc.include = LXC_TEMPLATE_CONFIG/ubuntu.common.conf
+
+    - type: user
+      before: 5
+      content: |-
+        lxc.include = LXC_TEMPLATE_CONFIG/ubuntu.userns.conf
+
+    - type: all
+      after: 4
+      content: |-
+        lxc.include = LXC_TEMPLATE_CONFIG/common.conf
+
+        # For Ubuntu 14.04
+        lxc.mount.entry = /sys/kernel/debug sys/kernel/debug none bind,optional 0 0
+        lxc.mount.entry = /sys/kernel/security sys/kernel/security none bind,optional 0 0
+        lxc.mount.entry = /sys/fs/pstore sys/fs/pstore none bind,optional 0 0
+        lxc.mount.entry = mqueue dev/mqueue mqueue rw,relatime,create=dir,optional 0 0
+
+    - type: user
+      after: 4
+      content: |-
+        lxc.include = LXC_TEMPLATE_CONFIG/userns.conf
+
+        # For Ubuntu 14.04
+        lxc.mount.entry = /sys/firmware/efi/efivars sys/firmware/efi/efivars none bind,optional 0 0
+        lxc.mount.entry = /proc/sys/fs/binfmt_misc proc/sys/fs/binfmt_misc none bind,optional 0 0
+
+    - type: all
+      content: |-
+        lxc.arch = {{ image.architecture_personality }}
 
 files:
- - path: /etc/hostname
-   generator: hostname
-
- - path: /etc/hosts
-   generator: hosts
-
- - path: /etc/resolvconf/resolv.conf.d/original
-   generator: remove
-
- - path: /etc/resolvconf/resolv.conf.d/tail
-   generator: remove
-
- - path: /etc/machine-id
-   generator: remove
-
- - path: /etc/netplan/10-lxc.yaml
-   generator: dump
-   content: |-
-     network:
-       version: 2
-       ethernets:
-         eth0: {dhcp4: true}
-   releases:
-     - artful
-     - bionic
-     - cosmic
-     - disco
-
- - path: /etc/network/interfaces
-   generator: dump
-   content: |-
-     # This file describes the network interfaces available on your system
-     # and how to activate them. For more information, see interfaces(5).
-
-     # The loopback network interface
-     auto lo
-     iface lo inet loopback
-
-     auto eth0
-     iface eth0 inet dhcp
-   releases:
-     - trusty
-     - xenial
-
- - path: /etc/init/lxc-tty.conf
-   generator: upstart-tty
-   releases:
-    - trusty
-
- - name: meta-data
-   generator: cloud-init
-   variants:
-    - cloud
-
- - name: network-config
-   generator: cloud-init
-   variants:
-    - cloud
-
- - name: user-data
-   generator: cloud-init
-   variants:
-    - cloud
-
- - name: vendor-data
-   generator: cloud-init
-   variants:
-    - cloud
+- path: /etc/hostname
+  generator: hostname
+
+- path: /etc/hosts
+  generator: hosts
+
+- path: /etc/resolvconf/resolv.conf.d/original
+  generator: remove
+
+- path: /etc/resolvconf/resolv.conf.d/tail
+  generator: remove
+
+- path: /etc/machine-id
+  generator: dump
+
+- path: /var/lib/dbus/machine-id
+  generator: remove
+
+- path: /etc/netplan/10-lxc.yaml
+  generator: dump
+  content: |-
+    network:
+      version: 2
+      ethernets:
+        eth0:
+          dhcp4: true
+          dhcp-identifier: mac
+  releases:
+  - bionic
+  - eoan
+  - focal
+  - groovy
+  types:
+  - container
+  variants:
+  - default
+
+- path: /etc/network/interfaces
+  generator: dump
+  content: |-
+    # This file describes the network interfaces available on your system
+    # and how to activate them. For more information, see interfaces(5).
+
+    # The loopback network interface
+    auto lo
+    iface lo inet loopback
+
+    auto eth0
+    iface eth0 inet dhcp
+
+    source /etc/network/interfaces.d/*.cfg
+  releases:
+  - trusty
+  - xenial
+  types:
+  - container
+
+- path: /etc/netplan/10-lxc.yaml
+  generator: dump
+  content: |-
+    network:
+      version: 2
+      ethernets:
+        enp5s0:
+          dhcp4: true
+          dhcp-identifier: mac
+  releases:
+  - bionic
+  - eoan
+  - focal
+  - groovy
+  types:
+  - vm
+  variants:
+  - default
+
+- path: /etc/network/interfaces
+  generator: dump
+  content: |-
+    # This file describes the network interfaces available on your system
+    # and how to activate them. For more information, see interfaces(5).
+
+    # The loopback network interface
+    auto lo
+    iface lo inet loopback
+
+    auto enp5s0
+    iface enp5s0 inet dhcp
+
+    source /etc/network/interfaces.d/*.cfg
+  releases:
+  - trusty
+  - xenial
+  types:
+  - vm
+
+- path: /etc/init/lxc-tty.conf
+  generator: upstart-tty
+  releases:
+  - trusty
+  types:
+  - container
+
+- name: meta-data
+  generator: cloud-init
+  variants:
+  - cloud
+
+- name: network-config
+  generator: cloud-init
+  variants:
+  - cloud
+
+- name: user-data
+  generator: cloud-init
+  variants:
+  - cloud
+
+- name: vendor-data
+  generator: cloud-init
+  variants:
+  - cloud
+
+- name: ext4
+  generator: fstab
+  types:
+  - vm
+
+- name: lxd-agent
+  generator: lxd-agent
+  types:
+  - vm
+
+- path: /etc/default/grub.d/50-lxd.cfg
+  generator: dump
+  content: |-
+    GRUB_RECORDFAIL_TIMEOUT=0
+    GRUB_TIMEOUT=0
+    GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} console=tty1 console=ttyS0"
+    GRUB_TERMINAL=console
+  types:
+  - vm
+
+- path: /etc/sudoers.d/90-lxd
+  generator: dump
+  mode: 0440
+  content: |-
+    # User rules for ubuntu
+    ubuntu ALL=(ALL) NOPASSWD:ALL
+  variants:
+    - default
 
 packages:
   manager: apt
   update: true
   cleanup: true
+  sets:
+  - packages:
+    - apt-transport-https
+    - fuse
+    - language-pack-en
+    - openssh-client
+    - vim
+    action: install
+
+  - packages:
+    - cloud-init
+    action: install
+    variants:
+    - cloud
 
-  repositories:
-    - name: sources.list
-      url: |-
-        deb http://archive.ubuntu.com/ubuntu {{ image.release }} main restricted universe multiverse
-        deb http://archive.ubuntu.com/ubuntu {{ image.release }}-updates main restricted universe multiverse
-        deb http://security.ubuntu.com/ubuntu {{ image.release }}-security main restricted universe multiverse
-      architectures:
-        - amd64
-        - i386
-
-    - name: sources.list
-      url: |-
-        deb http://ports.ubuntu.com/ubuntu-ports {{ image.release }} main restricted universe multiverse
-        deb http://ports.ubuntu.com/ubuntu-ports {{ image.release }}-updates main restricted universe multiverse
-        deb http://ports.ubuntu.com/ubuntu-ports {{ image.release }}-security main restricted universe multiverse
-      architectures:
-        - armhf
-        - arm64
-        - powerpc
-        - powerpc64
-        - ppc64el
+  - packages:
+    - acpid
+    action: install
+    architectures:
+    - amd64
+    - arm64
+    types:
+    - vm
+
+  - packages:
+    - grub-efi-amd64-signed
+    - shim-signed
+    action: install
+    architectures:
+    - amd64
+    types:
+    - vm
+
+  - packages:
+    - grub-efi-arm64-signed
+    action: install
+    architectures:
+    - arm64
+    types:
+    - vm
+
+  - packages:
+    - shim-signed
+    action: install
+    architectures:
+    - arm64
+    releases:
+    - disco
+    - eoan
+    - focal
+    - groovy
+    types:
+    - vm
+
+  - packages:
+    - linux-virtual-hwe-16.04
+    action: install
+    releases:
+    - xenial
+    types:
+    - vm
+
+  - packages:
+    - linux-virtual
+    action: install
+    releases:
+    - bionic
+    - eoan
+    - focal
+    - groovy
+    types:
+    - vm
+
+  - packages:
+    - os-prober
+    action: remove
+    types:
+    - vm
 
-  sets:
-    - packages:
-      - apt-transport-https
-      - language-pack-en
-      - openssh-client
-      - vim
-      action: install
-
-    - packages:
-      - cloud-init
-      action: install
-      variants:
-       - cloud
+  repositories:
+  - name: sources.list
+    url: |-
+      deb http://archive.ubuntu.com/ubuntu {{ image.release }} main restricted universe multiverse
+      deb http://archive.ubuntu.com/ubuntu {{ image.release }}-updates main restricted universe multiverse
+      deb http://security.ubuntu.com/ubuntu {{ image.release }}-security main restricted universe multiverse
+    architectures:
+    - amd64
+    - i386
+
+  - name: sources.list
+    url: |-
+      deb http://ports.ubuntu.com/ubuntu-ports {{ image.release }} main restricted universe multiverse
+      deb http://ports.ubuntu.com/ubuntu-ports {{ image.release }}-updates main restricted universe multiverse
+      deb http://ports.ubuntu.com/ubuntu-ports {{ image.release }}-security main restricted universe multiverse
+    architectures:
+    - armhf
+    - arm64
+    - powerpc
+    - powerpc64
+    - ppc64el
 
 actions:
-  - trigger: post-update
-    action: |-
-      #!/bin/sh
-      set -eux
-
-      # Create the ubuntu user account
-      getent group sudo >/dev/null 2>&1 || groupadd --system sudo
-      useradd --create-home -s /bin/bash -G sudo -U ubuntu
-
-  - trigger: post-packages
-    action: |-
-      #!/bin/sh
-      set -eux
-
-      # Make sure the locale is built and functional
-      locale-gen en_US.UTF-8
-      update-locale LANG=en_US.UTF-8
-
-      # Cleanup underlying /run
-      mount -o bind / /mnt
-      rm -rf /mnt/run/*
-      umount /mnt
-
-      # Cleanup temporary shadow paths
-      rm /etc/*-
+- trigger: post-update
+  action: |-
+    #!/bin/sh
+    set -eux
+
+    # Create the ubuntu user account
+    getent group sudo >/dev/null 2>&1 || groupadd --system sudo
+    useradd --create-home -s /bin/bash -G sudo -U ubuntu
+  variants:
+  - default
+
+- trigger: post-packages
+  action: |-
+    #!/bin/sh
+    set -eux
+
+    # Enable systemd-networkd
+    systemctl enable systemd-networkd
+  releases:
+  - bionic
+  - eoan
+  - focal
+  - groovy
+
+- trigger: post-packages
+  action: |-
+    #!/bin/sh
+    set -eux
+
+    # Make sure the locale is built and functional
+    locale-gen en_US.UTF-8
+    update-locale LANG=en_US.UTF-8
+
+    # Cleanup underlying /run
+    mount -o bind / /mnt
+    rm -rf /mnt/run/*
+    umount /mnt
+
+    # Cleanup temporary shadow paths
+    rm /etc/*-
+
+- trigger: post-files
+  action: |-
+    #!/bin/sh
+    set -eux
+
+    TARGET="x86_64"
+    [ "$(uname -m)" = "aarch64" ] && TARGET="arm64"
+
+    update-grub
+    grub-install --uefi-secure-boot --target="${TARGET}-efi" --no-nvram --removable
+    update-grub
+    sed -i "s#root=[^ ]*#root=/dev/sda2#g" /boot/grub/grub.cfg
+  types:
+  - vm
 
 mappings:
   architecture_map: debian


More information about the lxc-devel mailing list