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