Pavel Glazov | b4b7c53 | 2024-05-22 15:13:48 +0400 | [diff] [blame^] | 1 | #cloud-config, see http://cloudinit.readthedocs.io/en/latest/topics/examples.html |
| 2 | |
| 3 | fqdn: $node_hostname.$node_domain |
| 4 | ssh_pwauth: True |
| 5 | users: |
| 6 | - name: root |
| 7 | sudo: ALL=(ALL) NOPASSWD:ALL |
| 8 | shell: /bin/bash |
| 9 | |
| 10 | disable_root: false |
| 11 | chpasswd: |
| 12 | list: | |
| 13 | root:r00tme |
| 14 | expire: False |
| 15 | |
| 16 | bootcmd: |
| 17 | # Enable root access |
| 18 | - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config |
| 19 | - service sshd restart |
| 20 | output: |
| 21 | all: '| tee -a /var/log/cloud-init-output.log /dev/tty0' |
| 22 | |
| 23 | runcmd: |
| 24 | - if lvs vg0; then pvresize $(pvdisplay -C -S vg_name=vg0 -o pv_name --noheadings | tail -n1); fi |
| 25 | - if lvs vg0; then /usr/bin/growlvm.py --image-layout-file /usr/share/growlvm/image-layout.yml; fi |
| 26 | |
| 27 | - export TERM=linux |
| 28 | - export LANG=C |
| 29 | # Configure dhclient |
| 30 | - sudo resolvconf -u |
| 31 | #- sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base |
| 32 | # Enable grub menu using updated config below |
| 33 | - update-grub |
| 34 | |
| 35 | # Prepare network connection |
| 36 | - sudo ifup ens3 |
| 37 | #- sudo route add default gw {gateway} {interface_name} |
| 38 | |
| 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 |
| 45 | |
| 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 |
| 52 | |
| 53 | - path: /etc/network/interfaces |
| 54 | content: | |
| 55 | auto ens3 |
| 56 | iface ens3 inet dhcp |
| 57 | |
| 58 | - path: /usr/share/growlvm/image-layout.yml |
| 59 | content: | |
| 60 | root: |
| 61 | size: '65%VG' |
| 62 | home: |
| 63 | size: '1%VG' |
| 64 | var_log: |
| 65 | size: '10%VG' |
| 66 | var_log_audit: |
| 67 | size: '5%VG' |
| 68 | var_tmp: |
| 69 | size: '10%VG' |
| 70 | tmp: |
| 71 | size: '5%VG' |
| 72 | owner: root:root |
| 73 | |
| 74 | growpart: |
| 75 | mode: auto |
| 76 | devices: |
| 77 | - '/' |
| 78 | - '/dev/vda3' |
| 79 | - '/dev/vdb3' |
| 80 | - '/dev/vdc3' |
| 81 | - '/dev/vdd3' |
| 82 | ignore_growroot_disabled: false |