[ansible] Add unixsock to 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 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 unixsock plugin
96   set_fact:
97     collectd_plugins: "{{ collectd_plugins | union(['unixsock']) | unique }}"
98   tags:
99     - unixsock
100
101 - name: enable uuid plugin
102   include: uuid.yml
103
104 - name: configure plugins
105   include_role:
106     name: collectd_config
107   vars:
108     collectd_conf_output_dir: /tmp/collectd.conf.d
109   tags:
110     - always
111     - en_default_all
112
113 - name: Copy the generated plugin configs
114   copy:
115     src: "{{ item.src }}"
116     dest: "{{ item.dest }}"
117   with_items:
118     - { src: "/tmp/collectd.conf.d/", dest: "{{ config_file_dir }}" }
119     - { src: "/tmp/collectd.conf", dest: "{{ config_file_dir }}/../collectd.conf" }
120   tags:
121     - always
122     - en_default_all
123
124 - name: Update TypesDB location
125   lineinfile:
126     path: "{{ config_file_dir }}../collectd.conf"
127     regexp: '^TypesDB "/usr/share/collectd/types.db"$'
128     line: 'TypesDB "/opt/collectd/share/collectd/types.db"'
129
130 - name: Update config file location
131   lineinfile:
132     path: "{{ config_file_dir }}../collectd.conf"
133     regexp: "^(.*)/tmp/collectd.conf.d(.*)$"
134     line: '\1{{ config_file_dir }}\2'
135     backrefs: yes
136   tags:
137     - always
138     - en_default_all
139
140 - name: copy additional config files
141   include: additional_configs.yml