Dennis Dmitriev | ab83ea4 | 2017-05-12 16:52:45 +0300 | [diff] [blame] | 1 | {% from 'virtual-mcp-ocata-dvr/underlay.yaml' import HOSTNAME_CFG01 with context %} |
Dennis Dmitriev | 2d60c8e | 2017-05-12 18:34:01 +0300 | [diff] [blame] | 2 | {% from 'virtual-mcp-ocata-dvr/underlay.yaml' import REPOSITORY_SUITE with context %} |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 3 | |
| 4 | {% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.net/salt-models/mcp-virtual-lab') %} |
Valentyn Yakovlev | 08acf9f | 2017-06-07 14:02:36 +0300 | [diff] [blame^] | 5 | {% set SALT_MODELS_BRANCH = os_env('SALT_MODELS_BRANCH','master') %} |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 6 | {% set SALT_MODELS_COMMIT = os_env('SALT_MODELS_COMMIT','master') %} |
| 7 | |
| 8 | # Address pools for reclass cluster model are taken in the following order: |
| 9 | # 1. environment variables, |
| 10 | # 2. config.underlay.address_pools based on fuel-devops address pools |
| 11 | # (see generated '.ini' file after underlay is created), |
| 12 | # 3. defaults |
| 13 | {% set address_pools = config.underlay.address_pools %} |
| 14 | {% set IPV4_NET_ADMIN = os_env('IPV4_NET_ADMIN', address_pools.get('admin-pool01', '192.168.10.0/24')) %} |
| 15 | {% set IPV4_NET_CONTROL = os_env('IPV4_NET_CONTROL', address_pools.get('private-pool01', '172.16.10.0/24')) %} |
| 16 | {% set IPV4_NET_TENANT = os_env('IPV4_NET_TENANT', address_pools.get('tenant-pool01', '10.1.0.0/24')) %} |
| 17 | {% set IPV4_NET_EXTERNAL = os_env('IPV4_NET_EXTERNAL', address_pools.get('external-pool01', '10.16.0.0/24')) %} |
| 18 | |
| 19 | {% set IPV4_NET_ADMIN_PREFIX = '.'.join(IPV4_NET_ADMIN.split('.')[0:3]) %} |
| 20 | {% set IPV4_NET_CONTROL_PREFIX = '.'.join(IPV4_NET_CONTROL.split('.')[0:3]) %} |
| 21 | {% set IPV4_NET_TENANT_PREFIX = '.'.join(IPV4_NET_TENANT.split('.')[0:3]) %} |
| 22 | {% set IPV4_NET_EXTERNAL_PREFIX = '.'.join(IPV4_NET_EXTERNAL.split('.')[0:3]) %} |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 23 | |
| 24 | # Install salt to the config node |
| 25 | |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 26 | #- description: (moved to cloud-init config) Configure repository on the cfg01 node |
| 27 | # cmd: |
| 28 | # echo "172.18.248.114 jenkins.mcp.mirantis.net gerrit.mcp.mirantis.net" >> /etc/hosts; |
| 29 | # echo "185.135.196.10 apt-mk.mirantis.com" >> /etc/hosts; |
| 30 | # echo "nameserver 172.18.208.44 >> /etc/resolv.conf; |
| 31 | # echo "nameserver 8.8.8.8 >> /etc/resolv.conf; |
| 32 | # which wget >/dev/null || (apt-get update; apt-get install -y wget); |
| 33 | # echo "deb [arch=amd64] http://apt-mk.mirantis.com/xenial nightly salt extra" > /etc/apt/sources.list.d/mcp_salt.list; |
| 34 | # wget -O - http://apt-mk.mirantis.com/public.gpg | apt-key add -; |
| 35 | # echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3 xenial main" > /etc/apt/sources.list.d/saltstack.list; |
| 36 | # wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3/SALTSTACK-GPG-KEY.pub | apt-key add -; |
| 37 | # node_name: {{ HOSTNAME_CFG01 }} |
| 38 | # retry: {count: 1, delay: 1} |
| 39 | # skip_fail: false |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 40 | |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 41 | #- description: Update packages on cfg01 |
| 42 | # cmd: apt-get clean; eatmydata apt-get update |
| 43 | # node_name: {{ HOSTNAME_CFG01 }} |
| 44 | # retry: {count: 1, delay: 1} |
| 45 | # skip_fail: false |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 46 | |
| 47 | - description: Installing salt master on cfg01 |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 48 | cmd: eatmydata apt-get install -y reclass git salt-master |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 49 | node_name: {{ HOSTNAME_CFG01 }} |
| 50 | retry: {count: 1, delay: 1} |
| 51 | skip_fail: false |
| 52 | |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 53 | #- description: (moved to cloud-init config) Install common packages on cfg01 |
| 54 | # cmd: eatmydata apt-get install -y python-pip wget curl tmux byobu iputils-ping traceroute htop tree |
| 55 | # node_name: {{ HOSTNAME_CFG01 }} |
| 56 | # retry: {count: 1, delay: 1} |
| 57 | # skip_fail: false |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 58 | |
| 59 | - description: Configure salt-master on cfg01 |
| 60 | cmd: | |
| 61 | cat << 'EOF' >> /etc/salt/master.d/master.conf |
| 62 | file_roots: |
| 63 | base: |
| 64 | - /usr/share/salt-formulas/env |
| 65 | pillar_opts: False |
| 66 | open_mode: True |
| 67 | reclass: &reclass |
| 68 | storage_type: yaml_fs |
| 69 | inventory_base_uri: /srv/salt/reclass |
| 70 | ext_pillar: |
| 71 | - reclass: *reclass |
| 72 | master_tops: |
| 73 | reclass: *reclass |
| 74 | EOF |
| 75 | node_name: {{ HOSTNAME_CFG01 }} |
| 76 | retry: {count: 1, delay: 1} |
| 77 | skip_fail: false |
| 78 | |
| 79 | - description: Configure GIT settings and certificates |
| 80 | cmd: touch /root/.git_trusted_certs.pem; |
| 81 | for server in git.tcpcloud.eu github.com; do |
| 82 | openssl s_client -showcerts -connect $server:443 </dev/null |
| 83 | | openssl x509 -outform PEM |
| 84 | >> /root/.git_trusted_certs.pem; |
| 85 | done; |
| 86 | HOME=/root git config --global http.sslCAInfo /root/.git_trusted_certs.pem; |
| 87 | HOME=/root git config --global user.email "tcp-qa@example.com"; |
| 88 | HOME=/root git config --global user.name "TCP QA"; |
| 89 | node_name: {{ HOSTNAME_CFG01 }} |
| 90 | retry: {count: 1, delay: 1} |
| 91 | skip_fail: false |
| 92 | |
| 93 | |
| 94 | - description: Clone reclass models with submodules |
| 95 | cmd: | |
| 96 | ssh-keyscan -H github.com >> ~/.ssh/known_hosts; |
Valentyn Yakovlev | 08acf9f | 2017-06-07 14:02:36 +0300 | [diff] [blame^] | 97 | git clone -b {{ SALT_MODELS_BRANCH }} --recurse-submodules {{ SALT_MODELS_REPOSITORY }} /srv/salt/reclass; |
| 98 | pushd /srv/salt/reclass && git checkout {{ SALT_MODELS_COMMIT }} && popd; |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 99 | |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 100 | mkdir -p /srv/salt/reclass/classes/service; |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 101 | |
| 102 | # Replace firstly to an intermediate value to avoid intersection between |
| 103 | # already replaced and replacing networks. |
| 104 | # For example, if generated IPV4_NET_ADMIN_PREFIX=10.16.0 , then there is a risk of replacing twice: |
| 105 | # 192.168.10 -> 10.16.0 (generated network for admin) |
| 106 | # 10.16.0 -> <external network> |
| 107 | # So let's replace constant networks to the keywords, and then keywords to the desired networks. |
| 108 | find /srv/salt/reclass/ -type f -exec sed -i 's/192\.168\.10\./==IPV4_NET_ADMIN_PREFIX==/g' {} + |
| 109 | find /srv/salt/reclass/ -type f -exec sed -i 's/172\.16\.10\./==IPV4_NET_CONTROL_PREFIX==/g' {} + |
| 110 | find /srv/salt/reclass/ -type f -exec sed -i 's/10\.1\.0\./==IPV4_NET_TENANT_PREFIX==/g' {} + |
| 111 | find /srv/salt/reclass/ -type f -exec sed -i 's/10\.16\.0\./==IPV4_NET_EXTERNAL_PREFIX==/g' {} + |
| 112 | |
| 113 | find /srv/salt/reclass/ -type f -exec sed -i 's/==IPV4_NET_ADMIN_PREFIX==/{{ IPV4_NET_ADMIN_PREFIX }}./g' {} + |
| 114 | find /srv/salt/reclass/ -type f -exec sed -i 's/==IPV4_NET_CONTROL_PREFIX==/{{ IPV4_NET_CONTROL_PREFIX }}./g' {} + |
| 115 | find /srv/salt/reclass/ -type f -exec sed -i 's/==IPV4_NET_TENANT_PREFIX==/{{ IPV4_NET_TENANT_PREFIX }}./g' {} + |
| 116 | find /srv/salt/reclass/ -type f -exec sed -i 's/==IPV4_NET_EXTERNAL_PREFIX==/{{ IPV4_NET_EXTERNAL_PREFIX }}./g' {} + |
| 117 | |
Dennis Dmitriev | 2d60c8e | 2017-05-12 18:34:01 +0300 | [diff] [blame] | 118 | find /srv/salt/reclass/ -type f -exec sed -i 's/apt_mk_version:.*/apt_mk_version: {{ REPOSITORY_SUITE }}/g' {} + |
| 119 | |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 120 | # Disable checkouting the model from remote repository |
| 121 | cat << 'EOF' >> /srv/salt/reclass/nodes/{{ HOSTNAME_CFG01 }}.yml |
| 122 | # local storage |
| 123 | reclass: |
| 124 | storage: |
| 125 | data_source: |
| 126 | engine: local |
| 127 | EOF |
| 128 | |
| 129 | # Show the changes to the console |
| 130 | cd /srv/salt/reclass/; git diff |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 131 | node_name: {{ HOSTNAME_CFG01 }} |
| 132 | retry: {count: 1, delay: 1} |
| 133 | skip_fail: false |
| 134 | |
| 135 | - description: Configure reclass |
| 136 | cmd: | |
| 137 | FORMULA_PATH=${FORMULA_PATH:-/usr/share/salt-formulas}; |
Tatyana Leontovich | eed70d7 | 2017-05-25 16:32:17 +0300 | [diff] [blame] | 138 | FORMULA_REPOSITORY=${FORMULA_REPOSITORY:-deb [arch=amd64] http://apt-mk.mirantis.com/xenial {{ REPOSITORY_SUITE }} salt}; |
Tatyana Leontovich | 3c6aa45 | 2017-04-25 15:04:40 +0300 | [diff] [blame] | 139 | FORMULA_GPG=${FORMULA_GPG:-http://apt-mk.mirantis.com/public.gpg}; |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 140 | which wget > /dev/null || (apt-get update; apt-get install -y wget); |
Tatyana Leontovich | 543afa9 | 2017-04-21 14:48:03 +0300 | [diff] [blame] | 141 | echo "${FORMULA_REPOSITORY}" > /etc/apt/sources.list.d/mcp_salt.list; |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 142 | wget -O - "${FORMULA_GPG}" | apt-key add -; |
| 143 | apt-get clean; apt-get update; |
| 144 | [ ! -d /srv/salt/reclass/classes/service ] && mkdir -p /srv/salt/reclass/classes/service; |
Tatyana Leontovich | eed70d7 | 2017-05-25 16:32:17 +0300 | [diff] [blame] | 145 | declare -a formula_services=("linux" "reclass" "salt" "openssh" "ntp" "git" "nginx" "collectd" "sensu" "heka" "sphinx" "keystone" "mysql" "grafana" "haproxy" "rsyslog" "horizon" "prometheus" "telegraf"); |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 146 | echo -e "\nInstalling all required salt formulas\n"; |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 147 | eatmydata apt-get install -y "${formula_services[@]/#/salt-formula-}"; |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 148 | for formula_service in "${formula_services[@]}"; do |
| 149 | echo -e "\nLink service metadata for formula ${formula_service} ...\n"; |
| 150 | [ ! -L "/srv/salt/reclass/classes/service/${formula_service}" ] && ln -s ${FORMULA_PATH}/reclass/service/${formula_service} /srv/salt/reclass/classes/service/${formula_service}; |
| 151 | done; |
| 152 | [ ! -d /srv/salt/env ] && mkdir -p /srv/salt/env; |
| 153 | [ ! -L /srv/salt/env/prd ] && ln -s ${FORMULA_PATH}/env /srv/salt/env/prd; |
| 154 | [ ! -d /etc/reclass ] && mkdir /etc/reclass; |
| 155 | |
| 156 | cat << 'EOF' >> /etc/reclass/reclass-config.yml |
| 157 | storage_type: yaml_fs |
| 158 | pretty_print: True |
| 159 | output: yaml |
| 160 | inventory_base_uri: /srv/salt/reclass |
| 161 | EOF |
| 162 | node_name: {{ HOSTNAME_CFG01 }} |
| 163 | retry: {count: 1, delay: 1} |
| 164 | skip_fail: false |
| 165 | |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 166 | - description: Restart salt-master service |
| 167 | cmd: | |
| 168 | systemctl restart salt-master; |
| 169 | node_name: {{ HOSTNAME_CFG01 }} |
| 170 | retry: {count: 1, delay: 5} |
| 171 | skip_fail: false |
| 172 | |
| 173 | {% for ssh in config.underlay.ssh %} |
| 174 | - description: Configure salt-minion on {{ ssh['node_name'] }} |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 175 | cmd: | |
| 176 | [ ! -d /etc/salt/minion.d ] && mkdir -p /etc/salt/minion.d; |
| 177 | cat << "EOF" >> /etc/salt/minion.d/minion.conf |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 178 | id: {{ ssh['node_name'] }} |
| 179 | master: {{ config.salt.salt_master_host }} |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 180 | EOF |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 181 | eatmydata apt-get install -y salt-minion; |
Dennis Dmitriev | a9e6da8 | 2017-04-26 23:23:22 +0300 | [diff] [blame] | 182 | echo "Check for system info and metadata availability ..."; |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 183 | salt-call --no-color grains.items; |
Dennis Dmitriev | a9e6da8 | 2017-04-26 23:23:22 +0300 | [diff] [blame] | 184 | salt-call --no-color pillar.items; |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 185 | node_name: {{ ssh['node_name'] }} |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 186 | retry: {count: 1, delay: 1} |
| 187 | skip_fail: false |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 188 | {% endfor %} |
| 189 | |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 190 | |
Dennis Dmitriev | 8f0f80f | 2017-04-27 01:04:39 +0300 | [diff] [blame] | 191 | - description: Accept salt keys from all the nodes |
| 192 | cmd: salt-key -A -y |
| 193 | node_name: {{ HOSTNAME_CFG01 }} |
| 194 | retry: {count: 1, delay: 5} |
| 195 | skip_fail: true |
| 196 | |
| 197 | |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 198 | - description: Configure salt adoptors on cfg01 |
| 199 | cmd: | |
| 200 | ln -s /usr/lib/python2.7/dist-packages/reclass/adapters/salt.py /usr/local/sbin/reclass-salt; |
| 201 | chmod +x /usr/lib/python2.7/dist-packages/reclass/adapters/salt.py |
| 202 | node_name: {{ HOSTNAME_CFG01 }} |
| 203 | retry: {count: 1, delay: 1} |
| 204 | skip_fail: false |
| 205 | |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 206 | |
| 207 | # Prepare salt services and nodes settings |
| 208 | - description: Run 'linux' formula on cfg01 |
| 209 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 210 | -C 'I@salt:master' state.sls linux; |
| 211 | node_name: {{ HOSTNAME_CFG01 }} |
| 212 | retry: {count: 1, delay: 5} |
| 213 | skip_fail: false |
| 214 | |
Dennis Dmitriev | 8f0f80f | 2017-04-27 01:04:39 +0300 | [diff] [blame] | 215 | |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 216 | - description: Run 'openssh' formula on cfg01 |
| 217 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 218 | -C 'I@salt:master' state.sls openssh; |
| 219 | salt --hard-crash --state-output=mixed --state-verbose=False |
| 220 | -C 'I@salt:master' cmd.run "sed -i 's/PasswordAuthentication no/PasswordAuthentication |
| 221 | yes/' /etc/ssh/sshd_config && service ssh restart"; |
| 222 | node_name: {{ HOSTNAME_CFG01 }} |
| 223 | retry: {count: 3, delay: 5} |
| 224 | skip_fail: false |
| 225 | |
Dennis Dmitriev | 8f0f80f | 2017-04-27 01:04:39 +0300 | [diff] [blame] | 226 | |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 227 | - description: '*Workaround* of the bug https://mirantis.jira.com/browse/PROD-7962' |
| 228 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 229 | '*' cmd.run "echo ' StrictHostKeyChecking no' >> /root/.ssh/config" |
| 230 | node_name: {{ HOSTNAME_CFG01 }} |
| 231 | retry: {count: 1, delay: 1} |
| 232 | skip_fail: false |
| 233 | |
Dennis Dmitriev | 2d60c8e | 2017-05-12 18:34:01 +0300 | [diff] [blame] | 234 | - description: Run 'salt.master' formula on cfg01 |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 235 | cmd: timeout 120 salt --hard-crash --state-output=mixed --state-verbose=False |
| 236 | -C 'I@salt:master' state.sls salt.master.service; |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 237 | node_name: {{ HOSTNAME_CFG01 }} |
Dennis Dmitriev | 4db5bf2 | 2017-05-13 19:31:17 +0300 | [diff] [blame] | 238 | retry: {count: 2, delay: 5} |
Dennis Dmitriev | 2d60c8e | 2017-05-12 18:34:01 +0300 | [diff] [blame] | 239 | skip_fail: false |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 240 | |
Dennis Dmitriev | 2d60c8e | 2017-05-12 18:34:01 +0300 | [diff] [blame] | 241 | - description: Run 'salt' formula on cfg01 with workaround proposed in PROD-10894 |
Dennis Dmitriev | 4db5bf2 | 2017-05-13 19:31:17 +0300 | [diff] [blame] | 242 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 243 | -C 'I@salt:master' state.sls salt; |
| 244 | salt --hard-crash --state-output=mixed --state-verbose=False |
| 245 | -C 'I@salt:master' saltutil.sync_all |
Dennis Dmitriev | 2d60c8e | 2017-05-12 18:34:01 +0300 | [diff] [blame] | 246 | node_name: {{ HOSTNAME_CFG01 }} |
Dennis Dmitriev | 4db5bf2 | 2017-05-13 19:31:17 +0300 | [diff] [blame] | 247 | retry: {count: 5, delay: 5} |
Dennis Dmitriev | 2d60c8e | 2017-05-12 18:34:01 +0300 | [diff] [blame] | 248 | skip_fail: false |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 249 | |
| 250 | - description: Generate inventory for all the nodes to the /srv/salt/reclass/nodes/_generated |
| 251 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 252 | -C 'I@salt:master' state.sls reclass |
| 253 | node_name: {{ HOSTNAME_CFG01 }} |
| 254 | retry: {count: 1, delay: 5} |
| 255 | skip_fail: false |
| 256 | |
| 257 | - description: Refresh pillars on all minions |
| 258 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar |
| 259 | node_name: {{ HOSTNAME_CFG01 }} |
| 260 | retry: {count: 1, delay: 5} |
| 261 | skip_fail: false |
| 262 | |
| 263 | - description: Sync all salt resources |
| 264 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all |
| 265 | node_name: {{ HOSTNAME_CFG01 }} |
| 266 | retry: {count: 1, delay: 5} |
| 267 | skip_fail: false |
| 268 | |
| 269 | - description: Show reclass-salt --top |
Dennis Dmitriev | 4db5bf2 | 2017-05-13 19:31:17 +0300 | [diff] [blame] | 270 | cmd: reclass-salt --top |
| 271 | node_name: {{ HOSTNAME_CFG01 }} |
| 272 | retry: {count: 1, delay: 5} |
| 273 | skip_fail: false |
| 274 | |
| 275 | - description: Execute salt.minion.cert |
| 276 | cmd: salt-call --no-color state.sls salt.minion.cert -l info; |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 277 | node_name: {{ HOSTNAME_CFG01 }} |
| 278 | retry: {count: 1, delay: 5} |
| 279 | skip_fail: false |
| 280 | |
| 281 | |
| 282 | # Bootstrap all nodes |
| 283 | |
Dennis Dmitriev | a9e6da8 | 2017-04-26 23:23:22 +0300 | [diff] [blame] | 284 | - description: Configure linux on other nodes |
Dennis Dmitriev | 8f0f80f | 2017-04-27 01:04:39 +0300 | [diff] [blame] | 285 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C '* and not |
Dennis Dmitriev | a9e6da8 | 2017-04-26 23:23:22 +0300 | [diff] [blame] | 286 | cfg01*' state.sls linux |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 287 | node_name: {{ HOSTNAME_CFG01 }} |
| 288 | retry: {count: 1, delay: 5} |
| 289 | skip_fail: false |
| 290 | |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 291 | - description: Configure openssh on all nodes |
| 292 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C '* and not |
Dennis Dmitriev | a9e6da8 | 2017-04-26 23:23:22 +0300 | [diff] [blame] | 293 | cfg01*' state.sls openssh;salt --hard-crash --state-output=mixed --state-verbose=False |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 294 | -C '* and not cfg*' cmd.run "sed -i 's/PasswordAuthentication no/PasswordAuthentication |
| 295 | yes/' /etc/ssh/sshd_config && service ssh restart" |
| 296 | node_name: {{ HOSTNAME_CFG01 }} |
| 297 | retry: {count: 1, delay: 5} |
| 298 | skip_fail: false |
| 299 | |
Dennis Dmitriev | a9e6da8 | 2017-04-26 23:23:22 +0300 | [diff] [blame] | 300 | - description: Configure salt.minion on other nodes |
Dennis Dmitriev | 8f0f80f | 2017-04-27 01:04:39 +0300 | [diff] [blame] | 301 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C '* and not |
Dennis Dmitriev | a9e6da8 | 2017-04-26 23:23:22 +0300 | [diff] [blame] | 302 | cfg01*' state.sls salt.minion |
Tatyana Leontovich | d8bf14f | 2017-04-19 12:20:50 +0300 | [diff] [blame] | 303 | node_name: {{ HOSTNAME_CFG01 }} |
| 304 | retry: {count: 3, delay: 5} |
| 305 | skip_fail: false |
| 306 | |
| 307 | - description: Check salt minion versions on slaves |
| 308 | cmd: salt '*' test.version |
| 309 | node_name: {{ HOSTNAME_CFG01 }} |
| 310 | retry: {count: 1, delay: 5} |
| 311 | skip_fail: false |
| 312 | |
| 313 | - description: Check salt top states on nodes |
| 314 | cmd: salt '*' state.show_top |
| 315 | node_name: {{ HOSTNAME_CFG01 }} |
| 316 | retry: {count: 1, delay: 5} |
| 317 | skip_fail: false |
| 318 | |
| 319 | - description: Configure ntp and rsyslog on nodes |
| 320 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' state.sls ntp,rsyslog |
| 321 | node_name: {{ HOSTNAME_CFG01 }} |
| 322 | retry: {count: 1, delay: 10} |
| 323 | skip_fail: false |
| 324 | |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 325 | - description: Hack gtw node |
| 326 | cmd: salt 'gtw*' cmd.run "ip addr del {{ IPV4_NET_CONTROL_PREFIX }}.110/24 dev ens4; ip addr flush dev ens4"; |
| 327 | node_name: {{ HOSTNAME_CFG01 }} |
| 328 | retry: {count: 1, delay: 10} |
| 329 | skip_fail: false |
| 330 | |
| 331 | - description: Hack cmp01 node |
| 332 | cmd: salt 'cmp01*' cmd.run "ip addr del {{ IPV4_NET_CONTROL_PREFIX }}.105/24 dev ens4; ip addr flush dev ens4"; |
| 333 | node_name: {{ HOSTNAME_CFG01 }} |
| 334 | retry: {count: 1, delay: 10} |
| 335 | skip_fail: false |
| 336 | |
| 337 | - description: Hack cmp02 node |
| 338 | cmd: salt 'cmp02*' cmd.run "ip addr del {{ IPV4_NET_CONTROL_PREFIX }}.106/24 dev ens4; ip addr flush dev ens4"; |
| 339 | node_name: {{ HOSTNAME_CFG01 }} |
| 340 | retry: {count: 1, delay: 10} |
| 341 | skip_fail: false |