Dennis Dmitriev | 0f624a8 | 2018-06-11 12:57:13 +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 | |
Dennis Dmitriev | 0f624a8 | 2018-06-11 12:57:13 +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 | # Enable grub menu using updated config below |
| 38 | - update-grub |
| 39 | |
| 40 | # Prepare network connection |
| 41 | - sudo ifup ens3 |
| 42 | #- sudo route add default gw {gateway} {interface_name} |
| 43 | |
| 44 | # Create swap |
| 45 | - fallocate -l 16G /swapfile |
| 46 | - chmod 600 /swapfile |
| 47 | - mkswap /swapfile |
| 48 | - swapon /swapfile |
| 49 | - echo "/swapfile none swap defaults 0 0" >> /etc/fstab |
| 50 | |
| 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 | auto ens3 |
| 61 | iface ens3 inet dhcp |
| 62 | |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 63 | - path: /usr/share/growlvm/image-layout.yml |
| 64 | content: | |
| 65 | root: |
| 66 | size: '50%VG' |
| 67 | home: |
| 68 | size: '100M' |
| 69 | var_log: |
| 70 | size: '15%VG' |
| 71 | var_log_audit: |
| 72 | size: '500M' |
| 73 | var_tmp: |
| 74 | size: '500M' |
| 75 | tmp: |
| 76 | size: '500M' |
| 77 | owner: root:root |
| 78 | |
| 79 | growpart: |
| 80 | mode: auto |
| 81 | devices: |
| 82 | - '/' |
| 83 | - '/dev/vda3' |
| 84 | ignore_growroot_disabled: false |