blob: 2cc3787287714f3695f362341db08994e3db3db3 [file] [log] [blame]
Tatyana Leontovich26756912018-06-06 20:11:05 +03001{# Collection of common macroses shared across different deployments #}
2
3{%- macro MACRO_BACKUP_BACKUPNINJA() %}
Tatyana Leontovich28dcd6a2018-07-03 00:38:32 +03004
Tatyana Leontovich26756912018-06-06 20:11:05 +03005- description: Apply backup state on minions
6 cmd: salt -C 'I@backupninja:server or backupninja:client' state.sls salt.minion
7 node_name: {{ HOSTNAME_CFG01 }}
8 retry: {count: 1, delay: 1}
9 skip_fail: false
10
11- description: Refresh grains and mine for the backupninja client node
12 cmd: |
13 salt -C 'I@backupninja:client' state.sls salt.minion.grains
14 salt -C 'I@backupninja:client' mine.flush
15 salt -C 'I@backupninja:client' mine.update
16 node_name: {{ HOSTNAME_CFG01 }}
17 retry: {count: 1, delay: 1}
18 skip_fail: false
19
20- description: Apply the backupninja state to the backupninja client node
21 cmd: |
22 salt -C 'I@backupninja:client' state.sls backupninja
23 node_name: {{ HOSTNAME_CFG01 }}
24 retry: {count: 1, delay: 1}
25 skip_fail: false
26
27- description: Refresh grains for the backupninja server node
28 cmd: |
29 salt -C 'I@backupninja:server' state.sls salt.minion.grains
30 node_name: {{ HOSTNAME_CFG01 }}
31 retry: {count: 1, delay: 1}
32 skip_fail: false
33
34- description: Apply the backupninja state to the backupninja server node
35 cmd: |
36 salt -C 'I@backupninja:server' state.sls backupninja
37 node_name: {{ HOSTNAME_CFG01 }}
38 retry: {count: 1, delay: 1}
39 skip_fail: false
40
41{%- endmacro %}
42
43{%- macro MACRO_BACKUP_XTRABACKUP() %}
44
45- description: Refresh pillars
46 cmd: salt '*' saltutil.refresh_pillar
47 node_name: {{ HOSTNAME_CFG01 }}
48 retry: {count: 1, delay: 1}
49 skip_fail: false
50
51- description: Apply the salt.minion state
52 cmd: |
Dennis Dmitriev24ab78b2018-07-31 10:51:15 +030053 salt -C 'I@xtrabackup:client or I@xtrabackup:server' state.sls salt.minion && sleep 10
Tatyana Leontovich26756912018-06-06 20:11:05 +030054 node_name: {{ HOSTNAME_CFG01 }}
55 retry: {count: 1, delay: 1}
56 skip_fail: false
57
58- description: Refresh grains for the xtrabackup client node
59 cmd: salt -C 'I@xtrabackup:client' saltutil.sync_grains
60 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich643ca272018-06-15 13:50:07 +030061 retry: {count: 5, delay: 10}
Tatyana Leontovich26756912018-06-06 20:11:05 +030062 skip_fail: false
63
64- description: Update the mine for the xtrabackup client node
65 cmd: |
66 salt -C 'I@xtrabackup:client' mine.flush
67 salt -C 'I@xtrabackup:client' mine.update
68 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich643ca272018-06-15 13:50:07 +030069 retry: {count: 3, delay: 5}
Tatyana Leontovich26756912018-06-06 20:11:05 +030070 skip_fail: false
71
72- description: Apply the xtrabackup client state
73 cmd: |
74 salt -C 'I@xtrabackup:client' state.sls openssh.client,xtrabackup
75 node_name: {{ HOSTNAME_CFG01 }}
76 retry: {count: 1, delay: 1}
77 skip_fail: false
78
79- description: Apply the xtrabackup server state
80 cmd: |
81 salt -C 'I@xtrabackup:server' state.sls xtrabackup
82 node_name: {{ HOSTNAME_CFG01 }}
83 retry: {count: 1, delay: 1}
84 skip_fail: false
85
86{%- endmacro %}
87
88{%- macro MACRO_BACKUP_CEPH() %}
89
90- description: Refresh pillars
91 cmd: salt '*' saltutil.refresh_pillar
92 node_name: {{ HOSTNAME_CFG01 }}
93 retry: {count: 1, delay: 1}
94 skip_fail: false
95
96- description: Apply the salt.minion state
97 cmd: |
98 salt -C 'I@ceph:backup:client or I@ceph:backup:server' state.sls salt.minion
99 node_name: {{ HOSTNAME_CFG01 }}
100 retry: {count: 1, delay: 1}
101 skip_fail: false
102
103- description: Refresh grains for the ceph client node
104 cmd: salt -C 'I@ceph:backup:client' saltutil.sync_grains
105 node_name: {{ HOSTNAME_CFG01 }}
106 retry: {count: 1, delay: 1}
107 skip_fail: false
108
109- description: Update the mine for the client node
110 cmd: |
111 salt -C 'I@ceph:backup:client' mine.flush
112 salt -C 'I@ceph:backup:client' mine.update
113 node_name: {{ HOSTNAME_CFG01 }}
114 retry: {count: 1, delay: 1}
115 skip_fail: false
116
117- description: Apply the backup client state
118 cmd: |
119 salt -C 'I@ceph:backup:client' state.sls openssh.client,ceph.backup
120 node_name: {{ HOSTNAME_CFG01 }}
121 retry: {count: 1, delay: 1}
122 skip_fail: false
123
124- description: Apply the backup server state
125 cmd: |
126 salt -C 'I@ceph:backup:server' state.sls ceph.backup
127 node_name: {{ HOSTNAME_CFG01 }}
128 retry: {count: 1, delay: 1}
129 skip_fail: false
130
131{%- endmacro %}
132
Tatyana Leontovich92063ef2018-07-04 14:28:09 +0300133{%- macro MACRO_WR_NGINX_MASTER() %}
Tatyana Leontovich26756912018-06-06 20:11:05 +0300134
Tatyana Leontovich92063ef2018-07-04 14:28:09 +0300135- description: WR for https://mirantis.jira.com/browse/PROD-21132
136 cmd: |
Tatyana Leontovich61f3e132018-07-04 15:58:03 +0300137 sed -i 's/listen 8080/listen 8181/g' /etc/nginx/sites-available/nginx_proxy_ceph_radosgw.conf ;
Tatyana Leontovich92063ef2018-07-04 14:28:09 +0300138 sed -i 's/listen \[\:\:\]\:80/listen \[\:\:\]\:8181/g' /etc/nginx/sites-available/default ;
139 sed -i 's/listen 80 default_server/listen 8181 default_server/g' /etc/nginx/sites-available/default ;
140 systemctl restart nginx;
141 node_name: {{ HOSTNAME_CFG01 }}
142 retry: {count: 1, delay: 1}
Tatyana Leontoviche1d16192018-07-18 15:07:51 +0300143 skip_fail: true
Tatyana Leontovich26756912018-06-06 20:11:05 +0300144
Tatyana Leontovich92063ef2018-07-04 14:28:09 +0300145{%- endmacro %}
Tatyana Leontovich26756912018-06-06 20:11:05 +0300146
147