blob: eb9275745278d94e8cd70b50086ad1cfbefc1c50 [file] [log] [blame]
Srikanth Vavilapallicd9d9bd2016-12-03 22:53:42 +00001---
2- hosts: {{ instance_name }}
3 gather_facts: False
4 connection: ssh
5 user: ubuntu
6 vars:
7 keystone_tenant_id: {{ keystone_tenant_id }}
8 keystone_user_id: {{ keystone_user_id }}
9 rabbit_user: {{ rabbit_user }}
10 rabbit_password: {{ rabbit_password }}
11 rabbit_host: {{ rabbit_host }}
12
13 tasks:
14 - name: Verify if vcpe_stats_notifier ([] is to avoid capturing the shell process) cron job is already running
15 shell: pgrep -f [v]cpe_stats_notifier | wc -l
16 register: cron_job_pids_count
17
18 - name: DEBUG
19 debug: var=cron_job_pids_count.stdout
20
21 - name: make sure /usr/local/share/vsg_monitoring_agent exists
22 file: path=/usr/local/share/vsg_monitoring_agent state=directory owner=root group=root
23 become: yes
24 when: cron_job_pids_count.stdout == "0"
25
26 - name: Copy cron job to destination
27 copy: src=/opt/xos/synchronizers/vsg/vcpe_stats_notifier.py
28 dest=/usr/local/share/vsg_monitoring_agent/vcpe_stats_notifier.py
29 become: yes
30 when: cron_job_pids_count.stdout == "0"
31
32 - name: install python-kombu
33 apt: name=python-kombu state=present
34 become: yes
35 when: cron_job_pids_count.stdout == "0"
36
37 - name: Initiate vcpe_stats_notifier cron job
38 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'
39 async: 9999999999999999
40 poll: 0
41 become: yes
42 when: cron_job_pids_count.stdout == "0"
43