[ansible] Use collectd_config for plugins
[barometer.git] / docker / ansible / roles / config_files / tasks / main.yml
1 # Copyright 2018-2021 Intel Corporation, Anuket and others.
2 # All rights reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 ---
17
18 - name: Clean collectd config dir path
19   file:
20     state: absent
21     path: "{{ config_file_dir }}"
22   tags:
23    - rm_config_dir
24    - always
25
26 - name: Create collectd.d folder on remote host
27   file:
28     path: "{{ config_file_dir }}"
29     force: yes
30     state: directory
31   tags:
32     - always
33
34 - name: enable capabilities plugin
35   import_tasks: capabilities.yml
36
37 - name: enable csv plugin
38   import_tasks: csv.yml
39
40 - name: enable default plugins
41   import_tasks: default_read_import.yml
42
43 - name: enable dpdk plugins
44   import_tasks: dpdk.yml
45
46 - name: enable exec plugin
47   import_tasks: exec.yml
48
49 - name: enable hugepages plugin
50   import_tasks: hugepages.yml
51
52 - name: enable kafka plugin
53   import_tasks: kafka.yml
54
55 - name: enable logfile plugin
56   import_tasks: logfile.yml
57
58 - name: enable logparser plugin
59   import_tasks: logparser.yml
60
61 - name: enable mcelog plugin
62   import_tasks: mcelog.yml
63
64 - name: enable network plugin
65   import_tasks: network.yml
66
67 - name: enable prometheus plugin
68   import_tasks: prometheus.yml
69   when: groups['prometheus_hosts'] is defined
70
71 - name: enable pmu plugin
72   import_tasks: pmu.yml
73
74 - name: enable rdt plugin
75   import_tasks: rdt.yml
76
77 - name: enable rddtool plugin
78   import_tasks: rrdtool.yml
79
80 - name: enable snmp_agent plugin
81   import_tasks: snmp_agent.yml
82
83 - name: enable syslog plugin
84   import_tasks: syslog.yml
85
86 - name: enable ovs plugins
87   import_tasks: ovs.yml
88
89 - name: enable virt plugin
90   import_tasks: virt.yml
91
92 - name: enable ipmi plugin
93   include: ipmi.yml
94
95 - name: enable uuid plugin
96   include: uuid.yml
97
98 - name: configure plugins
99   include_role:
100     name: collectd_config
101   vars:
102     collectd_conf_output_dir: /tmp/collectd.conf.d
103   tags:
104     - always
105     - en_default_all
106
107 - name: Copy the generated plugin configs
108   copy:
109     src: "{{ item.src }}"
110     dest: "{{ item.dest }}"
111   with_items:
112     - { src: "/tmp/collectd.conf.d/", dest: "{{ config_file_dir }}" }
113     - { src: "/tmp/collectd.conf", dest: "{{ config_file_dir }}/../collectd.conf" }
114   tags:
115     - always
116     - en_default_all
117
118 - name: Update TypesDB location
119   lineinfile:
120     path: "{{ config_file_dir }}../collectd.conf"
121     regexp: '^TypesDB "/usr/share/collectd/types.db"$'
122     line: 'TypesDB "/opt/collectd/share/collectd/types.db"'
123
124 - name: Update config file location
125   lineinfile:
126     path: "{{ config_file_dir }}../collectd.conf"
127     regexp: "^(.*)/tmp/collectd.conf.d(.*)$"
128     line: '\1{{ config_file_dir }}\2'
129     backrefs: yes
130   tags:
131     - always
132     - en_default_all
133
134 - name: copy additional config files
135   include: additional_configs.yml