Oleksii Butenko | 87d00c0 | 2018-09-05 19:11:17 +0300 | [diff] [blame] | 1 | | # 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: |
| 21 | # 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 Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 28 | - 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 Butenko | 87d00c0 | 2018-09-05 19:11:17 +0300 | [diff] [blame] | 31 | - 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 | # Prepare network connection |
| 38 | - sudo ifup ens3 |
| 39 | #- sudo route add default gw {gateway} {interface_name} |
| 40 | |
| 41 | # Create swap |
| 42 | - fallocate -l 4G /swapfile |
| 43 | - chmod 600 /swapfile |
| 44 | - mkswap /swapfile |
| 45 | - swapon /swapfile |
| 46 | - echo "/swapfile none swap defaults 0 0" >> /etc/fstab |
| 47 | |
| 48 | write_files: |
| 49 | - path: /etc/network/interfaces |
| 50 | content: | |
| 51 | auto ens3 |
| 52 | iface ens3 inet dhcp |
| 53 | |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 54 | - path: /usr/share/growlvm/image-layout.yml |
| 55 | content: | |
| 56 | root: |
Dennis Dmitriev | c79f228 | 2019-01-21 13:52:19 +0200 | [diff] [blame] | 57 | size: '30%VG' |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 58 | home: |
Dennis Dmitriev | c79f228 | 2019-01-21 13:52:19 +0200 | [diff] [blame] | 59 | size: '1G' |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 60 | var_log: |
Dennis Dmitriev | c79f228 | 2019-01-21 13:52:19 +0200 | [diff] [blame] | 61 | size: '11%VG' |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 62 | var_log_audit: |
Dennis Dmitriev | c79f228 | 2019-01-21 13:52:19 +0200 | [diff] [blame] | 63 | size: '5G' |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 64 | var_tmp: |
Dennis Dmitriev | c79f228 | 2019-01-21 13:52:19 +0200 | [diff] [blame] | 65 | size: '11%VG' |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 66 | tmp: |
Dennis Dmitriev | c79f228 | 2019-01-21 13:52:19 +0200 | [diff] [blame] | 67 | size: '5G' |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 68 | owner: root:root |
| 69 | |
| 70 | growpart: |
| 71 | mode: auto |
| 72 | devices: |
| 73 | - '/' |
| 74 | - '/dev/vda3' |
| 75 | ignore_growroot_disabled: false |