-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision-influxdb
executable file
·82 lines (77 loc) · 2.72 KB
/
provision-influxdb
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
#!/usr/bin/env ansible-playbook
# (c) 2016 DataNexus Inc. All Rights Reserved.
# Licensed software not for distribution
#
# main routine for provisioning telegraf
---
# complete preflight for all host groups
- name: INFLUXDB OVERLAY | completing preflight OS configuration
hosts: all:!controlcenter_broker:!all_brokers
tags:
- influxdb
vars_files:
- roles/telegraf/defaults/main.yml
- "{{ tenant_config_path }}/config/site.yml"
- "{{ tenant_config_path }}/config/applications/telegraf.yml"
gather_facts: yes
tasks:
- include_role:
name: preflight
when: telegraf.enabled
# kafka_public doesn't really exists here -- just being consistent
- name: INFLUXDB OVERLAY | installing influxdb telegraf package
hosts: all:!controlcenter_broker:!all_brokers
tags:
- influxdb
vars_files:
- "{{ tenant_config_path }}/config/site.yml"
- "{{ tenant_config_path }}/config/applications/telegraf.yml"
gather_facts: yes
tasks:
- import_role:
name: influxdb
vars:
influxdb_version: "telegraf-{{ telegraf_version }}-{{ telegraf_os_releasever }}"
# this is necessary before we build host groups from the ansible server
- name: TELEGRAF OVERLAY | discovering kafka broker facts
tags:
- influxdb
hosts: kafka_broker
tasks:
- setup:
- name: TELEGRAF OVERLAY | building broker public internal host group
tags:
- influxdb
hosts: localhost
gather_facts: no
tasks:
# eth0 is the data plane in a single interface system
- name: TELEGRAF OVERLAY | building eth0 broker host group
add_host: hostname="{{ hostvars[item].ansible_eth0.ipv4.address }}" groupname=kafka_public
with_items: "{{ groups['kafka_broker'] }}"
when:
- "'kafka_broker' in groups | default([])"
- hostvars[item].ansible_eth1 is not defined
# eth1 is the dataplane in a multi interface system
- name: TELEGRAF OVERLAY | building eth1 broker host group
add_host: hostname="{{ hostvars[item].ansible_eth1.ipv4.address }}" groupname=kafka_public
with_items: "{{ groups['kafka_broker'] }}"
when:
- "'kafka_broker' in groups | default([])"
- hostvars[item].ansible_eth1 is defined
# kafka_public isn't a real group; don't install to it
- name: TELEGRAF OVERLAY | configuring telegraf
hosts: all:!controlcenter_broker:!all_brokers:!kafka_public
tags:
- influxdb
vars_files:
- "{{ tenant_config_path }}/config/site.yml"
- "{{ tenant_config_path }}/config/applications/telegraf.yml"
vars:
# this is semi clever; application gets set based on each host group
application: "{{ group_names | first }}"
gather_facts: yes
tasks:
- import_role:
name: telegraf
when: telegraf.enabled