1 # Copyright 2018-21 Anuket, Intel Corporation and others
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 - name: Check if vswitchd is running
17 shell: ps -ef | grep vswitchd | grep -v grep > /dev/null
18 register: vswitchd_running
24 - name: Check if db.sock exists
26 path: /var/run/openvswitch/db.sock
27 register: dbsock_exists
33 - name: enable ovs_stats plugin
35 collectd_plugins: '{{ collectd_plugins | union(["ovs_stats"]) | unique }}'
36 collectd_plugin_ovs_stats_port: "{{ ovs_stats_port if ovs_stats_port is defined else omit }}"
37 collectd_plugin_ovs_stats_address: "{{ ovs_stats_ip_addr if ovs_stats_ip_addr is defined else omit }}"
38 collectd_plugin_ovs_stats_interval: "{{ ovs_stats_interval if ovs_stats_interval is defined else omit }}"
39 when: (vswitchd_running is succeeded) and (dbsock_exists is succeeded)
43 - name: enable ovs_events plugin
45 collectd_plugins: '{{ collectd_plugins | union(["ovs_events"]) | unique }}'
46 collectd_plugin_ovs_events_interval: "{{ ovs_events_interval if ovs_events_interval is defined else omit }}"
47 collectd_plugin_ovs_events_address: "{{ ovs_events_ip_addr if ovs_events_ip_addr is defined else omit }}"
48 collectd_plugin_ovs_events_port: "{{ ovs_events_port if ovs_events_port is defined else omit }}"
49 when: (vswitchd_running is succeeded) and (dbsock_exists is succeeded)