[ansible] Use collectd_config in config_files role
[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 virt plugin
87   import_tasks: virt.yml
88
89 - name: enable ipmi plugin
90   include: ipmi.yml
91
92 - name: enable uuid plugin
93   include: uuid.yml
94
95 - name: configure plugins
96   include_role:
97     name: collectd_config
98   vars:
99     collectd_conf_output_dir: /tmp/collectd.conf.d
100   tags:
101     - always
102     - en_default_all
103
104 - name: "Copy the generated plugin configs"
105   shell:
106     sudo cp /tmp/collectd.conf.d/*.conf {{ config_file_dir }} && sudo cp /tmp/collectd.conf {{ config_file_dir }}/../collectd.conf
107   tags:
108     - always
109     - en_default_all
110
111 - name: Update config file location
112   lineinfile:
113     path: "{{ config_file_dir }}../collectd.conf"
114     regexp: "^(.*)/tmp/collectd.conf.d(.*)$"
115     line: '\1{{ config_file_dir }}\2'
116     backrefs: yes
117   tags:
118     - always
119     - en_default_all
120
121 - name: copy additional config files
122   include: additional_configs.yml