blob: d23efd29a9272356f496044402c1dcae01738ee4 [file] [log] [blame]
Victor Ryzhenkina95d1732017-11-16 19:02:19 +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:
21 # Block access to SSH while node is preparing
22 - cloud-init-per once sudo iptables -A INPUT -p tcp --dport 22 -j DROP
23 # Enable root access
24 - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
25 - service sshd restart
26 output:
27 all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
28
29 runcmd:
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020030 - if lvs vg0; then pvresize /dev/vda3; fi
31 - if lvs vg0; then /usr/bin/growlvm.py --image-layout-file /usr/share/growlvm/image-layout.yml; fi
32
Victor Ryzhenkina95d1732017-11-16 19:02:19 +040033 - export TERM=linux
34 - export LANG=C
35 # Configure dhclient
36 - sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base
37 - sudo resolvconf -u
38
39 # Prepare network connection
40 - sudo ifup ens3
41 #- sudo route add default gw {gateway} {interface_name}
42 - sudo ifup ens4
43 - sudo ifup ens5
44
45 # Create swap disabled due k8s >1.8.x allows use swap only with
46 # flag `--fail-swap-on=false` in kubelet args
47
48 ############## TCP Cloud cfg01 node ##################
49 #- sleep 120
50 - echo "Preparing base OS"
51 - which wget >/dev/null || (apt-get update; apt-get install -y wget)
52
53 - echo "deb [arch=amd64] http://apt.mirantis.com/xenial {{ REPOSITORY_SUITE }} salt extra" > /etc/apt/sources.list.d/mcp_salt.list;
54 - wget -O - http://apt.mirantis.com/public.gpg | apt-key add -;
Tatyana Leontovich4453dd62018-06-26 18:44:31 +030055 - echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/{{ SALT_VERSION }} xenial main" > /etc/apt/sources.list.d/saltstack.list;
56 - wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/{{ SALT_VERSION }}/SALTSTACK-GPG-KEY.pub | apt-key add -;
Victor Ryzhenkina95d1732017-11-16 19:02:19 +040057
58 - apt-get clean
59 - eatmydata apt-get update && apt-get -y upgrade
60
61 # install common packages
62 - eatmydata apt-get install -y python-pip git curl tmux byobu iputils-ping traceroute htop tree mc
63
64 ########################################################
65 # Node is ready, allow SSH access
66 - echo "Allow SSH access ..."
67 - sudo iptables -D INPUT -p tcp --dport 22 -j DROP
68 ########################################################
69
70 write_files:
71 - path: /etc/network/interfaces
72 content: |
73 auto ens3
74 iface ens3 inet dhcp
75 auto ens4
76 iface ens4 inet dhcp
77 auto ens5
78 iface ens5 inet dhcp
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020079
80 - path: /usr/share/growlvm/image-layout.yml
81 content: |
82 root:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +020083 size: '30%VG'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020084 home:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +020085 size: '1G'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020086 var_log:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +020087 size: '11%VG'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020088 var_log_audit:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +020089 size: '5G'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020090 var_tmp:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +020091 size: '11%VG'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020092 tmp:
Dennis Dmitrievc79f2282019-01-21 13:52:19 +020093 size: '5G'
Dennis Dmitriev752c1bf2018-12-19 13:05:16 +020094 owner: root:root
95
96 growpart:
97 mode: auto
98 devices:
99 - '/'
100 - '/dev/vda3'
101 ignore_growroot_disabled: false