Dennis Dmitriev | f5f2e60 | 2017-11-03 15:36:19 +0200 | [diff] [blame] | 1 | #cloud-config, see http://cloudinit.readthedocs.io/en/latest/topics/examples.html |
Tatyana Leontovich | f371844 | 2018-10-31 13:36:13 +0200 | [diff] [blame] | 2 | |
Dennis Dmitriev | f5f2e60 | 2017-11-03 15:36:19 +0200 | [diff] [blame] | 3 | ssh_pwauth: True |
| 4 | users: |
| 5 | - name: root |
| 6 | sudo: ALL=(ALL) NOPASSWD:ALL |
| 7 | shell: /bin/bash |
Tatyana Leontovich | f371844 | 2018-10-31 13:36:13 +0200 | [diff] [blame] | 8 | |
Dennis Dmitriev | f5f2e60 | 2017-11-03 15:36:19 +0200 | [diff] [blame] | 9 | disable_root: false |
| 10 | chpasswd: |
| 11 | list: | |
Tatyana Leontovich | f371844 | 2018-10-31 13:36:13 +0200 | [diff] [blame] | 12 | root:r00tme |
Dennis Dmitriev | f5f2e60 | 2017-11-03 15:36:19 +0200 | [diff] [blame] | 13 | expire: False |
Tatyana Leontovich | f371844 | 2018-10-31 13:36:13 +0200 | [diff] [blame] | 14 | |
Dennis Dmitriev | f5f2e60 | 2017-11-03 15:36:19 +0200 | [diff] [blame] | 15 | bootcmd: |
| 16 | # Enable root access |
| 17 | - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config |
| 18 | - service sshd restart |
| 19 | output: |
| 20 | all: '| tee -a /var/log/cloud-init-output.log /dev/tty0' |
Tatyana Leontovich | f371844 | 2018-10-31 13:36:13 +0200 | [diff] [blame] | 21 | |
Dennis Dmitriev | f5f2e60 | 2017-11-03 15:36:19 +0200 | [diff] [blame] | 22 | runcmd: |
| 23 | - if lvs vg0; then pvresize /dev/vda3; fi |
| 24 | - if lvs vg0; then /usr/bin/growlvm.py --image-layout-file /usr/share/growlvm/image-layout.yml; fi |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 25 | |
Dennis Dmitriev | f5f2e60 | 2017-11-03 15:36:19 +0200 | [diff] [blame] | 26 | - export TERM=linux |
| 27 | - export LANG=C |
| 28 | # Configure dhclient |
| 29 | - sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base |
| 30 | - sudo resolvconf -u |
Tatyana Leontovich | f371844 | 2018-10-31 13:36:13 +0200 | [diff] [blame] | 31 | |
Dennis Dmitriev | f5f2e60 | 2017-11-03 15:36:19 +0200 | [diff] [blame] | 32 | # Enable grub menu using updated config below |
| 33 | - update-grub |
Tatyana Leontovich | f371844 | 2018-10-31 13:36:13 +0200 | [diff] [blame] | 34 | |
Dennis Dmitriev | f5f2e60 | 2017-11-03 15:36:19 +0200 | [diff] [blame] | 35 | # Prepare network connection |
| 36 | - sudo ifup ens3 |
| 37 | #- sudo route add default gw {gateway} {interface_name} |
Tatyana Leontovich | f371844 | 2018-10-31 13:36:13 +0200 | [diff] [blame] | 38 | |
Dennis Dmitriev | f5f2e60 | 2017-11-03 15:36:19 +0200 | [diff] [blame] | 39 | # Create swap |
| 40 | - fallocate -l 16G /swapfile |
| 41 | - chmod 600 /swapfile |
| 42 | - mkswap /swapfile |
| 43 | - swapon /swapfile |
| 44 | - echo "/swapfile none swap defaults 0 0" >> /etc/fstab |
Tatyana Leontovich | f371844 | 2018-10-31 13:36:13 +0200 | [diff] [blame] | 45 | |
Dennis Dmitriev | f5f2e60 | 2017-11-03 15:36:19 +0200 | [diff] [blame] | 46 | write_files: |
| 47 | - path: /etc/default/grub.d/97-enable-grub-menu.cfg |
| 48 | content: | |
| 49 | GRUB_RECORDFAIL_TIMEOUT=30 |
| 50 | GRUB_TIMEOUT=3 |
| 51 | GRUB_TIMEOUT_STYLE=menu |
Tatyana Leontovich | f371844 | 2018-10-31 13:36:13 +0200 | [diff] [blame] | 52 | |
Dennis Dmitriev | f5f2e60 | 2017-11-03 15:36:19 +0200 | [diff] [blame] | 53 | - path: /etc/network/interfaces |
| 54 | content: | |
| 55 | auto ens3 |
| 56 | iface ens3 inet dhcp |
Tatyana Leontovich | f371844 | 2018-10-31 13:36:13 +0200 | [diff] [blame] | 57 | |
Dennis Dmitriev | f5f2e60 | 2017-11-03 15:36:19 +0200 | [diff] [blame] | 58 | - path: /usr/share/growlvm/image-layout.yml |
| 59 | content: | |
| 60 | root: |
| 61 | size: '30%VG' |
| 62 | home: |
| 63 | size: '1G' |
| 64 | var_log: |
| 65 | size: '11%VG' |
| 66 | var_log_audit: |
| 67 | size: '5G' |
| 68 | var_tmp: |
| 69 | size: '11%VG' |
| 70 | tmp: |
| 71 | size: '5G' |
| 72 | owner: root:root |
Dennis Dmitriev | 752c1bf | 2018-12-19 13:05:16 +0200 | [diff] [blame] | 73 | |
Dennis Dmitriev | f5f2e60 | 2017-11-03 15:36:19 +0200 | [diff] [blame] | 74 | growpart: |
| 75 | mode: auto |
| 76 | devices: |
| 77 | - '/' |
| 78 | - '/dev/vda3' |
| 79 | ignore_growroot_disabled: false |