-
Notifications
You must be signed in to change notification settings - Fork 0
/
pb.yml
77 lines (63 loc) · 1.92 KB
/
pb.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
---
- name: install monitoring sys on BBB servers
hosts: '{{hosts}}'
gather_facts: false
tasks:
- name: install python3-pip zabbix-agent
apt:
name:
- python3-pip
- zabbix-agent
state: latest
- name: copy bbb-monitoring directory to new host
copy: src=bbb-monitoring dest=/root mode=0755
- name: copy zabbix agent config
copy: src=zabbix_agentd.conf dest=/etc/zabbix mode=0755
- name: Replace Hostname in zabbix config
replace:
path: /etc/zabbix/zabbix_agentd.conf
regexp: 'ZBX_HOSTNAME'
replace: '{{ZBX_HOSTNAME}}'
- name: Replace zabbix server address in zabbix config
replace:
path: /etc/zabbix/zabbix_agentd.conf
regexp: 'ZBX_SERVER'
replace: '{{ZBX_SERVER}}'
- name: Replace BBB_URL variable
replace:
path: /root/bbb-monitoring/bbb-exporter/settings.py
regexp: 'BBB_URL'
replace: '{{BBB_URL}}'
- name: Replace BBB_SECERT variable
replace:
path: /root/bbb-monitoring/bbb-exporter/settings.py
regexp: 'BBB_SECRET'
replace: '{{BBB_SECRET}}'
- name: config zabbix sudoers
copy: src=zabbix dest=/etc/sudoers.d/ mode=0755
- name: run pip3 update
command: pip3 install --upgrade pip
- name: run pip3 install command
command: pip3 install -r requirements.txt
args:
chdir: /root/bbb-monitoring
- name: configure crontab
cron:
name: "### * * * * * python3 /root/bbb-monitoring/bbb-exporter/server.py "
minute: "*"
hour: "*"
day: "*"
month: "*"
weekday: "*"
job: "python3 /root/bbb-monitoring/bbb-exporter/server.py"
notify:
- restart crontab
- name: configure zabbix service
copy: src=bbb.conf dest=/etc/zabbix/zabbix_agentd.conf.d
notify:
- restart zabbix
handlers:
- name: restart zabbix
service: name=zabbix-agent state=restarted
- name: restart crontab
service: name=cron state=restarted