Gabe Black | 9062322 | 2017-01-18 19:52:28 +0000 | [diff] [blame^] | 1 | --- |
| 2 | - hosts: {{ instance_name }} |
| 3 | gather_facts: False |
| 4 | connection: ssh |
| 5 | user: root |
| 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 monitoring_stats_notifier ([] is to avoid capturing the shell process) job is already running |
| 15 | shell: pgrep -f [m]onitoring_stats_notifier | wc -l |
| 16 | register: job_pids_count |
| 17 | |
| 18 | - name: make sure /usr/local/share/monitoring_agent exists |
| 19 | file: path=/usr/local/share/monitoring_agent state=directory owner=root group=root |
| 20 | when: job_pids_count.stdout == "0" |
| 21 | |
| 22 | - name: make a processed file folder |
| 23 | file: path=/xsight/var/opt/xagg/tmp/processed state=directory owner=root group=root |
| 24 | when: job_pids_count.stdout == "0" |
| 25 | |
| 26 | - name: Copy job to destination |
| 27 | copy: src=/opt/xos/synchronizers/passivetest/monitoring_stats_notifier.py |
| 28 | dest=/usr/local/share/monitoring_agent/monitoring_stats_notifier.py |
| 29 | when: job_pids_count.stdout == "0" |
| 30 | |
| 31 | - name: Initiate monitoring_stats_notifier job |
| 32 | 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' |
| 33 | async: 9999999999999999 |
| 34 | poll: 0 |
| 35 | when: job_pids_count.stdout == "0" |
| 36 | |