LXD: Create WireGuard container

Create container

CONTAINER=wireguard
 
# Add ubuntu-minimal repository
lxc remote add --protocol simplestreams ubuntu-minimal https://cloud-images.ubuntu.com/minimal/releases/
 
# Create LXD container
#lxc launch ubuntu-minimal:lts ${CONTAINER}
lxc launch ubuntu-minimal:22.04 ${CONTAINER}
 
# update APT packages
lxc exec ${CONTAINER} -- bash -c "export http_proxy=${http_proxy} && apt update && apt -y dist-upgrade && apt -y autoremove"
 
# Install WireGuard
lxc exec ${CONTAINER} -- bash -c "export http_proxy=${http_proxy} && apt install -y wireguard iptables iputils-ping"

Configure UDP 4000 port forward to wireguard container

lxc config device add ${CONTAINER} udp51820 proxy listen=udp:0.0.0.0:51820 connect=udp:127.0.0.1:51820

Configure WireGuard

Rundeck CLI

Install
https://rundeck.github.io/rundeck-cli/
https://github.com/rundeck/rundeck-cli/releases

sudo apt-get install -y default-jre-headless
 
wget -q https://github.com/rundeck/rundeck-cli/releases/download/v2.0.0/rundeck-cli_2.0.0-1_all.deb
sudo dpkg -i rundeck-cli_*_all.deb
 
# sudo apt-get install rundeck-cli

Configuration
https://rundeck.github.io/rundeck-cli/configuration/

# ~/.rd/rundeck-dev.conf
export RD_URL=http://rundeck.dev.example.com:80
export RD_USER=admin
export RD_PASSWORD=admin
 
# load configuration
source ~/.rd/rundeck-dev.conf

Commands
https://rundeck.github.io/rundeck-cli/commands/

LXD: profile

Copy profiles between LXD cluster nodes

lxc profile copy profile-name new-lxd-server:

Export all profiles

for PROFILE in $(lxc profile list --format json | jq -r '.[].name'); do
    lxc profile show ${PROFILE} > ${PROFILE}
done

Import profiles

for PROFILE in $(ls nic* disk*); do
    lxc profile create ${PROFILE} < ${PROFILE}
done

Links
https://ubuntu.com/blog/lxd-5-easy-pieces

DevStack

DevStack XENA

sudo apt -y install git jq vim
sudo apt purge -y python3-distro-info
 
git clone --branch "stable/xena" https://opendev.org/openstack/devstack
 
HOST_IP=$(ip -o -4 -j a | jq -r '.[].addr_info[] | select(.dev == "ens3") .local')
echo ${HOST_IP}

DevStack XENA
https://openstack.goffinet.org/03-02-openstack-lab-devstack.html
http://lia.deis.unibo.it/Courses/CompNetworksM/1718/slides/NetworksM_Cloud180518_v1.pdf
https://opnfvblog.wordpress.com/2016/10/27/devstack-localconf/
https://01.org/sites/default/files/page/accelerating_openstack_networking_with_intel_architecture_rev008.pdf

Flash LineageOS on Google Pixel 2 XL (taimen)

Prepare
https://wiki.lineageos.org/devices/taimen/install

# Enable debug mode on phone
# Enable OEM unlocking
# Enable USB debugging
 
adb reboot bootloader
fastboot flashing unlock
# confirm with keys

Boot bootloader

adb reboot bootloader

Boot TWRP
https://dl.twrp.me/taimen/
https://dl.twrp.me/taimen/twrp-3.7.0_9-0-taimen.img

fastboot boot Downloads/twrp-3.7.0_9-0-taimen.img
 
adb shell twrp wipe data
adb shell twrp wipe dalvik

LineageOS image
https://download.lineageos.org/devices/taimen/builds
https://mirrorbits.lineageos.org/full/taimen/20240822/lineage-21.0-20240822-nightly-taimen-signed.zip

adb shell twrp sideload zip from host adb
adb sideload Downloads/lineage-*nightly-taimen-signed.zip

OPTIONAL: Install Gapps
https://wiki.lineageos.org/gapps

https://github.com/MindTheGapps/14.0.0-arm64/releases/download/MindTheGapps-14.0.0-arm64-20240612_135921/MindTheGapps-14.0.0-arm64-20240612_135921.zip
 
adb sideload Downloads/MindTheGapps-*.zip

Upgrade
https://wiki.lineageos.org/devices/taimen/upgrade
http://downloads.codefi.re/d/CNzxbgzaLdfGLGZSIP-cUQ/1685985608/jdcteam/javelinanddart/gapps/MindTheGapps-12.1.0-arm64-20220605_112439.zip

GRML - Linux Live-CD for sysadmins

# install grml2usb
cat < /etc/apt/sources.list.d/chromium.list
deb http://deb.grml.org/ grml-testing main
EOF

# install grml2usb package
apt-get update
apt-get install grml2usb -y --force-yes

# format partition on USB pen (OPTIONAL)
mkfs.vfat /dev/sdb1

# install GRML to USB pen
grml2usb grml-small_2009.10.iso /dev/sdb1

LINKS
http://git.grml.org/?p=grml-live.git;a=blob_plain;f=templates/GRML/grml-cheatcodes.txt;hb=HEAD
http://www.linux-user.de/ausgabe/2006/06/008-grml/index.html

Deploy LXD container with terraform

Docs
https://registry.terraform.io/providers/terraform-lxd/lxd/latest/docs
https://registry.terraform.io/providers/terraform-lxd/lxd/latest/docs/resources/container

Create LXD container

# terraform init
# terraform apply -auto-approve
# terraform destroy -auto-approve
 
 
terraform {
  required_providers {
    lxd = {
      source = "terraform-lxd/lxd"
    }
  }
}
 
provider "lxd" {
  generate_client_certificates = true
  accept_remote_certificate    = true
}
 
resource "lxd_container" "lxd_container_u2004" {
  name  = "u2004"
  image = "ubuntu:20.04"
 
  config = {
    "boot.autostart" = true
  }
 
  limits = {
    cpu = 2
  }
}
 
resource "lxd_container" "lxd_container_u2110" {
  name = "u2110"
  image = "ubuntu:21.10"
  # image = "images:ubuntu-minimal:21.10" # fixme
 
  config = {
    "boot.autostart" = true
  }
 
  limits = {
    cpu = 2
  }
}

Links
https://dev.to/smashse/snap-lxd-terraform-3f0p

Ubuntu autoinstall

HowTo
https://canonical-subiquity.readthedocs-hosted.com/en/latest/tutorial/providing-autoinstall.html#providing-autoinstall

Download Ubuntu iso
https://releases.ubuntu.com/24.04/ubuntu-24.04-desktop-amd64.iso

wget https://releases.ubuntu.com/24.04/ubuntu-24.04-desktop-amd64.iso -O ~/Downloads/iso/ubuntu-24.04-desktop-amd64.iso

Prepare

sudo apt install qemu-system-x86
 
# mount ISO by double click
#sudo mount -r ~/Downloads/iso/ubuntu-24.04-desktop-amd64.iso /mnt

autoinstall.yaml