blob: dc9f8cd4314cb1561b555d4bf2ce33735f5f8907 [file] [log] [blame]
Victor Ryzhenkin42e24232017-11-15 08:01:20 -04001| # 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:
Victor Ryzhenkin42e24232017-11-15 08:01:20 -040021 # 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
Victor Ryzhenkin42e24232017-11-15 08:01:20 -040035 - sudo ifup ens3
36 #- sudo route add default gw {gateway} {interface_name}
Dennis Dmitriev002b8432018-01-25 03:26:14 +020037 - sudo ifdown ens4
Victor Ryzhenkin42e24232017-11-15 08:01:20 -040038 - sudo ifup ens4
39
40 # Create swap
41 - fallocate -l 4G /swapfile
42 - chmod 600 /swapfile
43 - mkswap /swapfile
44 - swapon /swapfile
45 - echo "/swapfile none swap defaults 0 0" >> /etc/fstab
46
Dennis Dmitriev5f71f9e2018-10-19 13:02:43 +030047 - mkdir -p /srv/salt/reclass/nodes
48 - systemctl enable salt-master
49 - systemctl enable salt-minion
50 - systemctl start salt-master
51 - systemctl start salt-minion
52 - salt-call -l info --timeout=120 test.ping
53
Victor Ryzhenkin42e24232017-11-15 08:01:20 -040054 write_files:
55 - path: /etc/network/interfaces
56 content: |
57 auto ens3
58 iface ens3 inet dhcp
59 auto ens4
60 iface ens4 inet dhcp
61
62 - 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