-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_alert_endpoints.yml
153 lines (139 loc) · 4.59 KB
/
setup_alert_endpoints.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
- hosts: localhost
name: "Creates or Update AxonOps alert endpoints"
become: false
connection: local
gather_facts: false
pre_tasks:
- name: Get the Org name
tags: always
ansible.builtin.set_fact:
org: "{{ lookup('env', 'AXONOPS_ORG') }}"
when: org is not defined
- name: Fail if no org
ansible.builtin.assert:
that:
- org is defined
- org | length > 1
- name: Include the default configs
tags: always
ansible.builtin.include_vars: "{{ item }}"
with_fileglob:
- "config/all/alert_endpoints.yml"
- name: Include the org configs
tags: always
ansible.builtin.include_vars: "{{ item }}"
with_fileglob:
- "config/{{ org }}/alert_endpoints.yml"
- name: List clusters in the org
axonops.configuration.get_clusters:
org: "{{ org }}"
register: _clusters
tags: always
- name: Define primary cluster
tags: always
ansible.builtin.set_fact:
cluster: "{{ _clusters['clusters']['cassandra'][0] }}"
tasks:
- name: Install pagerduty integrations
axonops.configuration.pagerduty_integration:
org: "{{ org }}"
cluster: "{{ cluster}}"
name: "{{ item.name }}"
integration_key: "{{ item.integration_key }}"
present: "{{ item.present|default(true) }}"
with_items:
"{{ axonops_pagerduty_integration }}"
when: axonops_pagerduty_integration is defined
no_log: "{{ false if enable_logging is defined and enable_logging else true }}"
tags:
- axonops_pagerduty_integration
- pagerduty_integration
- integration
- pagerduty
- name: Apply Slack Integrations
axonops.configuration.slack_integration:
org: "{{ org }}"
cluster: "{{ cluster }}"
name: "{{ item.name }}"
webhook_url: "{{ item.webhook_url }}"
channel: "{{ item.channel|default(omit) }}"
present: "{{ item.present|default(true) }}"
when: axonops_slack_integration is defined
no_log: "{{ false if enable_logging is defined and enable_logging else true }}"
with_items:
"{{ axonops_slack_integration }}"
tags:
- axonops_slack_integration
- slack_integration
- integration
- slack
- name: Apply OpsGenie Integrations
axonops.configuration.opsgenie_integration:
org: "{{ org }}"
cluster: "{{ cluster }}"
name: "{{ item.name }}"
opsgenie_key: "{{ item.opsgenie_key }}"
when: axonops_opsgenie_integration is defined
with_items:
"{{ axonops_opsgenie_integration }}"
no_log: "{{ false if enable_logging is defined and enable_logging else true }}"
tags:
- axonops_opsgenie_integration
- opsgenie_integration
- integration
- opsgenie
- name: Apply ServiceNow Integrations
axonops.configuration.servicenow_integration:
org: "{{ org }}"
cluster: "{{ cluster }}"
name: "{{ item.name }}"
instance_name: "{{ item.instance_name }}"
user: "{{ item.user }}"
password: "{{ item.password }}"
when: axonops_servicenow_integration is defined
with_items:
"{{ axonops_servicenow_integration }}"
no_log: "{{ false if enable_logging is defined and enable_logging else true }}"
tags:
- axonops_servicenow_integration
- servicenow_integration
- integration
- servicenow
- name: Apply Microsoft Teams Integrations
axonops.configuration.teams_integration:
org: "{{ org }}"
cluster: "{{ cluster }}"
name: "{{ item.name }}"
webhook_url: "{{ item.webhook_url }}"
when: axonops_teams_integration is defined
with_items:
"{{ axonops_teams_integration }}"
no_log: "{{ false if enable_logging is defined and enable_logging else true }}"
tags:
- axonops_teams_integration
- teams_integration
- integration
- teams
# Set up alert routes for:
# - Global
# - Metrics
# - Backups
# - Service checks
# - Nodes
# - Repairs
- name: Set Up Routes
axonops.configuration.teams_integration:
org: "{{ org }}"
cluster: "{{ cluster }}"
name: "{{ item.name }}"
webhook_url: "{{ item.webhook_url }}"
when: axonops_teams_integration is defined
with_items:
"{{ axonops_teams_integration }}"
no_log: "{{ false if enable_logging is defined and enable_logging else true }}"
tags:
- axonops_teams_integration
- teams_integration
- integration
- teams
# code: language=ansible