blob: 677c4c72f2e2a74f2ee2fd93484a6e03ce3871df [file] [log] [blame]
Matteo Scandoloaca86652017-08-08 13:05:27 -07001
2# Copyright 2017-present Open Networking Foundation
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
Srikanth Vavilapallicd9d9bd2016-12-03 22:53:42 +000017---
18- hosts: {{ instance_name }}
19 gather_facts: False
20 connection: ssh
Sapan Bhatiaaf80b7c2017-02-07 11:32:57 -080021 become: ubuntu
Srikanth Vavilapallicd9d9bd2016-12-03 22:53:42 +000022 vars:
23 keystone_tenant_id: {{ keystone_tenant_id }}
24 keystone_user_id: {{ keystone_user_id }}
25 rabbit_user: {{ rabbit_user }}
26 rabbit_password: {{ rabbit_password }}
27 rabbit_host: {{ rabbit_host }}
28
29 tasks:
Scott Baker645c0c52017-09-15 10:38:32 -070030 - name: Verify if vsg_stats_notifier ([] is to avoid capturing the shell process) cron job is already running
31 shell: pgrep -f [v]sg_stats_notifier | wc -l
Srikanth Vavilapallicd9d9bd2016-12-03 22:53:42 +000032 register: cron_job_pids_count
33
34 - name: DEBUG
35 debug: var=cron_job_pids_count.stdout
36
37 - name: make sure /usr/local/share/vsg_monitoring_agent exists
38 file: path=/usr/local/share/vsg_monitoring_agent state=directory owner=root group=root
39 become: yes
40 when: cron_job_pids_count.stdout == "0"
41
42 - name: Copy cron job to destination
Scott Baker645c0c52017-09-15 10:38:32 -070043 copy: src=/opt/xos/synchronizers/vsg/vsg_stats_notifier.py
44 dest=/usr/local/share/vsg_monitoring_agent/vsg_stats_notifier.py
Srikanth Vavilapallicd9d9bd2016-12-03 22:53:42 +000045 become: yes
46 when: cron_job_pids_count.stdout == "0"
47
48 - name: install python-kombu
49 apt: name=python-kombu state=present
50 become: yes
51 when: cron_job_pids_count.stdout == "0"
52
Scott Baker645c0c52017-09-15 10:38:32 -070053 - name: Initiate vsg_stats_notifier cron job
54 command: sudo python /usr/local/share/vsg_monitoring_agent/vsg_stats_notifier.py --keystone_tenant_id={{ keystone_tenant_id }} --keystone_user_id={{ keystone_user_id }} --rabbit_user={{ rabbit_user }} --rabbit_password={{ rabbit_password }} --rabbit_host={{ rabbit_host }} --vcpeservice_rabbit_exchange='vcpeservice'
Srikanth Vavilapallicd9d9bd2016-12-03 22:53:42 +000055 async: 9999999999999999
56 poll: 0
57 become: yes
58 when: cron_job_pids_count.stdout == "0"
59