blob: 480e852803da49da35fd27500ac9c8e9f14490a5 [file] [log] [blame]
Dennis Dmitriev8daa1e32017-12-19 02:29:48 +02001{# Collection of common macroses shared across different deployments #}
2
3{%- macro MACRO_INSTALL_SMTP_ALERTS_RECEIVER() %}
4- description: Install exim4 on {{ HOSTNAME_CFG01 }}
5 cmd: apt -y install exim4-daemon-light
6 node_name: {{ HOSTNAME_CFG01 }}
7 retry: {count: 1, delay: 1}
8 skip_fail: false
9
10- description: Configure exim4 to receive emails to the ~/Maildir for local users
11 cmd: |
12 sed -i "s/dc_other_hostnames=.*/dc_other_hostnames='*'/g" /etc/exim4/update-exim4.conf.conf
13 sed -i "s/dc_local_interfaces=.*/dc_local_interfaces=''/g" /etc/exim4/update-exim4.conf.conf
14 sed -i "s/dc_localdelivery=.*/dc_localdelivery='maildir_home'/g" /etc/exim4/update-exim4.conf.conf
15 update-exim4.conf
16 service exim4 restart
17 node_name: {{ HOSTNAME_CFG01 }}
18 retry: {count: 1, delay: 1}
19 skip_fail: false
20
21- description: Create a special user to receive alerts
22 cmd: useradd _alertsreceiver -m
23 node_name: {{ HOSTNAME_CFG01 }}
24 retry: {count: 1, delay: 1}
25 skip_fail: false
26
27- description: Modify SL pillars to send alerts to SMTP server on {{ HOSTNAME_CFG01 }}
28 cmd: |
29 # Remove existing definitions for email alerting
30 export REPLACE_DIR="/srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}"
31 find ${REPLACE_DIR} -type f -exec sed -i '/pushkin_smtp_host:.*/d' {} +
32 find ${REPLACE_DIR} -type f -exec sed -i '/pushkin_smtp_port:.*/d' {} +
33 find ${REPLACE_DIR} -type f -exec sed -i '/pushkin_email_sender_password:.*/d' {} +
34 find ${REPLACE_DIR} -type f -exec sed -i '/webhook_from:.*/d' {} +
35 find ${REPLACE_DIR} -type f -exec sed -i '/webhook_recipients:.*/d' {} +
36
37 salt-call reclass.cluster_meta_set name='pushkin_smtp_host' value='${_param:salt_master_host}' file_name=${REPLACE_DIR}/stacklight/init.yml
38 salt-call reclass.cluster_meta_set name='pushkin_smtp_port' value='25' file_name=${REPLACE_DIR}/stacklight/init.yml
39 salt-call reclass.cluster_meta_set name='pushkin_email_sender_password' value='""' file_name=${REPLACE_DIR}/stacklight/init.yml
40 salt-call reclass.cluster_meta_set name='webhook_from' value='monitoring@{{ LAB_CONFIG_NAME }}.local' file_name=${REPLACE_DIR}/stacklight/init.yml
41 salt-call reclass.cluster_meta_set name='webhook_recipients' value='alerts@integration.ci.local' file_name=${REPLACE_DIR}/stacklight/init.yml
42
43 salt '*' saltutil.refresh_pillar
44 node_name: {{ HOSTNAME_CFG01 }}
45 retry: {count: 1, delay: 1}
46 skip_fail: false
47
48{%- endmacro %}
49
ibumarskovb5210062018-08-22 16:18:15 +040050{%- macro MACRO_INSTALL_GLUSTERFS() %}
Dennis Dmitriev8daa1e32017-12-19 02:29:48 +020051
ibumarskovb5210062018-08-22 16:18:15 +040052- description: Install glusterfs
53 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
54 -C 'I@glusterfs:server' state.sls glusterfs.server.service
55 node_name: {{ HOSTNAME_CFG01 }}
56 retry: {count: 1, delay: 5}
57 skip_fail: false
Dennis Dmitriev8daa1e32017-12-19 02:29:48 +020058
ibumarskovb5210062018-08-22 16:18:15 +040059- description: Setup glusterfs on primary controller
60 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
61 -C 'I@glusterfs:server and *01*' state.sls glusterfs.server.setup -b 1
62 node_name: {{ HOSTNAME_CFG01 }}
63 retry: {count: 1, delay: 5}
64 skip_fail: false
Dennis Dmitriev8daa1e32017-12-19 02:29:48 +020065
ibumarskovb5210062018-08-22 16:18:15 +040066- description: Check the gluster status
67 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
68 -C 'I@glusterfs:server' cmd.run 'gluster peer status && gluster volume status' -b 1
69 node_name: {{ HOSTNAME_CFG01 }}
70 retry: {count: 1, delay: 5}
71 skip_fail: false
Dennis Dmitriev8daa1e32017-12-19 02:29:48 +020072
ibumarskovb5210062018-08-22 16:18:15 +040073- description: Mount glusterfs.client volumes (requires created 'keystone' and
74 'glusterfs' system users)
75 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
76 -C 'I@glusterfs:client' state.sls glusterfs.client
77 node_name: {{ HOSTNAME_CFG01 }}
78 retry: {count: 1, delay: 5}
79 skip_fail: false
Dennis Dmitriev8daa1e32017-12-19 02:29:48 +020080
ibumarskovb5210062018-08-22 16:18:15 +040081{%- endmacro %}