| --- |
| - 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" |
| |