distrobuilder/doc/examples/debian-cloud-init
Thomas Hipp ac1421c044
doc: Fix debian-cloud-init example
Signed-off-by: Thomas Hipp <thomas.hipp@canonical.com>
2019-02-14 11:08:57 +01:00

187 lines
4.3 KiB
Plaintext

image:
distribution: debian
release: testing
description: Debian testing
expiry: 30d
source:
downloader: debootstrap
apt_sources: |-
deb http://deb.debian.org/debian {{ image.release }} main
{% if image.release != "sid" and image.release != "buster" and not (image.release == "wheezy" and image.architecture_mapped == "powerpc") and not (image.release == "wheezy" and image.architecture_mapped == "s390x") %}deb http://security.debian.org/debian-security {{ image.release }}/updates main{% endif %}
targets:
lxc:
create-message: |-
You just created a {{ image.description }} container.
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/debian.common.conf
- type: user
before: 5
content: |-
lxc.include = LXC_TEMPLATE_CONFIG/debian.userns.conf
- type: all
after: 4
content: |-
lxc.include = LXC_TEMPLATE_CONFIG/common.conf
- type: user
after: 4
content: |-
lxc.include = LXC_TEMPLATE_CONFIG/userns.conf
- 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/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
- name: cloud-init-meta
path: /var/lib/cloud/seed/nocloud-net/meta-data
generator: template
template:
when:
- create
- copy
content: |
#cloud-config
instance-id: {{ container.name }}
local-hostname: {{ container.name }}
{{ config_get("user.meta-data", "") }}
- name: cloud-init-network
path: /var/lib/cloud/seed/nocloud-net/network-config
generator: template
template:
when:
- create
- copy
content: |
{% if config_get("user.network-config", "") == "" %}version: 1
config:
- type: physical
name: eth0
subnets:
- type: {% if config_get("user.network_mode", "") == "link-local" %}manual{% else %}dhcp{% endif %}
control: auto{% else %}{{ config_get("user.network-config", "") }}{% endif %}
- name: cloud-init-user-data
path: /var/lib/cloud/seed/nocloud-net/user-data
generator: template
content: '{{ config_get("user.user-data", properties.default) }}'
template:
properties:
default: |
#cloud-config
{}
when:
- create
- copy
- name: cloud-init-vedor-data
path: /var/lib/cloud/seed/nocloud-net/vendor-data
generator: template
content: '{{ config_get("user.vendor-data", properties.default) }}'
template:
properties:
default: |
#cloud-config
{}
when:
- create
- copy
packages:
manager: apt
update: true
cleanup: true
sets:
- packages:
- dialog
- ifupdown
- isc-dhcp-client
- locales
- netbase
- net-tools
- openssh-client
- vim
action: install
actions:
- trigger: post-packages
action: |-
#!/bin/sh
set -eux
# Make sure the locale is built and functional
echo en_US.UTF-8 UTF-8 >> /etc/locale.gen
locale-gen en_US.UTF-8 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-packages
action: |-
#!/bin/sh
set -eux
apt-get install iproute sysvinit -y
releases:
- wheezy
- trigger: post-packages
action: |-
#!/bin/sh
set -eux
apt-get install iproute2 init -y
releases:
- jessie
- stretch
- buster
- sid
mappings:
architecture_map: debian