blob: b39b37aaf44a6d18c10e43f1af0dd42dcd3cf3a9 [file] [log] [blame]
Oleksii Butenko7c48def2017-10-03 12:41:05 +03001| # All the data below will be stored as a string object
2 #cloud-config, see http://cloudinit.readthedocs.io/en/latest/topics/examples.html
3
4 ssh_pwauth: True
5 users:
6 - name: root
7 sudo: ALL=(ALL) NOPASSWD:ALL
8 shell: /bin/bash
9 ssh_authorized_keys:
10 {% for key in config.underlay.ssh_keys %}
11 - ssh-rsa {{ key['public'] }}
12 {% endfor %}
13
14 disable_root: false
15 chpasswd:
16 list: |
17 root:r00tme
18 expire: False
19
20 bootcmd:
Oleksii Butenko7c48def2017-10-03 12:41:05 +030021 # Enable root access
22 - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
23 - service sshd restart
24 output:
25 all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
26
27 runcmd:
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020028 - if lvs vg0; then pvresize /dev/vda3; fi
29 - if lvs vg0; then /usr/bin/growlvm.py --image-layout-file /usr/share/growlvm/image-layout.yml; fi
30
Oleksii Butenko7c48def2017-10-03 12:41:05 +030031 - export TERM=linux
32 - export LANG=C
33 # Configure dhclient
34 - sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base
35 - sudo resolvconf -u
36
37 # Enable grub menu using updated config below
38 - update-grub
39
40 # Prepare network connection
41 - sudo ifup {interface_name}
Oleksii Butenko7c48def2017-10-03 12:41:05 +030042
43 # Create swap
44 - fallocate -l 4G /swapfile
45 - chmod 600 /swapfile
46 - mkswap /swapfile
47 - swapon /swapfile
48 - echo "/swapfile none swap defaults 0 0" >> /etc/fstab
Oleksii Butenkobb46b0b2017-10-24 11:11:48 +030049 - echo "nameserver 172.18.208.44" > /etc/resolv.conf;
Oleksii Butenko7c48def2017-10-03 12:41:05 +030050
51 write_files:
52 - path: /etc/default/grub.d/97-enable-grub-menu.cfg
53 content: |
54 GRUB_RECORDFAIL_TIMEOUT=30
55 GRUB_TIMEOUT=3
56 GRUB_TIMEOUT_STYLE=menu
57
58 - path: /etc/network/interfaces
59 content: |
60 # The loopback network interface
61 auto lo
62 iface lo inet loopback
63 auto {interface_name}
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020064 iface {interface_name} inet dhcp
65
66 - path: /usr/share/growlvm/image-layout.yml
67 content: |
68 root:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +020069 size: '30%VG'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020070 home:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +020071 size: '1G'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020072 var_log:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +020073 size: '11%VG'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020074 var_log_audit:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +020075 size: '5G'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020076 var_tmp:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +020077 size: '11%VG'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020078 tmp:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +020079 size: '5G'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020080 owner: root:root
81
82 growpart:
83 mode: auto
84 devices:
85 - '/'
86 - '/dev/vda3'
87 ignore_growroot_disabled: false