Initial commit of PassiveTest
Change-Id: Idcd9a0c72df5eae6b4eedc544e473ebc9763ccdb
diff --git a/xos/synchronizer/steps/sync_monitoring_agent.yaml b/xos/synchronizer/steps/sync_monitoring_agent.yaml
new file mode 100644
index 0000000..93f805e
--- /dev/null
+++ b/xos/synchronizer/steps/sync_monitoring_agent.yaml
@@ -0,0 +1,36 @@
+---
+- hosts: {{ instance_name }}
+ gather_facts: False
+ connection: ssh
+ user: root
+ 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 monitoring_stats_notifier ([] is to avoid capturing the shell process) job is already running
+ shell: pgrep -f [m]onitoring_stats_notifier | wc -l
+ register: job_pids_count
+
+ - name: make sure /usr/local/share/monitoring_agent exists
+ file: path=/usr/local/share/monitoring_agent state=directory owner=root group=root
+ when: job_pids_count.stdout == "0"
+
+ - name: make a processed file folder
+ file: path=/xsight/var/opt/xagg/tmp/processed state=directory owner=root group=root
+ when: job_pids_count.stdout == "0"
+
+ - name: Copy job to destination
+ copy: src=/opt/xos/synchronizers/passivetest/monitoring_stats_notifier.py
+ dest=/usr/local/share/monitoring_agent/monitoring_stats_notifier.py
+ when: job_pids_count.stdout == "0"
+
+ - name: Initiate monitoring_stats_notifier job
+ command: python /usr/local/share/monitoring_agent/monitoring_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 }} --rabbit-exchange-name='passivetestservice'
+ async: 9999999999999999
+ poll: 0
+ when: job_pids_count.stdout == "0"
+