Skip to content

Instantly share code, notes, and snippets.

@dnegreira
Created January 19, 2021 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dnegreira/6913f5c1e7df7777b1ce60e6d02639b3 to your computer and use it in GitHub Desktop.
Save dnegreira/6913f5c1e7df7777b1ce60e6d02639b3 to your computer and use it in GitHub Desktop.
image:
name: test-focal
distribution: ubuntu
release: focal
description: |-
Ubuntu {{ image.release }} with mysqld, php, apache2
source:
downloader: debootstrap
same_as: gutsy
url: http://archive.ubuntu.com/ubuntu
keyserver: keyserver.ubuntu.com
keys:
- 0x790BC7277767219C42C86F933B4FE6ACC0B21F32
- 0xf6ecb3762474eda9d21b7022871920d1991bc93c
targets:
lxc:
create-message: |-
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 }}
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: dump
- path: /etc/user/profile
generator: copy
source: /etc/profile
- 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
types:
- container
- name: meta-data
generator: cloud-init
- name: network-config
generator: cloud-init
- name: user-data
generator: cloud-init
- name: vendor-data
generator: cloud-init
- path: /etc/sudoers.d/90-lxd
generator: dump
mode: 0440
content: |-
# User rules for ubuntu
ubuntu ALL=(ALL) NOPASSWD:ALL
packages:
manager: apt
update: true
cleanup: true
sets:
- packages:
- apt-transport-https
- cloud-init
- fuse
- language-pack-en
- openssh-client
- openssh-server
- vim
action: install
# PHP packages
- packages:
- php
- php-curl
- php-dom
- php-gd
- php-mbstring
- php-simplexml
- php-xmlreader
- php-xmlwriter
- php-zip
- php-mysql
- php-bz2
- php-intl
- php-ldap
- php-imap
- php-bcmath
- php-gmp
- php-imagick
- php-apcu
- php-redis
action: install
# DB package
- packages:
- mysql-server
action: install
# redis package
- packages:
- redis
action: install
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
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
# Enable systemd-networkd
systemctl enable systemd-networkd
- 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/*-
mappings:
architecture_map: debian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment