blob: 79ae47c43c8458bafd85001461e1e9f37f76f261 [file] [log] [blame]
Tatyana Leontovichbb6d1a72017-05-17 14:10:38 +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 - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCp0evjOaK8c8SKYK4r2+0BN7g+8YSvQ2n8nFgOURCyvkJqOHi1qPGZmuN0CclYVdVuZiXbWw3VxRbSW3EH736VzgY1U0JmoTiSamzLHaWsXvEIW8VCi7boli539QJP0ikJiBaNAgZILyCrVPN+A6mfqtacs1KXdZ0zlMq1BPtFciR1JTCRcVs5vP2Wwz5QtY2jMIh3aiwkePjMTQPcfmh1TkOlxYu5IbQyZ3G1ahA0mNKI9a0dtF282av/F6pwB/N1R1nEZ/9VtcN2I1mf1NW/tTHEEcTzXYo1R/8K9vlqAN8QvvGLZtZduGviNVNoNWvoxaXxDt8CPv2B2NCdQFZp
11
12 disable_root: false
13 chpasswd:
14 list: |
15 root:r00tme
16 expire: False
17
18 bootcmd:
19 # Block access to SSH while node is preparing
20 - cloud-init-per once sudo iptables -A INPUT -p tcp --dport 22 -j DROP
21 # 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 ens3
34 #- sudo route add default gw {gateway} {interface_name}
35 - sudo ifup ens4
Sergii Golovatiuk5b659d42017-05-26 17:38:06 +020036 - sudo ifup ens5
Tatyana Leontovichbb6d1a72017-05-17 14:10:38 +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
Tatyana Leontovich508d0cb2017-05-26 15:46:24 +030045 ############## TCP Cloud cfg01 node ##################
46 #- sleep 120
47 - echo "Preparing base OS"
48
49 - echo "172.18.248.114 jenkins.mcp.mirantis.net gerrit.mcp.mirantis.net" >> /etc/hosts;
50 - echo "185.135.196.10 apt-mk.mirantis.com" >> /etc/hosts;
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020051 - echo "nameserver 172.18.208.44" >> /etc/resolv.conf;
52 - echo "nameserver 8.8.8.8" >> /etc/resolv.conf;
Tatyana Leontovich508d0cb2017-05-26 15:46:24 +030053 - which wget >/dev/null || (apt-get update; apt-get install -y wget);
54
Sergii Golovatiukf03899c2017-05-30 12:12:00 +020055 - echo "deb [arch=amd64] http://apt-mk.mirantis.com/xenial nightly salt extra" > /etc/apt/sources.list.d/mcp_salt.list;
Tatyana Leontovich508d0cb2017-05-26 15:46:24 +030056 - wget -O - http://apt-mk.mirantis.com/public.gpg | apt-key add -;
57 - echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3 xenial main" > /etc/apt/sources.list.d/saltstack.list;
58 - wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3/SALTSTACK-GPG-KEY.pub | apt-key add -;
59
Sergii Golovatiuk5b659d42017-05-26 17:38:06 +020060 - eatmydata apt-get clean
61 - eatmydata apt-get update && eatmydata apt-get -y upgrade
Tatyana Leontovich508d0cb2017-05-26 15:46:24 +030062
63 # Install common packages
64 - eatmydata apt-get install -y python-pip git curl tmux byobu iputils-ping traceroute htop tree
65
Tatyana Leontovichbb6d1a72017-05-17 14:10:38 +030066 ########################################################
67 # Node is ready, allow SSH access
68 - echo "Allow SSH access ..."
69 - sudo iptables -D INPUT -p tcp --dport 22 -j DROP
70 ########################################################
71
72 write_files:
73 - path: /etc/network/interfaces
74 content: |
75 auto ens3
76 iface ens3 inet dhcp
77 auto ens4
78 iface ens4 inet dhcp
Sergii Golovatiuk5b659d42017-05-26 17:38:06 +020079 auto ens5
80 iface ens5 inet dhcp
Tatyana Leontovichbb6d1a72017-05-17 14:10:38 +030081
82 - path: /root/.ssh/id_rsa
83 owner: root:root
84 permissions: '0600'
85 content: |
86 -----BEGIN RSA PRIVATE KEY-----
87 MIIEogIBAAKCAQEAqdHr4zmivHPEimCuK9vtATe4PvGEr0Np/JxYDlEQsr5Cajh4
88 tajxmZrjdAnJWFXVbmYl21sN1cUW0ltxB+9+lc4GNVNCZqE4kmpsyx2lrF7xCFvF
89 Qou26JYud/UCT9IpCYgWjQIGSC8gq1TzfgOpn6rWnLNSl3WdM5TKtQT7RXIkdSUw
90 kXFbObz9lsM+ULWNozCId2osJHj4zE0D3H5odU5DpcWLuSG0MmdxtWoQNJjSiPWt
91 HbRdvNmr/xeqcAfzdUdZxGf/VbXDdiNZn9TVv7UxxBHE812KNUf/Cvb5agDfEL7x
92 i2bWXbhr4jVTaDVr6MWl8Q7fAj79gdjQnUBWaQIDAQABAoIBAFU3kU6yIna9BViH
93 UX+S2ijtRBjZ68JjavEnp4xvo5h+nydcdT57q9lv/0nAi3g3gmXm/oJH+/ZU87HV
94 zy+zP+t+umDSChUkPBZFL5jxpKyN7BhMrP1KzRuEGYd6vJE/nfY5g095P5vDgnpX
95 o+SNg/YqrY1u8zgr/hnfRaV2/XyIDEEcQXTHseWTnnMQnULFU88xL8yq8ACT5GhK
96 7A9m5ukfcU6d/fs/psz5Yqw5IQsWbv1yJ3/FKufPHlo2Nzh3/3eDAZUXvaBgf1so
97 FWFpHtkry3OXOGaZ98HgF9hL0twS0pzMvuypdGUQAt6nyB1N5re4LK/MAOddqwEc
98 1+NQzfECgYEA2ryEf0GLJdtiYs3F4HbwTwJVIXdyWv7kjYGeMkutzzAjXl6wx8aq
99 kfqLJ7x7UkR5unZ1ajEbKBciAlSuFA+Gikn6a4Lv8h87aSnHpPd/2VSitRlI/gW7
100 w4U4CL3Br1JyonU5WA7VYfTow7KnHBhdwm27RMA9uosyIpveQRpqSG0CgYEAxsAS
101 wCQKrhuPq2YtGtFR7K4BL+N+0E1Vq6h49u1ukcgUe0GHVD3VzBypNCv7rWEVHzAg
102 biCVi7PCjzZYW4fYZmzVD4JbFLVGOUu7aJwLaE4wDe72DNr6YZhcS+Ta98BP+x0q
103 Wt34JNPDabRPfhXfhiCqnWjjod+4Zqx4VJVNgG0CgYB5EXL8xJhyAbW5Hk/x56Mm
104 +BGKjoR7HS3/rMiU6hJv5SMObrbGPI3YcqZm/gn8BO6jaEGg30E6tWMbiyc270j2
105 be/vZe/NQcAuevOHuX3IGvJb7nzaLO46UBgtrmnv0mCkzuFIfh1ZNKdI+i9Ie6wZ
106 m4bVjNod0EGVqlQgELDXGQKBgB+NNmzSS++/6FrpaZesSzkrlnynvOYMoOETacCp
107 iLgT70xx5q308w/oLORfZyDrHJNK7JsPCS6YZvadRgGh2zTHajuAEj2DWZaW8zV0
108 MEtqvi44FU+NI9qCeYSC3FAgc5IF20d5nX8bLxaEzWnSxx1f6jX7BMgZ4AhMsP2c
109 hiUxAoGAFaxn+t9blIjqUiuh0smSYFhLBVPZveYHQDmQYERjktptBd3X95fGnSKh
110 iDe2iPGyud2+Yu4X/VjHLh/MRru+ZXvPXw1XwEqX93q8a1n283ul0Rl9+KKKOVHR
111 eecTjI/BfXBf33mPRKny3xuHw6uwta2T3OXky9IhqYS1kkHiZWA=
112 -----END RSA PRIVATE KEY-----
113
114 - path: /root/.ssh/config
115 owner: root:root
116 permissions: '0600'
117 content: |
118 Host *
119 ServerAliveInterval 300
120 ServerAliveCountMax 10
121 StrictHostKeyChecking no
122 UserKnownHostsFile /dev/null