blob: 48a094d14c4ff55654d28ad6ea9000d7b957f361 [file] [log] [blame]
---
- hosts: {{ instance_name }}
gather_facts: False
connection: ssh
become: ubuntu
vars:
keystone_tenant_id: {{ keystone_tenant_id }}
keystone_user_id: {{ keystone_user_id }}
rabbit_user: {{ rabbit_user }}
rabbit_password: {{ rabbit_password }}
rabbit_host: {{ rabbit_host }}
tasks:
- name: Verify if vcpe_stats_notifier ([] is to avoid capturing the shell process) cron job is already running
shell: pgrep -f [v]cpe_stats_notifier | wc -l
register: cron_job_pids_count
- name: DEBUG
debug: var=cron_job_pids_count.stdout
- name: make sure /usr/local/share/vsg_monitoring_agent exists
file: path=/usr/local/share/vsg_monitoring_agent state=directory owner=root group=root
become: yes
when: cron_job_pids_count.stdout == "0"
- name: Copy cron job to destination
copy: src=/opt/xos/synchronizers/vsg/vcpe_stats_notifier.py
dest=/usr/local/share/vsg_monitoring_agent/vcpe_stats_notifier.py
become: yes
when: cron_job_pids_count.stdout == "0"
- name: install python-kombu
apt: name=python-kombu state=present
become: yes
when: cron_job_pids_count.stdout == "0"
- name: Initiate vcpe_stats_notifier cron job
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'
async: 9999999999999999
poll: 0
become: yes
when: cron_job_pids_count.stdout == "0"