Tatyana Leontovich | 1e063f0 | 2019-05-08 15:06:33 +0300 | [diff] [blame^] | 1 | #cloud-config, see http://cloudinit.readthedocs.io/en/latest/topics/examples.html |
| 2 | |
| 3 | ssh_pwauth: True |
| 4 | users: |
| 5 | - name: root |
| 6 | sudo: ALL=(ALL) NOPASSWD:ALL |
| 7 | shell: /bin/bash |
| 8 | |
| 9 | disable_root: false |
| 10 | chpasswd: |
| 11 | list: | |
| 12 | root:r00tme |
| 13 | expire: False |
| 14 | |
| 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' |
| 21 | |
| 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 |
| 25 | |
| 26 | - export TERM=linux |
| 27 | - export LANG=C |
| 28 | # Configure dhclient |
| 29 | - sudo resolvconf -u |
| 30 | #- sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base |
| 31 | # Enable grub menu using updated config below |
| 32 | - update-grub |
| 33 | |
| 34 | # Prepare network connection |
| 35 | - sudo ifup ens3 |
| 36 | #- sudo route add default gw {gateway} {interface_name} |
| 37 | |
| 38 | # Create swap |
| 39 | - fallocate -l 16G /swapfile |
| 40 | - chmod 600 /swapfile |
| 41 | - mkswap /swapfile |
| 42 | - swapon /swapfile |
| 43 | - echo "/swapfile none swap defaults 0 0" >> /etc/fstab |
| 44 | |
| 45 | write_files: |
| 46 | - path: /etc/default/grub.d/97-enable-grub-menu.cfg |
| 47 | content: | |
| 48 | GRUB_RECORDFAIL_TIMEOUT=30 |
| 49 | GRUB_TIMEOUT=3 |
| 50 | GRUB_TIMEOUT_STYLE=menu |
| 51 | |
| 52 | - path: /etc/network/interfaces |
| 53 | content: | |
| 54 | auto ens3 |
| 55 | iface ens3 inet dhcp |
| 56 | |
| 57 | - path: /usr/share/growlvm/image-layout.yml |
| 58 | content: | |
| 59 | root: |
| 60 | size: '65%VG' |
| 61 | home: |
| 62 | size: '1%VG' |
| 63 | var_log: |
| 64 | size: '10%VG' |
| 65 | var_log_audit: |
| 66 | size: '5%VG' |
| 67 | var_tmp: |
| 68 | size: '10%VG' |
| 69 | tmp: |
| 70 | size: '5%VG' |
| 71 | owner: root:root |
| 72 | |
| 73 | growpart: |
| 74 | mode: auto |
| 75 | devices: |
| 76 | - '/' |
| 77 | - '/dev/vda3' |
| 78 | ignore_growroot_disabled: false |