blob: 2a41ee3c510e3ffba162326c8b18ee8e2f14934e [file] [log] [blame]
Sergii Golovatiuk5b659d42017-05-26 17:38:06 +02001| # 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 %}
Sergii Golovatiuk5b659d42017-05-26 17:38:06 +020013
14 disable_root: false
15 chpasswd:
16 list: |
17 root:r00tme
18 expire: False
19
20 bootcmd:
Sergii Golovatiuk5b659d42017-05-26 17:38:06 +020021 # 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
33 - sudo ifup eth0
34 #- sudo route add default gw {gateway} {interface_name}
35 - sudo ifup eth1
36 - sudo ifup eth2
37
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
Sergii Golovatiuk5b659d42017-05-26 17:38:06 +020045 write_files:
46 - path: /etc/network/interfaces
47 content: |
48 auto eth0
49 iface eth0 inet dhcp
50 auto eth1
51 iface eth1 inet dhcp
52 auto eth2
53 iface eth2 inet dhcp