Ubuntu Pastebin

Paste from smoser at Fri, 11 Mar 2016 21:10:53 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
## Testing in a lxc xenial container ##

## build deb from trunk ##
# in cloud-init tree from lp:~smoser/cloud-init/trunk.net1
UNCOMMITTED=1 ./packages/bddeb
cp cloud-init_all.deb /tmp

## network config
$ cat /tmp/network-config.yaml
version: 1
config:
  # Physical interfaces.
  - type: physical
    name: eth0
    subnets:
        - type: static
          address: 10.0.2.100/24
        - type: manual
          address: 10.0.2.200/24
          dns_nameservers:
            - 8.8.8.8
          dns_search:
            - barley.maas

## local user data ##
$ cat /tmp/user-data
#cloud-config
ssh_import_id: [smoser]


## build cloud-localds seed
# cloud-localds from cloud-utils branch at
#  lp:~smoser/cloud-utils/trunk.netconfig/
$ ./bin/cloud-localds -v --dsmode=net --disk-format=tar-seed-local \
     --network-config=/tmp/network-config.yaml /tmp/seed.tar /tmp/my.userdata


## init and patch container
$ tar -C /tmp -cf /tmp/data.tar seed.tar cloud-init_all.deb
$ lxc init xenial x1
$ lxc-chroot x1 --mode=non-interactive -- sh -xec \
    'cd /tmp && tar -xf - && dpkg -i cloud-init_all.deb &&
     rm -Rf /var/lib/cloud/seed &&
     tar -C / -xf /tmp/seed.tar &&
     find /var/lib/cloud/seed -type f' < /tmp/data.tar

# results in cloud
Download as text