blob: e617504b8d6731ee2aaf1af35a53e2e752f6d32a [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:
30 - name: Verify if vcpe_stats_notifier ([] is to avoid capturing the shell process) cron job is already running
31 shell: pgrep -f [v]cpe_stats_notifier | wc -l
32 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
43 copy: src=/opt/xos/synchronizers/vsg/vcpe_stats_notifier.py
44 dest=/usr/local/share/vsg_monitoring_agent/vcpe_stats_notifier.py
45 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
53 - name: Initiate vcpe_stats_notifier cron job
54 command: sudo python /usr/local/share/vsg_monitoring_agent/vcpe_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'
55 async: 9999999999999999
56 poll: 0
57 become: yes
58 when: cron_job_pids_count.stdout == "0"
59