blob: fd05bcc3154148fb765324657468d8e4151c034e [file] [log] [blame]
Dennis Dmitriev492813e2017-08-09 15:08:58 +03001{# Collection of common macroses shared across different deployments #}
2
Sergii Golovatiuk50f91892017-08-04 18:11:06 +02003{% set SALT_MODELS_BRANCH = os_env('SALT_MODELS_BRANCH','master') %}
4{% set SALT_MODELS_COMMIT = os_env('SALT_MODELS_COMMIT','master') %}
5{# 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 #}
6{% set SALT_MODELS_REF_CHANGE = os_env('SALT_MODELS_REF_CHANGE', '') %}
7{# Pin to a specified commit in salt-models/reclass-system #}
Dmitry Tyzhnenko778515f2017-08-25 14:52:54 +03008{% set SALT_MODELS_SYSTEM_REPOSITORY = os_env('SALT_MODELS_SYSTEM_REPOSITORY','https://gerrit.mcp.mirantis.net/salt-models/reclass-system') %}
Sergii Golovatiuk50f91892017-08-04 18:11:06 +02009{% set SALT_MODELS_SYSTEM_COMMIT = os_env('SALT_MODELS_SYSTEM_COMMIT','') %}
Dmitry Tyzhnenko778515f2017-08-25 14:52:54 +030010{% set SALT_MODELS_SYSTEM_REF_CHANGE = os_env('SALT_MODELS_SYSTEM_REF_CHANGE','') %}
sgudz4d816eb2017-11-13 11:58:05 +020011{% set COOKIECUTTER_REF_CHANGE = os_env('COOKIECUTTER_REF_CHANGE','') %}
sgudza399dc72018-01-18 17:13:48 +020012{% set COOKIECUTTER_TEMPLATE_COMMIT = os_env('COOKIECUTTER_TEMPLATE_COMMIT','') %}
sgudzcced67d2017-10-11 15:56:09 +030013{% set ENVIRONMENT_TEMPLATE_REF_CHANGE = os_env('ENVIRONMENT_TEMPLATE_REF_CHANGE','') %}
Sergii Golovatiuk50f91892017-08-04 18:11:06 +020014
Dennis Dmitriev492813e2017-08-09 15:08:58 +030015{% set REPOSITORY_SUITE = os_env('REPOSITORY_SUITE', 'testing') %}
Dennis Dmitrievcf777802018-02-14 18:09:55 +020016{% set FORMULA_REPOSITORY = os_env('FORMULA_REPOSITORY', 'deb [arch=amd64] http://apt.mirantis.com/${DISTRIB_CODENAME} ' + REPOSITORY_SUITE + ' salt extra') %}
Dennis Dmitriev3fbbc7f2017-12-21 15:42:14 +020017{% set FORMULA_GPG = os_env('FORMULA_GPG', 'http://apt.mirantis.com/public.gpg') %}
Dennis Dmitrievcf777802018-02-14 18:09:55 +020018{% set SALT_REPOSITORY = os_env('SALT_REPOSITORY', "deb [arch=amd64] http://apt.mirantis.com/${DISTRIB_CODENAME}/salt/2016.3 " + REPOSITORY_SUITE + " main") %}
19{% set SALT_GPG = os_env('SALT_GPG', 'http://apt.mirantis.com/public.gpg') %}
20{% set UBUNTU_REPOSITORY = os_env('UBUNTU_REPOSITORY', "deb [arch=amd64] http://mirror.mirantis.com/" + REPOSITORY_SUITE + "/ubuntu/ ${DISTRIB_CODENAME} main restricted universe") %}
21{% set UBUNTU_UPDATES_REPOSITORY = os_env('UBUNTU_UPDATES_REPOSITORY', "deb [arch=amd64] http://mirror.mirantis.com/" + REPOSITORY_SUITE + "/ubuntu/ ${DISTRIB_CODENAME}-updates main restricted universe") %}
22{% set UBUNTU_SECURITY_REPOSITORY = os_env('UBUNTU_SECURITY_REPOSITORY', "deb [arch=amd64] http://mirror.mirantis.com/" + REPOSITORY_SUITE + "/ubuntu/ ${DISTRIB_CODENAME}-security main restricted universe") %}
Dennis Dmitriev492813e2017-08-09 15:08:58 +030023
Sergii Golovatiuk50f91892017-08-04 18:11:06 +020024{# Address pools for reclass cluster model are taken in the following order:
25 # 1. environment variables,
26 # 2. config.underlay.address_pools based on fuel-devops address pools
27 # (see generated '.ini' file after underlay is created),
28 # 3. defaults #}
29{% set address_pools = config.underlay.address_pools %}
30{% set IPV4_NET_ADMIN = os_env('IPV4_NET_ADMIN', address_pools.get('admin-pool01', '192.168.10.0/24')) %}
31{% set IPV4_NET_CONTROL = os_env('IPV4_NET_CONTROL', address_pools.get('private-pool01', '172.16.10.0/24')) %}
32{% set IPV4_NET_TENANT = os_env('IPV4_NET_TENANT', address_pools.get('tenant-pool01', '10.1.0.0/24')) %}
33{% set IPV4_NET_EXTERNAL = os_env('IPV4_NET_EXTERNAL', address_pools.get('external-pool01', '10.16.0.0/24')) %}
34{% set IPV4_NET_ADMIN_PREFIX = '.'.join(IPV4_NET_ADMIN.split('.')[0:3]) %}
35{% set IPV4_NET_CONTROL_PREFIX = '.'.join(IPV4_NET_CONTROL.split('.')[0:3]) %}
36{% set IPV4_NET_TENANT_PREFIX = '.'.join(IPV4_NET_TENANT.split('.')[0:3]) %}
37{% set IPV4_NET_EXTERNAL_PREFIX = '.'.join(IPV4_NET_EXTERNAL.split('.')[0:3]) %}
38
Victor Ryzhenkin4e077ad2017-08-10 13:42:11 +040039{# Format for formula replacement:
40 # space separated string:
41 # export SALT_FORMULAS_REFS='apache:refs/changes/xxxx kubernetes:refs/changes/xxxx' #}
42
43{% set SALT_FORMULAS_REFS = os_env('SALT_FORMULAS_REFS', '') %}
44{% set SALT_FORMULAS_REPO = os_env('SALT_FORMULAS_REPO', 'https://gerrit.mcp.mirantis.net/salt-formulas') %}
45
Victor Ryzhenkin66593e92017-11-28 19:38:33 +040046# Needed for using different models in different templates
Dennis Dmitrievbdb2b9b2017-12-22 18:00:18 +020047{% set CLUSTER_NAME = os_env('CLUSTER_NAME', LAB_CONFIG_NAME) %}
Victor Ryzhenkin66593e92017-11-28 19:38:33 +040048
Dennis Dmitriev492813e2017-08-09 15:08:58 +030049
Dennis Dmitriev3fbbc7f2017-12-21 15:42:14 +020050{%- macro MACRO_INSTALL_PACKAGES_ON_NODES(NODE_NAME) %}
51{#####################################################}
52
53- description: 'Configure key on nodes and install packages'
54 cmd: |
55 rm -rf trusted* ;
56 rm -rf /etc/apt/sources.list ;
Dennis Dmitrievcf777802018-02-14 18:09:55 +020057 . /etc/lsb-release; # Get DISTRIB_CODENAME variable
Dennis Dmitriev3fbbc7f2017-12-21 15:42:14 +020058 echo "{{ FORMULA_REPOSITORY }}" > /etc/apt/sources.list.d/mcp_salt.list;
59 wget -O - "{{ FORMULA_GPG }}" | apt-key add -;
60 echo "{{ SALT_REPOSITORY }}" > /etc/apt/sources.list.d/mcp_saltstack.list;
61 wget -O - "{{ SALT_GPG }}" | apt-key add -;
62 echo "{{ UBUNTU_REPOSITORY }}" > /etc/apt/sources.list.d/ubuntu.list
63 echo "{{ UBUNTU_UPDATES_REPOSITORY }}" > /etc/apt/sources.list.d/ubuntu_updates.list
64 echo "{{ UBUNTU_SECURITY_REPOSITORY }}" > /etc/apt/sources.list.d/ubuntu_security.list
65 eatmydata apt-get clean && apt-get update;
66 node_name: {{ NODE_NAME }}
67 retry: {count: 1, delay: 5}
68 skip_fail: false
69
70{%- endmacro %}
71
72
Dennis Dmitriev492813e2017-08-09 15:08:58 +030073{%- macro MACRO_INSTALL_SALT_MASTER() %}
74{######################################}
75- description: Installing salt master on cfg01
Dennis Dmitrievcf777802018-02-14 18:09:55 +020076 cmd: |
77 which wget >/dev/null || (apt-get update; apt-get install -y wget);
78 # Configure ubuntu and salt repositories
79 . /etc/lsb-release; # Get DISTRIB_CODENAME variable
80 echo "{{ UBUNTU_REPOSITORY }}" > /etc/apt/sources.list
81 echo "{{ UBUNTU_UPDATES_REPOSITORY }}" >> /etc/apt/sources.list
82 echo "{{ UBUNTU_SECURITY_REPOSITORY }}" >> /etc/apt/sources.list
83
84 echo "{{ FORMULA_REPOSITORY }}" > /etc/apt/sources.list.d/mcp_salt.list;
85 wget -O - {{ FORMULA_GPG }} | apt-key add -;
86 echo "{{ SALT_REPOSITORY }}" > /etc/apt/sources.list.d/mcp_saltstack.list;
87 wget -O - {{ SALT_GPG }} | apt-key add -;
88
89 apt-get clean
90 apt-get update
91
92 # Install salt-master and reclass
93 eatmydata apt-get install -y --allow-unauthenticated reclass salt-master
94 # Install common packages
95 eatmydata apt-get install -y python-pip git curl tmux byobu iputils-ping traceroute htop tree mc
Dennis Dmitriev492813e2017-08-09 15:08:58 +030096 node_name: {{ HOSTNAME_CFG01 }}
97 retry: {count: 1, delay: 1}
98 skip_fail: false
99
Dennis Dmitrievda9be462018-01-24 21:20:09 +0200100- description: Remove any existing minion keys
101 cmd: salt-key -y -D || true
102 node_name: {{ HOSTNAME_CFG01 }}
103 retry: {count: 1, delay: 1}
104 skip_fail: false
105
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300106- description: Configure salt-master on cfg01
107 cmd: |
Dennis Dmitrieva578c772018-01-24 21:02:15 +0200108 cat << 'EOF' > /etc/salt/master.d/master.conf
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300109 file_roots:
110 base:
111 - /usr/share/salt-formulas/env
112 pillar_opts: False
113 open_mode: True
114 reclass: &reclass
115 storage_type: yaml_fs
116 inventory_base_uri: /srv/salt/reclass
117 ext_pillar:
118 - reclass: *reclass
119 master_tops:
120 reclass: *reclass
121 EOF
122 node_name: {{ HOSTNAME_CFG01 }}
123 retry: {count: 1, delay: 1}
124 skip_fail: false
125
126- description: Configure GIT settings and certificates
Dennis Dmitriev3e731a42017-08-30 17:12:59 +0300127 cmd: |
128 set -e;
Dennis Dmitriev3fbbc7f2017-12-21 15:42:14 +0200129 #touch /root/.git_trusted_certs.pem;
130 #for server in github.com; do \
131 # openssl s_client -showcerts -connect $server:443 </dev/null \
132 # | openssl x509 -outform PEM \
133 # >> /root/.git_trusted_certs.pem;
134 #done;
135 #HOME=/root git config --global http.sslCAInfo /root/.git_trusted_certs.pem;
136 HOME=/root git config --global user.email "mcp-integration-qa@example.com";
137 HOME=/root git config --global user.name "MCP Integration QA";
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300138 node_name: {{ HOSTNAME_CFG01 }}
139 retry: {count: 1, delay: 1}
140 skip_fail: false
141{%- endmacro %}
142
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300143{%- macro MACRO_CLONE_RECLASS_MODELS(IS_CONTRAIL_LAB=false) %}
144{############################################################}
Dennis Dmitrieva5f38e42017-09-21 21:52:25 +0300145{# Creates a 'cluster' model from cookiecutter-templates and 'environment' model from uploaded template #}
146
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300147- description: Clone reclass models with submodules
148 cmd: |
Dennis Dmitriev3e731a42017-08-30 17:12:59 +0300149 set -e;
Dennis Dmitriev75776c52017-12-26 18:22:53 +0200150 set -x;
Dennis Dmitriev3fbbc7f2017-12-21 15:42:14 +0200151 #ssh-keyscan -H github.com >> ~/.ssh/known_hosts;
Dennis Dmitrievf00a3842018-01-24 16:44:26 +0200152
153 # In the day01 image, /srv/salt/reclass directory is already exists, so clone the model into the reclass.tmp directory
154 export GIT_SSL_NO_VERIFY=true; git clone -b {{ SALT_MODELS_BRANCH }} {{ SALT_MODELS_REPOSITORY }} /srv/salt/reclass.tmp;
Dennis Dmitriev70dd3062018-01-24 20:45:49 +0200155 rsync -a /srv/salt/reclass.tmp/ /srv/salt/reclass;
Dennis Dmitrievf00a3842018-01-24 16:44:26 +0200156
Dennis Dmitriev55ddd792017-12-22 16:35:57 +0200157 pushd /srv/salt/reclass;
158 git config submodule."classes/system".url "{{ SALT_MODELS_SYSTEM_REPOSITORY }}";
159 git submodule update --init --recursive;
Sergii Golovatiuk50f91892017-08-04 18:11:06 +0200160 {%- if SALT_MODELS_REF_CHANGE != '' %}
161 {%- for item in SALT_MODELS_REF_CHANGE.split(" ") %}
Dennis Dmitriev55ddd792017-12-22 16:35:57 +0200162 git fetch {{ SALT_MODELS_REPOSITORY }} {{ item }} && git cherry-pick FETCH_HEAD;
Sergii Golovatiuk50f91892017-08-04 18:11:06 +0200163 {%- endfor %}
164 {%- elif SALT_MODELS_COMMIT != 'master' %}
Dennis Dmitriev55ddd792017-12-22 16:35:57 +0200165 git checkout {{ SALT_MODELS_COMMIT }};
Sergii Golovatiuk50f91892017-08-04 18:11:06 +0200166 {%- endif %}
167 {%- if SALT_MODELS_SYSTEM_COMMIT != '' %}
Dennis Dmitriev55ddd792017-12-22 16:35:57 +0200168 pushd classes/system/;
169 git checkout {{ SALT_MODELS_SYSTEM_COMMIT }};
170 popd;
sgudz4d816eb2017-11-13 11:58:05 +0200171 {%- elif SALT_MODELS_SYSTEM_REF_CHANGE != '' %}
Dmitry Tyzhnenko778515f2017-08-25 14:52:54 +0300172 pushd classes/system/ && \
173 {%- for item in SALT_MODELS_SYSTEM_REF_CHANGE.split(" ") %}
Dennis Dmitriev55ddd792017-12-22 16:35:57 +0200174 git fetch {{ SALT_MODELS_SYSTEM_REPOSITORY }} {{ item }} && git cherry-pick FETCH_HEAD;
Dmitry Tyzhnenko778515f2017-08-25 14:52:54 +0300175 {%- endfor %}
Dennis Dmitriev55ddd792017-12-22 16:35:57 +0200176 popd;
Sergii Golovatiuk50f91892017-08-04 18:11:06 +0200177 {%- endif %}
178 popd;
179 mkdir -p /srv/salt/reclass/classes/service;
Dennis Dmitrieva14f5562017-10-02 12:59:53 +0300180 rm -rf /srv/salt/reclass/nodes/ # For backward compatibility. New cfg node will be regenerated here
Dennis Dmitrievb2e78be2017-09-26 23:25:24 +0300181 mkdir -p /srv/salt/reclass/nodes/_generated/;
Sergii Golovatiuk50f91892017-08-04 18:11:06 +0200182
183 # Replace firstly to an intermediate value to avoid intersection between
184 # already replaced and replacing networks.
185 # For example, if generated IPV4_NET_ADMIN_PREFIX=10.16.0 , then there is a risk of replacing twice:
186 # 192.168.10 -> 10.16.0 (generated network for admin)
187 # 10.16.0 -> <external network>
188 # So let's replace constant networks to the keywords, and then keywords to the desired networks.
Dennis Dmitriev9d9ba9f2017-09-13 17:34:03 +0300189 export REPLACE_DIRS="/srv/salt/reclass/classes/ /srv/salt/reclass/nodes/"
190 find ${REPLACE_DIRS} -type f -exec sed -i 's/192\.168\.10\./==IPV4_NET_ADMIN_PREFIX==/g' {} +
191 find ${REPLACE_DIRS} -type f -exec sed -i 's/172\.16\.10\./==IPV4_NET_CONTROL_PREFIX==/g' {} +
192 find ${REPLACE_DIRS} -type f -exec sed -i 's/10\.1\.0\./==IPV4_NET_TENANT_PREFIX==/g' {} +
193 find ${REPLACE_DIRS} -type f -exec sed -i 's/10\.16\.0\./==IPV4_NET_EXTERNAL_PREFIX==/g' {} +
Sergii Golovatiuk50f91892017-08-04 18:11:06 +0200194
Dennis Dmitriev9d9ba9f2017-09-13 17:34:03 +0300195 find ${REPLACE_DIRS} -type f -exec sed -i 's/==IPV4_NET_ADMIN_PREFIX==/{{ IPV4_NET_ADMIN_PREFIX }}./g' {} +
196 find ${REPLACE_DIRS} -type f -exec sed -i 's/==IPV4_NET_CONTROL_PREFIX==/{{ IPV4_NET_CONTROL_PREFIX }}./g' {} +
197 find ${REPLACE_DIRS} -type f -exec sed -i 's/==IPV4_NET_TENANT_PREFIX==/{{ IPV4_NET_TENANT_PREFIX }}./g' {} +
198 find ${REPLACE_DIRS} -type f -exec sed -i 's/==IPV4_NET_EXTERNAL_PREFIX==/{{ IPV4_NET_EXTERNAL_PREFIX }}./g' {} +
Sergii Golovatiuk50f91892017-08-04 18:11:06 +0200199
Dennis Dmitriev9d9ba9f2017-09-13 17:34:03 +0300200 find ${REPLACE_DIRS} -type f -exec sed -i 's/apt_mk_version:.*/apt_mk_version: {{ REPOSITORY_SUITE }}/g' {} +
Sergii Golovatiuk50f91892017-08-04 18:11:06 +0200201
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300202 {%- if IS_CONTRAIL_LAB %}
203 # vSRX IPs for tcp-qa images have 172.16.10.90 hardcoded
Dennis Dmitriev9d9ba9f2017-09-13 17:34:03 +0300204 find ${REPLACE_DIRS} -type f -exec sed -i 's/opencontrail_router01_address:.*/opencontrail_router01_address: 172.16.10.90/g' {} +
Tatyana Leontovich3424bf62017-09-15 12:13:54 +0300205 find ${REPLACE_DIRS} -type f -exec sed -i 's/infra_config_deploy_address: 1.*/infra_config_deploy_address: {{ IPV4_NET_ADMIN_PREFIX }}.15/g' {} +
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300206 {%- endif %}
207
Dennis Dmitrievf5bef572017-12-24 17:52:41 +0200208 # Override some context parameters
209 {%- set CLUSTER_PATH = '/srv/salt/reclass/classes/cluster/' + CLUSTER_NAME %}
210 find {{ CLUSTER_PATH }} -type f -exec sed -i 's/cluster_name: .*/cluster_name: {{ CLUSTER_NAME }}/g' {} +
211 find {{ CLUSTER_PATH }} -type f -exec sed -i 's/cluster_domain: .*/cluster_domain: {{ DOMAIN_NAME }}/g' {} +
212
Sergii Golovatiuk50f91892017-08-04 18:11:06 +0200213 # Disable checkouting the model from remote repository
Dennis Dmitriev92295c02018-02-02 13:18:25 +0200214 cat << 'EOF' > /srv/salt/reclass/nodes/_generated/cfg01.{{ DOMAIN_NAME }}.yml
Dennis Dmitrievb2e78be2017-09-26 23:25:24 +0300215 classes:
Victor Ryzhenkin66593e92017-11-28 19:38:33 +0400216 - cluster.{{ CLUSTER_NAME }}.infra.config
Dennis Dmitrievb2e78be2017-09-26 23:25:24 +0300217 parameters:
218 _param:
219 linux_system_codename: xenial
220 reclass_data_revision: master
221 linux:
222 system:
223 name: cfg01
224 domain: {{ DOMAIN_NAME }}
Sergii Golovatiuk50f91892017-08-04 18:11:06 +0200225 reclass:
226 storage:
227 data_source:
228 engine: local
229 EOF
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300230
231 # Show the changes to the console
232 cd /srv/salt/reclass/; git diff
233 node_name: {{ HOSTNAME_CFG01 }}
234 retry: {count: 1, delay: 1}
235 skip_fail: false
236{%- endmacro %}
237
238
sgudz160b7302017-12-22 17:01:10 +0200239{%- macro MACRO_GENERATE_COOKIECUTTER_MODEL(IS_CONTRAIL_LAB=false, CONTROL_VLAN=None, TENANT_VLAN=None, CLUSTER_PRODUCT_MODELS='') %}
Dennis Dmitriev9f141af2017-09-28 17:21:01 +0300240{###################################################################}
Dennis Dmitriev1c1352a2017-09-28 21:45:27 +0300241{%- set CLUSTER_CONTEXT_PATH = '/tmp/' + CLUSTER_CONTEXT_NAME %}
Dennis Dmitriev92295c02018-02-02 13:18:25 +0200242- description: "[EXPERIMENTAL] Upload cookiecutter-templates context to cfg01.{{ DOMAIN_NAME }}"
Dennis Dmitrievccdc87a2017-09-28 17:43:54 +0300243 upload:
244 local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
245 local_filename: {{ CLUSTER_CONTEXT_NAME }}
Dennis Dmitriev1c1352a2017-09-28 21:45:27 +0300246 remote_path: /tmp/
Dennis Dmitrievccdc87a2017-09-28 17:43:54 +0300247 node_name: {{ HOSTNAME_CFG01 }}
248
Dennis Dmitrieva5f38e42017-09-21 21:52:25 +0300249- description: Create cluster model from cookiecutter templates
250 cmd: |
251 set -e;
252 pip install cookiecutter
253 export GIT_SSL_NO_VERIFY=true; git clone https://gerrit.mcp.mirantis.net/mk/cookiecutter-templates /tmp/cookiecutter-templates
sgudz4d816eb2017-11-13 11:58:05 +0200254
sgudza399dc72018-01-18 17:13:48 +0200255 {%- if COOKIECUTTER_TEMPLATE_COMMIT != '' %}
256 pushd /tmp/cookiecutter-templates
257 git checkout {{ COOKIECUTTER_TEMPLATE_COMMIT }}
258 popd
259 {%- endif %}
260
sgudz4d816eb2017-11-13 11:58:05 +0200261 {%- if COOKIECUTTER_REF_CHANGE != '' %}
262 pushd /tmp/cookiecutter-templates
263 git fetch https://gerrit.mcp.mirantis.net/mk/cookiecutter-templates {{ COOKIECUTTER_REF_CHANGE }} && git checkout FETCH_HEAD
264 popd
265 {%- endif %}
266
Dennis Dmitrieva5f38e42017-09-21 21:52:25 +0300267 mkdir -p /srv/salt/reclass/classes/cluster/
268 mkdir -p /srv/salt/reclass/classes/system/
269 mkdir -p /srv/salt/reclass/classes/service/
Dennis Dmitrieva14f5562017-10-02 12:59:53 +0300270 rm -rf /srv/salt/reclass/nodes/ # For backward compatibility. New cfg node will be regenerated here
Dennis Dmitrieva5f38e42017-09-21 21:52:25 +0300271 mkdir -p /srv/salt/reclass/nodes/_generated
272
273 # Override some context parameters
Dennis Dmitrievf5bef572017-12-24 17:52:41 +0200274 sed -i 's/cluster_name: .*/cluster_name: {{ CLUSTER_NAME }}/g' {{ CLUSTER_CONTEXT_PATH }}
275 sed -i 's/cluster_domain: .*/cluster_domain: {{ DOMAIN_NAME }}/g' {{ CLUSTER_CONTEXT_PATH }}
Dennis Dmitriev862f7752018-01-19 17:12:11 +0200276 sed -i 's/mcp_version:.*/mcp_version: {{ REPOSITORY_SUITE }}/g' {{ CLUSTER_CONTEXT_PATH }}
sgudz8c888ec2017-10-02 15:29:23 +0300277 {%- if CONTROL_VLAN %}
Dennis Dmitrievf5bef572017-12-24 17:52:41 +0200278 sed -i 's/control_vlan: .*/control_vlan: {{ CONTROL_VLAN }}/g' {{ CLUSTER_CONTEXT_PATH }}
sgudz8c888ec2017-10-02 15:29:23 +0300279 {%- endif %}
280 {%- if TENANT_VLAN %}
Dennis Dmitrievf5bef572017-12-24 17:52:41 +0200281 sed -i 's/tenant_vlan: .*/tenant_vlan: {{ TENANT_VLAN }}/g' {{ CLUSTER_CONTEXT_PATH }}
sgudz8c888ec2017-10-02 15:29:23 +0300282 {%- endif %}
Dennis Dmitrieva5f38e42017-09-21 21:52:25 +0300283
Dennis Dmitrieva5f38e42017-09-21 21:52:25 +0300284 # Replace firstly to an intermediate value to avoid intersection between
285 # already replaced and replacing networks.
286 # For example, if generated IPV4_NET_ADMIN_PREFIX=10.16.0 , then there is a risk of replacing twice:
287 # 192.168.10 -> 10.16.0 (generated network for admin)
288 # 10.16.0 -> <external network>
289 # So let's replace constant networks to the keywords, and then keywords to the desired networks.
290 sed -i 's/10\.167\.5/==IPV4_NET_ADMIN_PREFIX==/g' {{ CLUSTER_CONTEXT_PATH }}
291 sed -i 's/10\.167\.4/==IPV4_NET_CONTROL_PREFIX==/g' {{ CLUSTER_CONTEXT_PATH }}
292 sed -i 's/10\.167\.6/==IPV4_NET_TENANT_PREFIX==/g' {{ CLUSTER_CONTEXT_PATH }}
293 sed -i 's/172\.17\.16\./==IPV4_NET_EXTERNAL_PREFIX==/g' {{ CLUSTER_CONTEXT_PATH }}
294
Dennis Dmitriev39e64bd2017-09-21 22:37:40 +0300295 sed -i 's/==IPV4_NET_ADMIN_PREFIX==/{{ IPV4_NET_ADMIN_PREFIX }}/g' {{ CLUSTER_CONTEXT_PATH }}
296 sed -i 's/==IPV4_NET_CONTROL_PREFIX==/{{ IPV4_NET_CONTROL_PREFIX }}/g' {{ CLUSTER_CONTEXT_PATH }}
297 sed -i 's/==IPV4_NET_TENANT_PREFIX==/{{ IPV4_NET_TENANT_PREFIX }}/g' {{ CLUSTER_CONTEXT_PATH }}
298 sed -i 's/==IPV4_NET_EXTERNAL_PREFIX==/{{ IPV4_NET_EXTERNAL_PREFIX }}./g' {{ CLUSTER_CONTEXT_PATH }}
Dennis Dmitrieva5f38e42017-09-21 21:52:25 +0300299
sgudz160b7302017-12-22 17:01:10 +0200300 {% set items = CLUSTER_PRODUCT_MODELS or '$(ls /tmp/cookiecutter-templates/cluster_product/)' %}
301 for item in {{ items }}; do
Dennis Dmitrieva5f38e42017-09-21 21:52:25 +0300302 python /tmp/cookiecutter-templates/generate.py \
sgudz160b7302017-12-22 17:01:10 +0200303 --template /tmp/cookiecutter-templates/cluster_product/$item \
Dennis Dmitrieva5f38e42017-09-21 21:52:25 +0300304 --config-file {{ CLUSTER_CONTEXT_PATH }} \
305 --output-dir /srv/salt/reclass/classes/cluster/;
306 done
307
308 export GIT_SSL_NO_VERIFY=true; git clone https://gerrit.mcp.mirantis.net/salt-models/reclass-system /srv/salt/reclass/classes/system/
309
310 # Create the cfg01 node and disable checkouting the model from remote repository
Dennis Dmitriev92295c02018-02-02 13:18:25 +0200311 cat << 'EOF' > /srv/salt/reclass/nodes/_generated/cfg01.{{ DOMAIN_NAME }}.yml
Dennis Dmitrieva5f38e42017-09-21 21:52:25 +0300312 classes:
313 - system.openssh.server.team.all
Dennis Dmitrievbdb2b9b2017-12-22 18:00:18 +0200314 - cluster.{{ CLUSTER_NAME }}.infra.config
Dennis Dmitrieva5f38e42017-09-21 21:52:25 +0300315 EOF
316
317 node_name: {{ HOSTNAME_CFG01 }}
318 retry: {count: 1, delay: 1}
319 skip_fail: false
320
Dennis Dmitrieva5f38e42017-09-21 21:52:25 +0300321- description: Modify generated model and reclass-system if necessary
322 cmd: |
323 set -e;
324 {%- if SALT_MODELS_SYSTEM_COMMIT != '' %}
325 pushd /srv/salt/reclass/classes/system/
326 git checkout {{ SALT_MODELS_SYSTEM_COMMIT }} && \
327 popd
sgudz4d816eb2017-11-13 11:58:05 +0200328 {%- elif SALT_MODELS_SYSTEM_REF_CHANGE != '' %}
Dennis Dmitrieva5f38e42017-09-21 21:52:25 +0300329 pushd /srv/salt/reclass/classes/system/
330 {%- for item in SALT_MODELS_SYSTEM_REF_CHANGE.split(" ") %}
331 git fetch {{ SALT_MODELS_SYSTEM_REPOSITORY }} {{ item }} && git cherry-pick FETCH_HEAD
332 {%- endfor %}
333 popd
334 {%- endif %}
335
Dennis Dmitrieva5f38e42017-09-21 21:52:25 +0300336 {%- if IS_CONTRAIL_LAB %}
Dennis Dmitriev862f7752018-01-19 17:12:11 +0200337 export REPLACE_DIRS="/srv/salt/reclass/classes/ /srv/salt/reclass/nodes/"
Dennis Dmitrieva5f38e42017-09-21 21:52:25 +0300338 # vSRX IPs for tcp-qa images have 172.16.10.90 hardcoded
339 find ${REPLACE_DIRS} -type f -exec sed -i 's/opencontrail_router01_address:.*/opencontrail_router01_address: 172.16.10.90/g' {} +
340 find ${REPLACE_DIRS} -type f -exec sed -i 's/infra_config_deploy_address: 1.*/infra_config_deploy_address: {{ IPV4_NET_ADMIN_PREFIX }}.15/g' {} +
341 {%- endif %}
342
343 node_name: {{ HOSTNAME_CFG01 }}
344 retry: {count: 1, delay: 1}
345 skip_fail: false
346{%- endmacro %}
347
348
Dennis Dmitriev9f141af2017-09-28 17:21:01 +0300349{%- macro MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() %}
350{########################################################}
Dennis Dmitrievccdc87a2017-09-28 17:43:54 +0300351
Dennis Dmitriev92295c02018-02-02 13:18:25 +0200352- description: "[EXPERIMENTAL] Clone 'environment-template' repository to cfg01.{{ DOMAIN_NAME }}"
Dennis Dmitriev9e18de72017-10-11 18:14:36 +0300353 cmd: |
354 set -e;
355 mkdir -p /tmp/environment/;
356 export GIT_SSL_NO_VERIFY=true; git clone https://github.com/Mirantis/environment-template /tmp/environment/environment_template
Dennis Dmitriev9f141af2017-09-28 17:21:01 +0300357 node_name: {{ HOSTNAME_CFG01 }}
358 skip_fail: false
359
sgudzcced67d2017-10-11 15:56:09 +0300360{%- if ENVIRONMENT_TEMPLATE_REF_CHANGE != '' %}
361- description: Fetch changes for environment templates
362 cmd: |
363 set -e;
364 pushd /tmp/environment/environment_template &&
365 git fetch https://github.com/Mirantis/environment-template {{ ENVIRONMENT_TEMPLATE_REF_CHANGE }} &&
366 git checkout FETCH_HEAD &&
367 popd
368 node_name: {{ HOSTNAME_CFG01 }}
369 skip_fail: false
370{%- endif %}
371
Dennis Dmitrievccdc87a2017-09-28 17:43:54 +0300372{%- for ENVIRONMENT_CONTEXT_NAME in ENVIRONMENT_CONTEXT_NAMES %}
Dennis Dmitriev92295c02018-02-02 13:18:25 +0200373- description: "[EXPERIMENTAL] Upload environment inventory to cfg01.{{ DOMAIN_NAME }}"
Dennis Dmitriev9f141af2017-09-28 17:21:01 +0300374 upload:
375 local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
376 local_filename: {{ ENVIRONMENT_CONTEXT_NAME }}
377 remote_path: /tmp/environment/
378 node_name: {{ HOSTNAME_CFG01 }}
Dennis Dmitrievccdc87a2017-09-28 17:43:54 +0300379{%- endfor %}
Dennis Dmitriev9f141af2017-09-28 17:21:01 +0300380
381- description: "[EXPERIMENTAL] Remove linux.network.interface object from the cluster/system models and use fixed 'environment' model instead"
382 cmd: |
383 set -e;
384 apt-get -y install python-virtualenv python-pip build-essential python-dev libssl-dev;
Dennis Dmitrievd96ace12018-01-26 14:46:21 +0200385 [[ -d /root/venv-reclass-tools ]] || virtualenv /root/venv-reclass-tools;
386 . /root/venv-reclass-tools/bin/activate;
Dennis Dmitriev9f141af2017-09-28 17:21:01 +0300387 pip install git+https://github.com/dis-xcom/reclass-tools;
388 reclass-tools del-key parameters.linux.network.interface /srv/salt/reclass/classes/cluster/;
389 reclass-tools del-key parameters.linux.network.interface /srv/salt/reclass/classes/system/;
390 reclass-tools del-key parameters.linux.network.interface /usr/share/salt-formulas/reclass/;
391
Dennis Dmitriev70c558e2018-02-19 12:59:20 +0200392 if ! reclass-tools get-key 'classes' /srv/salt/reclass/classes/cluster/{{ CLUSTER_NAME }}/infra/config.yml | grep -q "environment.{{ ENVIRONMENT_MODEL_INVENTORY_NAME }}$"; then
393 # Move the config.yml into a separate class 'infra.config_orig' to keep parameters:_param there
394 cp /srv/salt/reclass/classes/cluster/{{ CLUSTER_NAME }}/infra/config.yml /srv/salt/reclass/classes/cluster/{{ CLUSTER_NAME }}/infra/config_orig.yml;
395 # Remove parameters:_param from the infra.config to have possibility to override them from the environment classes
396 reclass-tools del-key parameters._param /srv/salt/reclass/classes/cluster/{{ CLUSTER_NAME }}/infra/config.yml;
Dennis Dmitrievf28e0362018-02-19 14:38:09 +0200397 reclass-tools del-key classes /srv/salt/reclass/classes/cluster/{{ CLUSTER_NAME }}/infra/config_orig.yml;
398 reclass-tools del-key parameters.jenkins /srv/salt/reclass/classes/cluster/{{ CLUSTER_NAME }}/infra/config_orig.yml;
399 reclass-tools del-key parameters.salt /srv/salt/reclass/classes/cluster/{{ CLUSTER_NAME }}/infra/config_orig.yml;
400 reclass-tools del-key parameters.reclass /srv/salt/reclass/classes/cluster/{{ CLUSTER_NAME }}/infra/config_orig.yml;
401
Dennis Dmitriev70c558e2018-02-19 12:59:20 +0200402 reclass-tools add-key 'classes' 'cluster.{{ CLUSTER_NAME }}.infra.config_orig' /srv/salt/reclass/classes/cluster/{{ CLUSTER_NAME }}/infra/config.yml --merge;
403 reclass-tools add-key 'classes' 'environment.{{ ENVIRONMENT_MODEL_INVENTORY_NAME }}.reclass_datasource_local' /srv/salt/reclass/classes/cluster/{{ CLUSTER_NAME }}/infra/config.yml --merge;
404 reclass-tools add-key 'classes' 'environment.{{ ENVIRONMENT_MODEL_INVENTORY_NAME }}' /srv/salt/reclass/classes/cluster/{{ CLUSTER_NAME }}/infra/config.yml --merge;
Dennis Dmitriev9f141af2017-09-28 17:21:01 +0300405 fi;
406
407 node_name: {{ HOSTNAME_CFG01 }}
408 retry: {count: 1, delay: 5}
409 skip_fail: false
410
Dennis Dmitriev222ba8e2017-11-11 00:06:02 +0200411- description: "Workaround for PROD-15923: all keepalive instances must be named 'VIP'"
Dennis Dmitriev9f141af2017-09-28 17:21:01 +0300412 cmd: |
413 set -e;
Dennis Dmitriev222ba8e2017-11-11 00:06:02 +0200414 find /srv/salt/reclass/classes/{system,cluster}/ -name '*.yml' -type f -exec sed -ri '/^ keepalived:/{:1;N;/\n instance:/!b1 {N; /\n [[:graph:]]+:/ { s/\n instance:\n [[:graph:]]+:/\n instance:\n VIP:/ } } }' {} +
Dennis Dmitriev9f141af2017-09-28 17:21:01 +0300415
416 node_name: {{ HOSTNAME_CFG01 }}
417 retry: {count: 1, delay: 5}
418 skip_fail: false
419
420- description: "[EXPERIMENTAL] Create environment model for virtual environment"
421 cmd: |
422 set -e;
Dennis Dmitrievd96ace12018-01-26 14:46:21 +0200423 . /root/venv-reclass-tools/bin/activate;
Dennis Dmitriev9f141af2017-09-28 17:21:01 +0300424 reclass-tools render --template-dir /tmp/environment/environment_template/ \
425 --output-dir /srv/salt/reclass/classes/environment/ \
Dennis Dmitrievd55a8562017-09-28 22:12:09 +0300426 {% for ENVIRONMENT_CONTEXT_NAME in ENVIRONMENT_CONTEXT_NAMES %} --context /tmp/environment/{{ENVIRONMENT_CONTEXT_NAME}}{% endfor %} \
Dennis Dmitriev9f141af2017-09-28 17:21:01 +0300427 --env-name {{ ENVIRONMENT_MODEL_INVENTORY_NAME }}
428 node_name: {{ HOSTNAME_CFG01 }}
429 retry: {count: 1, delay: 5}
430 skip_fail: false
sgudz8c888ec2017-10-02 15:29:23 +0300431
432- description: Modify generated model and reclass-system
433 cmd: |
434 export REPLACE_DIRS="/srv/salt/reclass/classes/ /srv/salt/reclass/nodes/"
435 find ${REPLACE_DIRS} -type f -exec sed -i 's/apt_mk_version:.*/apt_mk_version: {{ REPOSITORY_SUITE }}/g' {} +
436 node_name: {{ HOSTNAME_CFG01 }}
437 retry: {count: 1, delay: 1}
438 skip_fail: false
439
Dennis Dmitriev9f141af2017-09-28 17:21:01 +0300440{%- endmacro %}
441
442
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300443{%- macro MACRO_CONFIGURE_RECLASS(FORMULA_SERVICES='') %}
444{#######################################################}
445- description: Configure reclass
446 cmd: |
Dennis Dmitriev3e731a42017-08-30 17:12:59 +0300447 set -e;
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300448 FORMULA_PATH=${FORMULA_PATH:-/usr/share/salt-formulas};
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300449 which wget > /dev/null || (apt-get update; apt-get install -y wget);
Dennis Dmitrievcf777802018-02-14 18:09:55 +0200450 . /etc/lsb-release; # Get DISTRIB_CODENAME variable
Dennis Dmitriev3fbbc7f2017-12-21 15:42:14 +0200451 echo "{{ FORMULA_REPOSITORY }}" > /etc/apt/sources.list.d/mcp_salt.list;
452 wget -O - "{{ FORMULA_GPG }}" | apt-key add -;
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300453 apt-get clean; apt-get update;
454 [ ! -d /srv/salt/reclass/classes/service ] && mkdir -p /srv/salt/reclass/classes/service;
455 declare -a formula_services=({{ FORMULA_SERVICES }});
456 echo -e "\nInstalling all required salt formulas\n";
457 eatmydata apt-get install -y "${formula_services[@]/#/salt-formula-}";
458 for formula_service in "${formula_services[@]}"; do
459 echo -e "\nLink service metadata for formula ${formula_service} ...\n";
460 [ ! -L "/srv/salt/reclass/classes/service/${formula_service}" ] && ln -s ${FORMULA_PATH}/reclass/service/${formula_service} /srv/salt/reclass/classes/service/${formula_service};
461 done;
462 [ ! -d /srv/salt/env ] && mkdir -p /srv/salt/env;
463 [ ! -L /srv/salt/env/prd ] && ln -s ${FORMULA_PATH}/env /srv/salt/env/prd;
464 [ ! -d /etc/reclass ] && mkdir /etc/reclass;
465
Dennis Dmitrieva578c772018-01-24 21:02:15 +0200466 cat << 'EOF' > /etc/reclass/reclass-config.yml
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300467 storage_type: yaml_fs
468 pretty_print: True
469 output: yaml
470 inventory_base_uri: /srv/salt/reclass
471 EOF
472 node_name: {{ HOSTNAME_CFG01 }}
473 retry: {count: 1, delay: 1}
474 skip_fail: false
475
Dennis Dmitriev92295c02018-02-02 13:18:25 +0200476- description: "*Workaround* remove all cfg01 nodes except cfg01.{{ DOMAIN_NAME }} to not depend on other clusters in 'reclass --top'"
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300477 cmd: |
Dennis Dmitriev92295c02018-02-02 13:18:25 +0200478 # Remove all other nodes except cfg01.{{ DOMAIN_NAME }} to not rely on them for 'reclass --top'
479 find /srv/salt/reclass/nodes/ -type f -not -name cfg01.{{ DOMAIN_NAME }}.yml -delete
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300480 node_name: {{ HOSTNAME_CFG01 }}
481 retry: {count: 1, delay: 5}
482 skip_fail: false
483
484- description: Configure salt adoptors on cfg01
485 cmd: |
486 ln -s /usr/lib/python2.7/dist-packages/reclass/adapters/salt.py /usr/local/sbin/reclass-salt;
487 chmod +x /usr/lib/python2.7/dist-packages/reclass/adapters/salt.py
488 node_name: {{ HOSTNAME_CFG01 }}
489 retry: {count: 1, delay: 1}
490 skip_fail: false
491
492- description: Show reclass-salt --top for cfg01 node
493 cmd: reclass-salt --top
494 node_name: {{ HOSTNAME_CFG01 }}
495 retry: {count: 1, delay: 5}
496 skip_fail: false
497
498- description: Restart salt-master service
499 cmd: systemctl restart salt-master;
500 node_name: {{ HOSTNAME_CFG01 }}
501 retry: {count: 1, delay: 5}
502 skip_fail: false
503{%- endmacro %}
504
505
506{%- macro MACRO_INSTALL_SALT_MINIONS() %}
507{#######################################}
508{% for ssh in config.underlay.ssh %}
509- description: Configure salt-minion on {{ ssh['node_name'] }}
510 cmd: |
511 [ ! -d /etc/salt/minion.d ] && mkdir -p /etc/salt/minion.d;
Dennis Dmitrieva578c772018-01-24 21:02:15 +0200512 cat << "EOF" > /etc/salt/minion.d/minion.conf
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300513 id: {{ ssh['node_name'] }}
514 master: {{ config.salt.salt_master_host }}
515 EOF
Dennis Dmitrievcf777802018-02-14 18:09:55 +0200516
517 # Configure ubuntu and salt repositories
518 which wget >/dev/null || (apt-get update; apt-get install -y wget);
519
520 . /etc/lsb-release; # Get DISTRIB_CODENAME variable
521 echo "{{ UBUNTU_REPOSITORY }}" > /etc/apt/sources.list
522 echo "{{ UBUNTU_UPDATES_REPOSITORY }}" >> /etc/apt/sources.list
523 echo "{{ UBUNTU_SECURITY_REPOSITORY }}" >> /etc/apt/sources.list
524
525 echo "{{ SALT_REPOSITORY }}" > /etc/apt/sources.list.d/mcp_saltstack.list;
526 wget -O - {{ SALT_GPG }} | apt-key add -;
527
528 apt-get clean
529 apt-get update
530
531 # Install salt-minion
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300532 eatmydata apt-get install -y salt-minion;
Dennis Dmitrievcf777802018-02-14 18:09:55 +0200533 # Install common packages
534 eatmydata apt-get install -y python-pip git curl tmux byobu iputils-ping traceroute htop tree mc
535
536 # Restart salt-minion if it was already installed
537 service salt-minion restart
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300538 node_name: {{ ssh['node_name'] }}
539 retry: {count: 1, delay: 1}
540 skip_fail: false
541{% endfor %}
542
543
544- description: Accept salt keys from all the nodes
545 cmd: salt-key -A -y
546 node_name: {{ HOSTNAME_CFG01 }}
547 retry: {count: 1, delay: 5}
548 skip_fail: true
549{%- endmacro %}
550
551
552{%- macro MACRO_RUN_SALT_MASTER_UNDERLAY_STATES() %}
553{##################################################}
554
555{# Prepare salt services and nodes settings #}
556
557- description: Run 'linux' formula on cfg01
558 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:master' state.sls linux;
559 node_name: {{ HOSTNAME_CFG01 }}
560 retry: {count: 3, delay: 5}
561 skip_fail: false
562
563- description: Run 'openssh' formula on cfg01
564 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
Dennis Dmitriev3e731a42017-08-30 17:12:59 +0300565 -C 'I@salt:master' state.sls openssh &&
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300566 salt --hard-crash --state-output=mixed --state-verbose=False
567 -C 'I@salt:master' cmd.run "sed -i 's/PasswordAuthentication no/PasswordAuthentication
Dennis Dmitriev3e731a42017-08-30 17:12:59 +0300568 yes/' /etc/ssh/sshd_config && service ssh reload"
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300569 node_name: {{ HOSTNAME_CFG01 }}
570 retry: {count: 3, delay: 5}
571 skip_fail: false
572
573- description: '*Workaround* of the bug https://mirantis.jira.com/browse/PROD-7962'
574 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
575 '*' cmd.run "echo ' StrictHostKeyChecking no' >> /root/.ssh/config"
576 node_name: {{ HOSTNAME_CFG01 }}
577 retry: {count: 1, delay: 1}
578 skip_fail: false
579
580- description: Run 'salt.master' formula on cfg01
Dennis Dmitrieve575e982017-10-21 21:50:45 +0300581 cmd: timeout 600 salt-call -l info --hard-crash --state-output=mixed --state-verbose=False state.sls salt.master;
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300582 node_name: {{ HOSTNAME_CFG01 }}
Dennis Dmitrieve575e982017-10-21 21:50:45 +0300583 retry: {count: 2, delay: 30}
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300584 skip_fail: false
585
Victor Ryzhenkin4e077ad2017-08-10 13:42:11 +0400586{%- if SALT_FORMULAS_REFS != '' %}
587- description: Replace needed formulas to desired version
588 cmd: |
589 set -e;
Victor Ryzhenkinc7913682017-10-11 15:14:40 +0400590 {%- for formula_set in SALT_FORMULAS_REFS.split(' ') %}
591 {% set formula = formula_set.split(':') %}
592 {% set formula_name = formula[0] %}
593 {% set formula_ref = formula[1] %}
Dennis Dmitrievbc57b802017-08-16 18:10:57 +0300594 {% set formula_dir = '/tmp/salt-formula-' + formula_name %}
Victor Ryzhenkin4e077ad2017-08-10 13:42:11 +0400595 git clone {{ SALT_FORMULAS_REPO }}/{{ formula_name }} {{ formula_dir }} &&
596 pushd {{ formula_dir }} &&
597 git fetch {{ SALT_FORMULAS_REPO }}/{{ formula_name }} {{ formula_ref }} &&
598 git checkout FETCH_HEAD &&
599 popd &&
600 if [ -d "{{ formula_dir }}" ]; then
601 echo "Going to replace packaged formula {{ formula_name }}" &&
602 rm -rfv /usr/share/salt-formulas/{env,reclass/service}/{{ formula_name }} &&
Victor Ryzhenkinc7913682017-10-11 15:14:40 +0400603 ln -v -s "{{ formula_dir }}/{{ formula_name }}" "/usr/share/salt-formulas/env/{{ formula_name }}" &&
604 ln -v -s "{{ formula_dir }}/metadata/service/" "/usr/share/salt-formulas/reclass/service/{{ formula_name }}";
Victor Ryzhenkin4e077ad2017-08-10 13:42:11 +0400605 else
606 echo "Stopped, directory /root/salt-formula-{{ formula_name }} does not exist!";
607 fi
608 {%- endfor %}
609 node_name: {{ HOSTNAME_CFG01 }}
610 retry: {count: 1, delay: 10}
611 skip_fail: false
612{%- endif %}
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300613
614- description: Refresh pillars on salt-master minion
615 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:master' saltutil.refresh_pillar
616 node_name: {{ HOSTNAME_CFG01 }}
617 retry: {count: 1, delay: 5}
618 skip_fail: false
619
Dennis Dmitriev3e731a42017-08-30 17:12:59 +0300620- description: Show reclass-salt --top for salt-master node
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300621 cmd: reclass-salt --top
622 node_name: {{ HOSTNAME_CFG01 }}
623 retry: {count: 1, delay: 5}
624 skip_fail: false
625
626- description: Sync all salt resources on salt-master minion
Dennis Dmitriev9a6cacc2017-08-14 00:08:41 +0300627 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:master' saltutil.sync_all && sleep 5
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300628 node_name: {{ HOSTNAME_CFG01 }}
629 retry: {count: 1, delay: 5}
630 skip_fail: false
631
632- description: Configure linux on master
633 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:master' state.sls 'linux.system'
634 node_name: {{ HOSTNAME_CFG01 }}
635 retry: {count: 1, delay: 5}
636 skip_fail: false
637
638- description: Configure salt.minion on master
639 cmd: salt --timeout=120 --hard-crash --state-output=mixed --state-verbose=False
640 -C 'I@salt:master' state.sls salt.minion && sleep 10
641 node_name: {{ HOSTNAME_CFG01 }}
642 retry: {count: 3, delay: 10}
643 skip_fail: false
644
645- description: Run state 'salt' on master (for salt.api, etc)
646 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
647 -C 'I@salt:master' state.sls salt
648 node_name: {{ HOSTNAME_CFG01 }}
649 retry: {count: 3, delay: 10}
650 skip_fail: false
651{%- endmacro %}
652
Dennis Dmitriev85559962018-01-30 15:35:51 +0200653{%- macro MACRO_GENERATE_INVENTORY(RERUN_SALTMASTER_STATE=false) %}
654{#################################################################}
655
656- description: Refresh pillars before generating nodes
657 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
658 node_name: {{ HOSTNAME_CFG01 }}
659 retry: {count: 1, delay: 5}
660 skip_fail: false
661
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300662- description: Generate inventory for all the nodes to the /srv/salt/reclass/nodes/_generated
663 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
664 -C 'I@salt:master' state.sls reclass
665 node_name: {{ HOSTNAME_CFG01 }}
666 retry: {count: 1, delay: 5}
667 skip_fail: false
668
Dennis Dmitriev85559962018-01-30 15:35:51 +0200669{%- if RERUN_SALTMASTER_STATE %}
670- description: Regenerate salt.master states for the newly uploaded/created model
671 cmd: |
672 # Need to refresh installed formulas that are required in the model
673 salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar; sleep 5;
674 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:master' state.sls salt.master;
675 node_name: {{ HOSTNAME_CFG01 }}
676 retry: {count: 1, delay: 5}
677 skip_fail: false
678{%- endif %}
679
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300680- description: Refresh pillars on all minions
Dennis Dmitriev85559962018-01-30 15:35:51 +0200681 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar; sleep 5
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300682 node_name: {{ HOSTNAME_CFG01 }}
683 retry: {count: 1, delay: 5}
684 skip_fail: false
685
Dennis Dmitriev3e731a42017-08-30 17:12:59 +0300686- description: Show reclass-salt --top for all generated nodes
Dennis Dmitriev4386a072017-09-04 13:58:02 +0300687 cmd: |
688 set -e
689 if salt-call sys.doc reclass.validate_node_params | grep -q reclass.validate_node_params ; then salt-call reclass.validate_nodes_params ; fi
690 if salt-call sys.doc reclass.validate_pillar | grep -q reclass.validate_pillar ; then salt-call reclass.validate_pillar ; fi
691 reclass-salt --top
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300692 node_name: {{ HOSTNAME_CFG01 }}
693 retry: {count: 1, delay: 5}
694 skip_fail: false
695
696- description: Sync all salt resources
Dennis Dmitriev9a6cacc2017-08-14 00:08:41 +0300697 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300698 node_name: {{ HOSTNAME_CFG01 }}
699 retry: {count: 1, delay: 5}
700 skip_fail: false
701{%- endmacro %}
702
703
704{%- macro MACRO_BOOTSTRAP_ALL_MINIONS() %}
705{########################################}
706# Bootstrap all nodes
Dennis Dmitriev8ed27882018-01-31 23:23:19 +0200707
708- description: Get linux kernel version from all minions
709 cmd: |
710 salt --hard-crash --state-output=mixed --state-verbose=False --out=txt '*' cmd.run 'uname -r' | sort
711 salt --hard-crash --state-output=mixed --state-verbose=False --out=txt '*' cmd.run 'dpkg -l|grep "linux-image-.*-generic"' | sort
712 node_name: {{ HOSTNAME_CFG01 }}
713 retry: {count: 5, delay: 10}
714 skip_fail: false
715
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300716- description: Configure linux on other nodes
717 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' state.sls linux
718 node_name: {{ HOSTNAME_CFG01 }}
719 retry: {count: 5, delay: 10}
720 skip_fail: false
721
722- description: Configure openssh on all nodes
Dennis Dmitriev3e731a42017-08-30 17:12:59 +0300723 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system and not cfg01*' state.sls openssh &&
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300724 salt --hard-crash --state-output=mixed --state-verbose=False
725 -C 'I@linux:system and not cfg01*' cmd.run "sed -i 's/PasswordAuthentication no/PasswordAuthentication
726 yes/' /etc/ssh/sshd_config && service ssh reload"
727 node_name: {{ HOSTNAME_CFG01 }}
728 retry: {count: 1, delay: 5}
729 skip_fail: false
730
731- description: Configure salt.minion on other nodes
732 cmd: salt --timeout=120 --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system and not cfg01*' state.sls salt.minion &&
733 sleep 10
734 node_name: {{ HOSTNAME_CFG01 }}
735 retry: {count: 3, delay: 15}
736 skip_fail: false
737
738- description: Check salt minion versions on slaves
Victor Ryzhenkin42e24232017-11-15 08:01:20 -0400739 cmd: salt --timeout=60 '*' test.version
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300740 node_name: {{ HOSTNAME_CFG01 }}
741 retry: {count: 3, delay: 15}
742 skip_fail: false
743
744- description: Check salt top states on nodes
Victor Ryzhenkin42e24232017-11-15 08:01:20 -0400745 cmd: salt --timeout=60 '*' state.show_top
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300746 node_name: {{ HOSTNAME_CFG01 }}
Victor Ryzhenkin42e24232017-11-15 08:01:20 -0400747 retry: {count: 3, delay: 15}
Dennis Dmitriev492813e2017-08-09 15:08:58 +0300748 skip_fail: false
749
750- description: Configure ntp and rsyslog on nodes
751 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@linux:system' state.sls ntp,rsyslog
752 node_name: {{ HOSTNAME_CFG01 }}
753 retry: {count: 1, delay: 10}
754 skip_fail: false
Sergii Golovatiuk50f91892017-08-04 18:11:06 +0200755{%- endmacro %}
Dennis Dmitriev9dada8a2017-08-30 17:38:55 +0300756
757
758{%- macro MACRO_NETWORKING_WORKAROUNDS() %}
759{#########################################}
760
Dennis Dmitriev9dada8a2017-08-30 17:38:55 +0300761- description: '*Workaround: Load bonding module before call state.linux'
762 cmd: salt -C "I@linux:network:interface:*:type:bond" cmd.run 'modprobe bonding'
763 node_name: {{ HOSTNAME_CFG01 }}
764 retry: {count: 1, delay: 5}
Dennis Dmitriev0496eb72017-09-05 21:42:10 +0300765 skip_fail: true
Dennis Dmitriev9dada8a2017-08-30 17:38:55 +0300766
767- description: '*Workaround* install bridge-utils before running linux formula'
768 # The formula removes default route and then tries to install the package, fails.
769 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C '* and not
770 cfg01*' cmd.run 'sudo apt-get install -y bridge-utils'
771 node_name: {{ HOSTNAME_CFG01 }}
772 retry: {count: 1, delay: 5}
773 skip_fail: false
774
775{%- endmacro %}
Victor Ryzhenkin9cc824c2017-10-12 19:02:23 +0400776
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200777
Victor Ryzhenkin9cc824c2017-10-12 19:02:23 +0400778{%- macro ADJUST_K8S_OPTS() %}
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200779{############################}
Victor Ryzhenkin9cc824c2017-10-12 19:02:23 +0400780
781- description: Set k8s deploy parameters
782 cmd: |
783 {% for k8s_opt, value in config.k8s_deploy.items() %}
784 {% if value|string() %}
785 salt-call reclass.cluster_meta_set name={{ k8s_opt }} value={{ value }};
786 {% endif %}
787 {% endfor %}
788 node_name: {{ HOSTNAME_CFG01 }}
789 retry: {count: 1, delay: 1}
790 skip_fail: false
791
792{%- endmacro %}
Victor Ryzhenkin42e24232017-11-15 08:01:20 -0400793
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200794
795{%- macro ADJUST_SL_OPTS(OVERRIDES_FILENAME='') %}
796{#############################################}
797- description: Set SL docker images deploy parameters
798 cmd: |
799 {#- For cookiecutter-generated model, use overrides.yml from environment model instead of cluster model #}
800 {%- for sl_opt, value in config.sl_deploy.items() %}
801 {%- if value|string() %}
802 {%- if OVERRIDES_FILENAME %}
803 salt-call reclass.cluster_meta_set name={{ sl_opt }} value={{ value }} file_name={{ OVERRIDES_FILENAME }};
804 {%- else %}
805 salt-call reclass.cluster_meta_set name={{ sl_opt }} value={{ value }};
806 {%- endif %}
807 {%- endif %}
808 {%- endfor %}
809 salt '*' saltutil.refresh_pillar;
810 sleep 10
811 node_name: {{ HOSTNAME_CFG01 }}
812 retry: {count: 1, delay: 1}
813 skip_fail: false
814{%- endmacro %}
815
816
Victor Ryzhenkin42e24232017-11-15 08:01:20 -0400817{%- macro REGISTER_COMPUTE_NODES() %}
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200818{###################################}
Victor Ryzhenkin42e24232017-11-15 08:01:20 -0400819
820{% for ssh in config.underlay.ssh %}
821{% if ssh["node_name"].startswith("cmp") %}
822{% set node_hostname = ssh["node_name"].split('.')[0] %}
823- description: Register compute {{ ssh['node_name'] }}
824 cmd: |
825 exec > >(tee -i /tmp/cloud-init-bootstrap.log) 2>&1
826 export network01_prefix={{ IPV4_NET_ADMIN_PREFIX }}
827 export network02_prefix={{ IPV4_NET_CONTROL_PREFIX }}
Victor Ryzhenkin66593e92017-11-28 19:38:33 +0400828 export cluster_name={{ CLUSTER_NAME }}
Victor Ryzhenkin42e24232017-11-15 08:01:20 -0400829 export config_host={{ config.salt.salt_master_host }}
830 export node_domain={{ DOMAIN_NAME }}
831 export nodes_os="xenial"
832 export node_hostname={{ node_hostname }}
833 set -xe
834 export BOOTSTRAP_SCRIPT_URL=$bootstrap_script_url
835 export BOOTSTRAP_SCRIPT_URL=${BOOTSTRAP_SCRIPT_URL:-https://raw.githubusercontent.com/salt-formulas/salt-formulas-scripts/master/bootstrap.sh}
836 export DISTRIB_REVISION={{ REPOSITORY_SUITE }}
837 export DISTRIB_REVISION=${DISTRIB_REVISION:-nightly}
838
839 # Add wrapper to apt-get to avoid race conditions
840 # with cron jobs running 'unattended-upgrades' script
841 aptget_wrapper() {
842 local apt_wrapper_timeout=300
843 local start_time=$(date '+%s')
844 local fin_time=$((start_time + apt_wrapper_timeout))
845 while true; do
846 if (( "$(date '+%s')" > fin_time )); then
847 msg="Timeout exceeded ${apt_wrapper_timeout} s. Lock files are still not released. Terminating..."
848 fi
849 if fuser /var/lib/apt/lists/lock >/dev/null 2>&1 || fuser /var/lib/dpkg/lock >/dev/null 2>&1; then
850 echo "Waiting while another apt/dpkg process releases locks ..."
851 sleep 30
852 continue
853 else
854 apt-get $@
855 break
856 fi
857 done
858 }
859
860 # Set default salt version
861 if [ -z "$saltversion" ]; then
862 saltversion="2016.3"
863 fi
864 echo "Using Salt version $saltversion"
865
866 echo "Preparing base OS ..."
867
868 case "$node_os" in
869 trusty)
870 # workaround for old cloud-init only configuring the first iface
871 iface_config_dir="/etc/network/interfaces"
872 ifaces=$(ip a | awk '/^[1-9]:/ {print $2}' | grep -v "lo:" | rev | cut -c2- | rev)
873
874 for iface in $ifaces; do
875 grep $iface $iface_config_dir &> /dev/null || (echo -e "\nauto $iface\niface $iface inet dhcp" >> $iface_config_dir && ifup $iface)
876 done
877
878 which wget > /dev/null || (aptget_wrapper update; aptget_wrapper install -y wget)
879
880 # SUGGESTED UPDATE:
881 #export MASTER_IP="$config_host" MINION_ID="$node_hostname.$node_domain" SALT_VERSION=$saltversion
882 #source <(curl -qL ${BOOTSTRAP_SCRIPT_URL})
883 ## Update BOOTSTRAP_SALTSTACK_OPTS, as by default they contain "-dX" not to start service
884 #BOOTSTRAP_SALTSTACK_OPTS=" stable $SALT_VERSION "
885 #install_salt_minion_pkg
886
887 # DEPRECATED:
888 echo "deb [arch=amd64] http://apt-mk.mirantis.com/trusty ${DISTRIB_REVISION} salt extra" > /etc/apt/sources.list.d/mcp_salt.list
889 wget -O - http://apt-mk.mirantis.com/public.gpg | apt-key add -
890
891 echo "deb http://repo.saltstack.com/apt/ubuntu/14.04/amd64/$saltversion trusty main" > /etc/apt/sources.list.d/saltstack.list
892 wget -O - "https://repo.saltstack.com/apt/ubuntu/14.04/amd64/$saltversion/SALTSTACK-GPG-KEY.pub" | apt-key add -
893
894 aptget_wrapper clean
895 aptget_wrapper update
896 aptget_wrapper install -y salt-common
897 aptget_wrapper install -y salt-minion
898 ;;
899 xenial)
900
901 # workaround for new cloud-init setting all interfaces statically
902 which resolvconf > /dev/null 2>&1 && systemctl restart resolvconf
903
904 which wget > /dev/null || (aptget_wrapper update; aptget_wrapper install -y wget)
905
906 # SUGGESTED UPDATE:
907 #export MASTER_IP="$config_host" MINION_ID="$node_hostname.$node_domain" SALT_VERSION=$saltversion
908 #source <(curl -qL ${BOOTSTRAP_SCRIPT_URL})
909 ## Update BOOTSTRAP_SALTSTACK_OPTS, as by default they contain "-dX" not to start service
910 #BOOTSTRAP_SALTSTACK_OPTS=" stable $SALT_VERSION "
911 #install_salt_minion_pkg
912
913 # DEPRECATED:
914 echo "deb [arch=amd64] http://apt-mk.mirantis.com/xenial ${DISTRIB_REVISION} salt extra" > /etc/apt/sources.list.d/mcp_salt.list
915 wget -O - http://apt-mk.mirantis.com/public.gpg | apt-key add -
916
917 echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/$saltversion xenial main" > /etc/apt/sources.list.d/saltstack.list
918 wget -O - "https://repo.saltstack.com/apt/ubuntu/16.04/amd64/$saltversion/SALTSTACK-GPG-KEY.pub" | apt-key add -
919
920 aptget_wrapper clean
921 aptget_wrapper update
922 aptget_wrapper install -y salt-minion
923 ;;
924 rhel|centos|centos7|centos7|rhel6|rhel7)
925 yum install -y git
926 export MASTER_IP="$config_host" MINION_ID="$node_hostname.$node_domain" SALT_VERSION=$saltversion
927 source <(curl -qL ${BOOTSTRAP_SCRIPT_URL})
928 # Update BOOTSTRAP_SALTSTACK_OPTS, as by default they contain "-dX" not to start service
929 BOOTSTRAP_SALTSTACK_OPTS=" stable $SALT_VERSION "
930 install_salt_minion_pkg
931 ;;
932 *)
933 msg="OS '$node_os' is not supported."
934 esac
935
936 echo "Configuring Salt minion ..."
937 [ ! -d /etc/salt/minion.d ] && mkdir -p /etc/salt/minion.d
938 echo -e "id: $node_hostname.$node_domain\nmaster: $config_host" > /etc/salt/minion.d/minion.conf
939
940 service salt-minion restart || wait_condition_send "FAILURE" "Failed to restart salt-minion service."
941
942 sleep 1
943
944 echo "Classifying node ..."
945 os_codename=$(salt-call grains.item oscodename --out key | awk '/oscodename/ {print $2}')
946 node_network01_ip="$(ip a | awk -v prefix="^ inet $network01_prefix[.]" '$0 ~ prefix {split($2, a, "/"); print a[1]}')"
947 node_network02_ip="$(ip a | awk -v prefix="^ inet $network02_prefix[.]" '$0 ~ prefix {split($2, a, "/"); print a[1]}')"
948 node_network03_ip="$(ip a | awk -v prefix="^ inet $network03_prefix[.]" '$0 ~ prefix {split($2, a, "/"); print a[1]}')"
949 node_network04_ip="$(ip a | awk -v prefix="^ inet $network04_prefix[.]" '$0 ~ prefix {split($2, a, "/"); print a[1]}')"
950 node_network05_ip="$(ip a | awk -v prefix="^ inet $network05_prefix[.]" '$0 ~ prefix {split($2, a, "/"); print a[1]}')"
951
952 node_network01_iface="$(ip a | awk -v prefix="^ inet $network01_prefix[.]" '$0 ~ prefix {split($7, a, "/"); print a[1]}')"
953 node_network02_iface="$(ip a | awk -v prefix="^ inet $network02_prefix[.]" '$0 ~ prefix {split($7, a, "/"); print a[1]}')"
954 node_network03_iface="$(ip a | awk -v prefix="^ inet $network03_prefix[.]" '$0 ~ prefix {split($7, a, "/"); print a[1]}')"
955 node_network04_iface="$(ip a | awk -v prefix="^ inet $network04_prefix[.]" '$0 ~ prefix {split($7, a, "/"); print a[1]}')"
956 node_network05_iface="$(ip a | awk -v prefix="^ inet $network05_prefix[.]" '$0 ~ prefix {split($7, a, "/"); print a[1]}')"
957
958 if [ "$node_network05_iface" != "" ]; then
959 node_network05_hwaddress="$(cat /sys/class/net/$node_network05_iface/address)"
960 fi
961
962 # find more parameters (every env starting param_)
963 more_params=$(env | grep "^param_" | sed -e 's/=/":"/g' -e 's/^/"/g' -e 's/$/",/g' | tr "\n" " " | sed 's/, $//g')
964 if [ "$more_params" != "" ]; then
965 echo "Additional params: $more_params"
966 more_params=", $more_params"
967 fi
968
969 salt-call event.send "reclass/minion/classify" "{\"node_master_ip\": \"$config_host\", \"node_os\": \"${os_codename}\", \"node_deploy_ip\": \"${node_network01_ip}\", \"node_deploy_iface\": \"${node_network01_iface}\", \"node_control_ip\": \"${node_network02_ip}\", \"node_control_iface\": \"${node_network02_iface}\", \"node_tenant_ip\": \"${node_network03_ip}\", \"node_tenant_iface\": \"${node_network03_iface}\", \"node_external_ip\": \"${node_network04_ip}\", \"node_external_iface\": \"${node_network04_iface}\", \"node_baremetal_ip\": \"${node_network05_ip}\", \"node_baremetal_iface\": \"${node_network05_iface}\", \"node_baremetal_hwaddress\": \"${node_network05_hwaddress}\", \"node_domain\": \"$node_domain\", \"node_cluster\": \"$cluster_name\", \"node_hostname\": \"$node_hostname\"${more_params}}"
970
971 sleep 5
972
973 salt-call saltutil.sync_all
974 salt-call mine.flush
975 salt-call mine.update
976 node_name: {{ ssh['node_name'] }}
977 retry: {count: 1, delay: 1}
978 skip_fail: false
979{%- endif %}
980{%- endfor %}
981
982- description: Refresh pillars on all minions
983 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
984 node_name: {{ HOSTNAME_CFG01 }}
985 retry: {count: 1, delay: 5}
986 skip_fail: false
987
988- description: Sync all salt resources
989 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all && sleep 5
990 node_name: {{ HOSTNAME_CFG01 }}
991 retry: {count: 1, delay: 5}
992 skip_fail: false
993
sgudz160b7302017-12-22 17:01:10 +0200994{%- endmacro %}