blob: a73ca23ca51e514862e84541df63fb7ca5dbe98f [file] [log] [blame]
Tatyana Leontovichd8bf14f2017-04-19 12:20:50 +03001| # 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:
Artem Panchenkodb0a97f2017-06-27 19:09:13 +030010 {% for key in config.underlay.ssh_keys %}
11 - ssh-rsa {{ key['public'] }}
12 {% endfor %}
Tatyana Leontovichd8bf14f2017-04-19 12:20:50 +030013
14 disable_root: false
15 chpasswd:
16 list: |
17 root:r00tme
18 expire: False
19
20 bootcmd:
Tatyana Leontovichd8bf14f2017-04-19 12:20:50 +030021 # 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:
28 # Configure dhclient
29 - sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base
30 - sudo resolvconf -u
31
32 # Prepare network connection
Dennis Dmitrievf00a3842018-01-24 16:44:26 +020033 - sudo ifdown ens3
Dennis Dmitriev002b8432018-01-25 03:26:14 +020034 - sudo ip r d default || true # remove existing default route to get it from dhcp
Tatyana Leontovichd8bf14f2017-04-19 12:20:50 +030035 - sudo ifup ens3
36 #- sudo route add default gw {gateway} {interface_name}
Tatyana Leontovichd8bf14f2017-04-19 12:20:50 +030037
38 # Create swap
39 - fallocate -l 4G /swapfile
40 - chmod 600 /swapfile
41 - mkswap /swapfile
42 - swapon /swapfile
43 - echo "/swapfile none swap defaults 0 0" >> /etc/fstab
44
Dennis Dmitriev74861862017-09-28 17:02:13 +030045 - echo "nameserver 172.18.208.44" >> /etc/resolv.conf;
Dennis Dmitrievb4b5c102017-05-10 17:09:06 +030046
Dennis Dmitrievcf777802018-02-14 18:09:55 +020047 # Enable grub menu using updated config below
48 - update-grub
Tatyana Leontovichd8bf14f2017-04-19 12:20:50 +030049
50 write_files:
Dennis Dmitrievcf777802018-02-14 18:09:55 +020051 - path: /etc/default/grub.d/97-enable-grub-menu.cfg
52 content: |
53 GRUB_RECORDFAIL_TIMEOUT=30
54 GRUB_TIMEOUT=3
55 GRUB_TIMEOUT_STYLE=menu
56
Tatyana Leontovichd8bf14f2017-04-19 12:20:50 +030057 - path: /etc/network/interfaces
58 content: |
59 auto ens3
60 iface ens3 inet dhcp
Tatyana Leontovichd8bf14f2017-04-19 12:20:50 +030061
Tatyana Leontovichd8bf14f2017-04-19 12:20:50 +030062 - path: /root/.ssh/config
63 owner: root:root
64 permissions: '0600'
65 content: |
66 Host *
67 ServerAliveInterval 300
68 ServerAliveCountMax 10
69 StrictHostKeyChecking no
70 UserKnownHostsFile /dev/null