diff options
Diffstat (limited to 'docker/ansible/roles/config_files/tasks')
24 files changed, 927 insertions, 0 deletions
diff --git a/docker/ansible/roles/config_files/tasks/additional_configs.yml b/docker/ansible/roles/config_files/tasks/additional_configs.yml new file mode 100644 index 00000000..28cad8a4 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/additional_configs.yml @@ -0,0 +1,23 @@ +#Copyright 2018 OPNFV and Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: copy additional configuration files to target system + template: + src: "{{ item }}" + dest: "{{ config_file_dir }}/{{ item | basename | regex_replace('\\.j2','') }}" + with_fileglob: + - "{{ additional_configs_path }}" + tags: + - copy_additional_configs diff --git a/docker/ansible/roles/config_files/tasks/capabilities.yml b/docker/ansible/roles/config_files/tasks/capabilities.yml new file mode 100644 index 00000000..cfca03a2 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/capabilities.yml @@ -0,0 +1,21 @@ +# Copyright 2019-21 Anuket, Intel Corporation and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: enable capabilities plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['capabilities']) | unique }}" + tags: + - capabilities + diff --git a/docker/ansible/roles/config_files/tasks/csv.yml b/docker/ansible/roles/config_files/tasks/csv.yml new file mode 100644 index 00000000..bfd88c0e --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/csv.yml @@ -0,0 +1,21 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: enable csv plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['csv']) | unique }}" + tags: + - csv + diff --git a/docker/ansible/roles/config_files/tasks/default_read_import.yml b/docker/ansible/roles/config_files/tasks/default_read_import.yml new file mode 100644 index 00000000..46b4d516 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/default_read_import.yml @@ -0,0 +1,118 @@ +# Copyright 2018-21 OPNFV, Intel Corporation and Red Hat +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- name: enable contextswitch plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['contextswitch']) | unique }}" + tags: + - en_default_all + - contextswitch + +- name: enable cpu plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['cpu']) | unique }}" + tags: + - en_default_all + - cpu + +- name: enable cpufreq plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['cpufreq']) | unique }}" + tags: + - en_default_all + - cpufreq + +- name: enable df plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['df']) | unique }}" + tags: + - en_default_all + - df + +- name: enable disk plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['disk']) | unique }}" + tags: + - en_default_all + - disk + +- name: enable ethstat plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['ethstat']) | unique }}" + tags: + - en_default_all + - ethstat + +- name: enable ipc plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['ipc']) | unique }}" + tags: + - en_default_all + - ipc + +- name: enable irq plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['irq']) | unique }}" + tags: + - en_default_all + - irq + +- name: enable load plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['load']) | unique }}" + tags: + - en_default_all + - load + +- name: enable memory plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['memory']) | unique }}" + tags: + - en_default_all + - memory + +- name: enable numa plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['numa']) | unique }}" + tags: + - en_default_all + - numa + +- name: enable processes plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['processes']) | unique }}" + tags: + - en_default_all + - processes + +- name: enable swap plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['swap']) | unique }}" + tags: + - en_default_all + - swap + +- name: enable turbostat plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['turbostat']) | unique }}" + tags: + - en_default_all + - turbostat + +- name: enable uptime plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['uptime']) | unique }}" + tags: + - en_default_all + - uptime diff --git a/docker/ansible/roles/config_files/tasks/dpdk.yml b/docker/ansible/roles/config_files/tasks/dpdk.yml new file mode 100644 index 00000000..2be146b0 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/dpdk.yml @@ -0,0 +1,19 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- name: enable dpdk_telemetry plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['dpdk_telemetry']) | unique }}" + tags: + - dpdk_telemetry diff --git a/docker/ansible/roles/config_files/tasks/exec.yml b/docker/ansible/roles/config_files/tasks/exec.yml new file mode 100644 index 00000000..956e3a8f --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/exec.yml @@ -0,0 +1,19 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- name: enable exec plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['exec']) | unique }}" + tags: + - exec diff --git a/docker/ansible/roles/config_files/tasks/hugepages.yml b/docker/ansible/roles/config_files/tasks/hugepages.yml new file mode 100644 index 00000000..5b4ec0ba --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/hugepages.yml @@ -0,0 +1,32 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: check if hugepages folders exist on host + stat: + path: "{{ item }}" + register: hugepages_result + ignore_errors: "true" + with_items: + /sys/devices/system/node + /sys/kernel/mm/hugepages + tags: + - hugepages + +- name: enable hugepages plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['hugepages']) | unique }}" + when: hugepages_result is succeeded + tags: + - hugepages diff --git a/docker/ansible/roles/config_files/tasks/ipmi.yml b/docker/ansible/roles/config_files/tasks/ipmi.yml new file mode 100644 index 00000000..12913a85 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/ipmi.yml @@ -0,0 +1,60 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: check ipmi_devintf is loaded + shell: "lsmod | cut -d' ' -f1 | grep ipmi_devintf" + register: ipmi_devintf + ignore_errors: true + tags: + - ipmi + +- name: check ipmi_si is loaded + shell: "lsmod | cut -d' ' -f1 | grep ipmi_si" + register: ipmi_devsi + ignore_errors: true + tags: + - ipmi + +- name: insert ipmi module ipmi_devintf + command: "modprobe ipmi_devintf" + register: ipmi_devintf + ignore_errors: true + when: (ipmi_devintf is failed) and (insert_ipmi_modules|default(false)|bool) + tags: + - ipmi + +- name: insert ipmi module ipmi_si + command: "modprobe ipmi_si" + register: ipmi_devsi + ignore_errors: true + when: (ipmi_devsi is failed) and (insert_ipmi_modules|default(false)|bool) + tags: + - ipmi + +- name: Check if /dev/ipmi0 exists + stat: + path: /dev/ipmi0 + register: ipmi0_exists + ignore_errors: true + tags: + - ipmi + +- name: enable ipmi plugin + set_fact: + collectd_plugins: '{{ collectd_plugins | union(["ipmi"]) | unique }}' + when: (ipmi0_exists is succeeded) and (ipmi_devintf is succeeded) and (ipmi_devsi is succeeded) + tags: + - ipmi + diff --git a/docker/ansible/roles/config_files/tasks/kafka.yml b/docker/ansible/roles/config_files/tasks/kafka.yml new file mode 100644 index 00000000..6fb3f050 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/kafka.yml @@ -0,0 +1,20 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: enable kafka plugin with collectd_config + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['write_kafka']) | unique }}" + tags: + - kafka diff --git a/docker/ansible/roles/config_files/tasks/logfile.yml b/docker/ansible/roles/config_files/tasks/logfile.yml new file mode 100644 index 00000000..cd1c1049 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/logfile.yml @@ -0,0 +1,21 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: enable logfile plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['logfile']) | unique }}" + tags: + - logfile + diff --git a/docker/ansible/roles/config_files/tasks/logparser.yml b/docker/ansible/roles/config_files/tasks/logparser.yml new file mode 100644 index 00000000..72adcea2 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/logparser.yml @@ -0,0 +1,22 @@ +# Copyright 2019-21 Anuket, Intel Corporation, and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: enable logparser plugin + template: + src: logparser.conf.j2 + dest: "{{ config_file_dir }}/logparser.conf" + tags: + - logparser + diff --git a/docker/ansible/roles/config_files/tasks/main.yml b/docker/ansible/roles/config_files/tasks/main.yml new file mode 100644 index 00000000..9b241890 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/main.yml @@ -0,0 +1,141 @@ +# Copyright 2018-2021 Intel Corporation, Anuket and others. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +--- + +- name: Clean collectd config dir path + file: + state: absent + path: "{{ config_file_dir }}" + tags: + - rm_config_dir + - always + +- name: Create collectd.d folder on remote host + file: + path: "{{ config_file_dir }}" + force: yes + state: directory + tags: + - always + +- name: enable capabilities plugin + import_tasks: capabilities.yml + +- name: enable csv plugin + import_tasks: csv.yml + +- name: enable default plugins + import_tasks: default_read_import.yml + +- name: enable dpdk plugins + import_tasks: dpdk.yml + +- name: enable exec plugin + import_tasks: exec.yml + +- name: enable hugepages plugin + import_tasks: hugepages.yml + +- name: enable kafka plugin + import_tasks: kafka.yml + +- name: enable logfile plugin + import_tasks: logfile.yml + +- name: enable logparser plugin + import_tasks: logparser.yml + +- name: enable mcelog plugin + import_tasks: mcelog.yml + +- name: enable network plugin + import_tasks: network.yml + +- name: enable prometheus plugin + import_tasks: prometheus.yml + when: groups['prometheus_hosts'] is defined + +- name: enable pmu plugin + import_tasks: pmu.yml + +- name: enable rdt plugin + import_tasks: rdt.yml + +- name: enable rddtool plugin + import_tasks: rrdtool.yml + +- name: enable snmp_agent plugin + import_tasks: snmp_agent.yml + +- name: enable syslog plugin + import_tasks: syslog.yml + +- name: enable ovs plugins + import_tasks: ovs.yml + +- name: enable virt plugin + import_tasks: virt.yml + +- name: enable ipmi plugin + include: ipmi.yml + +- name: Enable unixsock plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['unixsock']) | unique }}" + tags: + - unixsock + +- name: enable uuid plugin + include: uuid.yml + +- name: configure plugins + include_role: + name: collectd_config + vars: + collectd_conf_output_dir: /tmp/collectd.conf.d + tags: + - always + - en_default_all + +- name: Copy the generated plugin configs + copy: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + with_items: + - { src: "/tmp/collectd.conf.d/", dest: "{{ config_file_dir }}" } + - { src: "/tmp/collectd.conf", dest: "{{ config_file_dir }}/../collectd.conf" } + tags: + - always + - en_default_all + +- name: Update TypesDB location + lineinfile: + path: "{{ config_file_dir }}../collectd.conf" + regexp: '^TypesDB "/usr/share/collectd/types.db"$' + line: 'TypesDB "/opt/collectd/share/collectd/types.db"' + +- name: Update config file location + lineinfile: + path: "{{ config_file_dir }}../collectd.conf" + regexp: "^(.*)/tmp/collectd.conf.d(.*)$" + line: '\1{{ config_file_dir }}\2' + backrefs: yes + tags: + - always + - en_default_all + +- name: copy additional config files + include: additional_configs.yml diff --git a/docker/ansible/roles/config_files/tasks/make_mcelog.yml b/docker/ansible/roles/config_files/tasks/make_mcelog.yml new file mode 100644 index 00000000..938396c8 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/make_mcelog.yml @@ -0,0 +1,36 @@ +# Copyright 2016-2019 Intel Corporation and OPNFV. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +--- + +- name: extract mcelog from online archive + unarchive: + src: https://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git/snapshot/mcelog-161.tar.gz + dest: /tmp + remote_src: yes + +- name: make mcelog + make: + chdir: /tmp/mcelog-161 + +- name: make install mcelog + make: + chdir: /tmp/mcelog-161 + target: install + +- name: copy mcelog service + copy: + src: /tmp/mcelog-161/mcelog.service + dest: /etc/systemd/system/mcelog.service + remote_src: yes diff --git a/docker/ansible/roles/config_files/tasks/mcelog.yml b/docker/ansible/roles/config_files/tasks/mcelog.yml new file mode 100644 index 00000000..ac14f80c --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/mcelog.yml @@ -0,0 +1,78 @@ +# Copyright 2018-2019 Intel Corporation and OPNFV. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +--- + +- name: install mcelog package + package: + name: mcelog + state: present + ignore_errors: "true" + when: install_mcelog|default(false)|bool + tags: + - mcelogs + +- name: check if mcelog present + shell: which mcelog > /dev/null + register: mcelog_present + ignore_errors: "true" + when: install_mcelog|default(false)|bool + tags: + - mcelogs + +- name: build mcelog from sources if not in package + import_tasks: make_mcelog.yml + when: (mcelog_present is failed) and (install_mcelog|default(false)|bool) + tags: + - mcelogs + +- name: start mcelog daemon if not running + service: + name: mcelog + state: started + enabled: true + ignore_errors: "true" + when: install_mcelog|default(false)|bool + tags: + - mcelogs + +- name: check if mcelog running on host + shell: ps -ef | grep mcelog | grep -v grep > /dev/null + register: mcelog_running + ignore_errors: "true" + tags: + - mcelogs + +- name: check if mcelog exists + shell: which mcelog > /dev/null + register: mcelog_exists + ignore_errors: "true" + tags: + - mcelogs + +- name: check if mcelog-client exists + stat: + path: /var/run/mcelog-client + register: mcelog_client_exists + ignore_errors: "true" + tags: + - mcelogs + +- name: enable mcelog plugin + template: + src: mcelog.conf.j2 + dest: "{{ config_file_dir }}/mcelog.conf" + when: (mcelog_running is succeeded) and (mcelog_exists is succeeded) and (mcelog_client_exists is succeeded) + tags: + - mcelogs diff --git a/docker/ansible/roles/config_files/tasks/network.yml b/docker/ansible/roles/config_files/tasks/network.yml new file mode 100644 index 00000000..0af6a713 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/network.yml @@ -0,0 +1,38 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: Enable network plugin + set_fact: + collectd_plugins: '{{ collectd_plugins | union (["network"]) | unique }}' + tags: + - network + +- name: Add network port if defined + set_fact: + collectd_plugin_network_server: "{{ collectd_plugin_network_server | default([]) | union([{ + 'name': network_ip_addr, + 'port': network_port, + }]) }}" + when: network_ip_addr is defined + tags: + - network + +- name: Modify network.conf to add influxdb_hosts + set_fact: + collectd_plugin_network_server: "{{ collectd_plugin_network_server | default([]) | union([{ 'name': item, 'port': influx_network_port }]) }}" + with_items: "{{ groups['influxdb_hosts'] }}" + tags: + - network + diff --git a/docker/ansible/roles/config_files/tasks/ovs.yml b/docker/ansible/roles/config_files/tasks/ovs.yml new file mode 100644 index 00000000..fe3f0a13 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/ovs.yml @@ -0,0 +1,53 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: Check if vswitchd is running + shell: ps -ef | grep vswitchd | grep -v grep > /dev/null + register: vswitchd_running + ignore_errors: True + tags: + - ovs_stats + - ovs_events + +- name: Check if db.sock exists + stat: + path: /var/run/openvswitch/db.sock + register: dbsock_exists + ignore_errors: True + tags: + - ovs_stats + - ovs_events + +- name: enable ovs_stats plugin + set_fact: + collectd_plugins: '{{ collectd_plugins | union(["ovs_stats"]) | unique }}' + collectd_plugin_ovs_stats_port: "{{ ovs_stats_port if ovs_stats_port is defined else omit }}" + collectd_plugin_ovs_stats_address: "{{ ovs_stats_ip_addr if ovs_stats_ip_addr is defined else omit }}" + collectd_plugin_ovs_stats_interval: "{{ ovs_stats_interval if ovs_stats_interval is defined else omit }}" + when: (vswitchd_running is succeeded) and (dbsock_exists is succeeded) + tags: + - ovs_stats + +- name: enable ovs_events plugin + set_fact: + collectd_plugins: '{{ collectd_plugins | union(["ovs_events"]) | unique }}' + collectd_plugin_ovs_events_interval: "{{ ovs_events_interval if ovs_events_interval is defined else omit }}" + collectd_plugin_ovs_events_address: "{{ ovs_events_ip_addr if ovs_events_ip_addr is defined else omit }}" + collectd_plugin_ovs_events_port: "{{ ovs_events_port if ovs_events_port is defined else omit }}" + when: (vswitchd_running is succeeded) and (dbsock_exists is succeeded) + tags: + - ovs_events + + diff --git a/docker/ansible/roles/config_files/tasks/pmu.yml b/docker/ansible/roles/config_files/tasks/pmu.yml new file mode 100644 index 00000000..c5820f98 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/pmu.yml @@ -0,0 +1,20 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: enable intel_pmu plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['intel_pmu']) | unique }}" + tags: + - pmu diff --git a/docker/ansible/roles/config_files/tasks/prometheus.yml b/docker/ansible/roles/config_files/tasks/prometheus.yml new file mode 100644 index 00000000..c0e7e79d --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/prometheus.yml @@ -0,0 +1,20 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: enable prometheus plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['write_prometheus']) | unique }}" + tags: + - prometheus diff --git a/docker/ansible/roles/config_files/tasks/rdt.yml b/docker/ansible/roles/config_files/tasks/rdt.yml new file mode 100644 index 00000000..f0a46261 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/rdt.yml @@ -0,0 +1,38 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: check if rdt on host + shell: | + grep -q cqm* "/proc/cpuinfo" + register: rdt_result + ignore_errors: "true" + tags: + - rdt + +- name: (rdt) check if virt is enabled + stat: + path: "{{ config_file_dir }}/virt.conf" + register: virt_file + tags: + - rdt + +- name: enable rdt plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['intel_rdt']) | unique }}" + when: (rdt_result is succeeded) and (virt_file.stat.exists == False) + tags: + - rdt + + diff --git a/docker/ansible/roles/config_files/tasks/rrdtool.yml b/docker/ansible/roles/config_files/tasks/rrdtool.yml new file mode 100644 index 00000000..4c681dc6 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/rrdtool.yml @@ -0,0 +1,22 @@ +#Copyright 2018 OPNFV and Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: enable rrdtool plugin + template: + src: rrdtool.conf.j2 + dest: "{{ config_file_dir }}/rrdtool.conf" + tags: + - rrdtool + diff --git a/docker/ansible/roles/config_files/tasks/snmp_agent.yml b/docker/ansible/roles/config_files/tasks/snmp_agent.yml new file mode 100644 index 00000000..5e1ba975 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/snmp_agent.yml @@ -0,0 +1,30 @@ +#Copyright 2018-2019 OPNFV and Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: enable snmp agent + template: + src: snmp_agent.conf.j2 + dest: "{{ config_file_dir }}/snmp_agent.conf" + when: flavor|default('stable')|string == 'stable' + tags: + - snmp + +- name: enable snmp agent for non-stable container + template: + src: latest/snmp_agent.conf.j2 + dest: "{{ config_file_dir }}/snmp_agent.conf" + when: flavor|default('stable')|string != 'stable' + tags: + - snmp diff --git a/docker/ansible/roles/config_files/tasks/syslog.yml b/docker/ansible/roles/config_files/tasks/syslog.yml new file mode 100644 index 00000000..e9ab06f3 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/syslog.yml @@ -0,0 +1,21 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: enable syslog plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['syslog']) | unique }}" + tags: + - syslog + diff --git a/docker/ansible/roles/config_files/tasks/uuid.yml b/docker/ansible/roles/config_files/tasks/uuid.yml new file mode 100644 index 00000000..df669e1a --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/uuid.yml @@ -0,0 +1,20 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: enable uuid plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['uuid']) | unique }}" + tags: + - uuid diff --git a/docker/ansible/roles/config_files/tasks/virt.yml b/docker/ansible/roles/config_files/tasks/virt.yml new file mode 100644 index 00000000..75a17a18 --- /dev/null +++ b/docker/ansible/roles/config_files/tasks/virt.yml @@ -0,0 +1,34 @@ +# Copyright 2018-21 Anuket, Intel Corporation and others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- + +- name: check if libvirtd on host + shell: ps -ef | grep libvirtd | grep -v grep > /dev/null + register: libvirt_result + ignore_errors: "true" + tags: + - virt + +- name: (virt) check if rdt is enabled + set_fact: + rdt_enabled: true + tags: + - rdt + +- name: enable virt plugin + set_fact: + collectd_plugins: "{{ collectd_plugins | union(['virt']) | unique }}" + when: libvirt_result is succeeded and not (rdt_enabled | default(false)) + tags: + - virt |