-
Notifications
You must be signed in to change notification settings - Fork 6
/
test_setup.alerts_logger.yml
63 lines (52 loc) · 1.73 KB
/
test_setup.alerts_logger.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
---
# ========================================
# QE configuration for alerts logger
# ========================================
#
# This playbook serves as setup of alerts logger on a client machine.
# It periodically logs alerts from tendrl api based on tendrl user.
- hosts: usm_client
remote_user: root
vars:
tendrl_user: "admin"
tendrl_password: "adminuser"
handlers:
- name: Restart alert logger
service:
name: usmqe_alerts_logger@{{ tendrl_user }}
state: restarted
tasks:
- set_fact:
tendrl_ssl: "{{ 'true' if tendrl_api_url_protocol == 'https' else 'false' }}"
when: tendrl_api_url_protocol is defined
- set_fact:
tendrl_ssl: "false"
when: tendrl_api_url_protocol is undefined
- name: Create alerts_logger python script
copy:
dest: "/usr/local/bin/usmqe_alerts_logger.py"
src: "bin/usmqe_alerts_logger.py"
mode: "+x"
- name: Create service file
copy:
dest: /etc/systemd/system/
src: [email protected]
- name: force systemd to reread configs
systemd: daemon_reload=yes
- name: Add user and address to users.ini
ini_file:
path: /etc/usmqe_alerts_logger_users.ini
section: "{{ tendrl_user }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- { option: "password", value: "{{ tendrl_password }}" }
- { option: "url", value: "{{ groups['usm_server'][0] }}" }
- { option: "ssl", value: "{{ tendrl_ssl }}" }
notify:
- Restart alert logger
- name: Enable and start alert logger
systemd:
name: usmqe_alerts_logger@{{ tendrl_user }}
state: started
enabled: True