Victor Ryzhenkin | 42e2423 | 2017-11-15 08:01:20 -0400 | [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: |
Victor Ryzhenkin | 42e2423 | 2017-11-15 08:01:20 -0400 | [diff] [blame] | 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 | |
Victor Ryzhenkin | 42e2423 | 2017-11-15 08:01:20 -0400 | [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 | - sudo ifup ens4 |
| 41 | |
| 42 | # Create swap |
| 43 | - fallocate -l 4G /swapfile |
| 44 | - chmod 600 /swapfile |
| 45 | - mkswap /swapfile |
| 46 | - swapon /swapfile |
| 47 | - echo "/swapfile none swap defaults 0 0" >> /etc/fstab |
| 48 | |
Victor Ryzhenkin | 42e2423 | 2017-11-15 08:01:20 -0400 | [diff] [blame] | 49 | write_files: |
| 50 | - path: /etc/network/interfaces |
| 51 | content: | |
| 52 | auto ens3 |
| 53 | iface ens3 inet dhcp |
| 54 | auto ens4 |
| 55 | iface ens4 inet dhcp |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 56 | |
| 57 | - path: /usr/share/growlvm/image-layout.yml |
| 58 | content: | |
| 59 | root: |
Dennis Dmitriev | c79f228 | 2019-01-21 13:52:19 +0200 | [diff] [blame^] | 60 | size: '30%VG' |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 61 | home: |
Dennis Dmitriev | c79f228 | 2019-01-21 13:52:19 +0200 | [diff] [blame^] | 62 | size: '1G' |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 63 | var_log: |
Dennis Dmitriev | c79f228 | 2019-01-21 13:52:19 +0200 | [diff] [blame^] | 64 | size: '11%VG' |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 65 | var_log_audit: |
Dennis Dmitriev | c79f228 | 2019-01-21 13:52:19 +0200 | [diff] [blame^] | 66 | size: '5G' |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 67 | var_tmp: |
Dennis Dmitriev | c79f228 | 2019-01-21 13:52:19 +0200 | [diff] [blame^] | 68 | size: '11%VG' |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 69 | tmp: |
Dennis Dmitriev | c79f228 | 2019-01-21 13:52:19 +0200 | [diff] [blame^] | 70 | size: '5G' |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 71 | owner: root:root |
| 72 | |
| 73 | growpart: |
| 74 | mode: auto |
| 75 | devices: |
| 76 | - '/' |
| 77 | - '/dev/vda3' |
| 78 | ignore_growroot_disabled: false |