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