blob: 16bd9f650fd7ad66c1e84dbc29b1a6dd63879fc0 [file] [log] [blame]
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +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:
10 {% for key in config.underlay.ssh_keys %}
11 - ssh-rsa {{ key['public'] }}
12 {% endfor %}
13
14 disable_root: false
15 chpasswd:
16 list: |
17 root:r00tme
18 expire: False
19
20 bootcmd:
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +030021 # Enable root access
22 - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
23 - sed -i -e '/^PasswordAuthentication/s/^.*$/PasswordAuthentication yes/' /etc/ssh/sshd_config
24 - service sshd restart
25 output:
26 all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
27
28 runcmd:
29 # Configure dhclient
30 - sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base
31 - sudo resolvconf -u
32
33 # Enable grub menu using updated config below
34 - update-grub
35
36 # Prepare network connection
37 - sudo ifdown ens3
38 - sudo ip r d default || true # remove existing default route to get it from dhcp
39 - sudo ifup ens3
40 #- sudo route add default gw {gateway} {interface_name}
41
42 # Create swap
43 - fallocate -l 4G /swapfile
44 - chmod 600 /swapfile
45 - mkswap /swapfile
46 - swapon /swapfile
47 - echo "/swapfile none swap defaults 0 0" >> /etc/fstab
48
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +030049 - echo "nameserver 172.17.41.2" > /etc/resolv.conf;
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +030050
Dennis Dmitriev5f71f9e2018-10-19 13:02:43 +030051 - mkdir -p /srv/salt/reclass/nodes
52 - systemctl enable salt-master
53 - systemctl enable salt-minion
54 - systemctl start salt-master
55 - systemctl start salt-minion
56 - salt-call -l info --timeout=120 test.ping
Dmitry Tyzhnenko34595f82018-06-12 19:03:12 +030057
58 write_files:
59 - path: /etc/default/grub.d/97-enable-grub-menu.cfg
60 content: |
61 GRUB_RECORDFAIL_TIMEOUT=30
62 GRUB_TIMEOUT=3
63 GRUB_TIMEOUT_STYLE=menu
64
65 - path: /etc/network/interfaces
66 content: |
67 auto ens3
68 iface ens3 inet dhcp
69
70 - path: /root/.ssh/config
71 owner: root:root
72 permissions: '0600'
73 content: |
74 Host *
75 ServerAliveInterval 300
76 ServerAliveCountMax 10
77 StrictHostKeyChecking no
78 UserKnownHostsFile /dev/null