rdudyala | 996d70b | 2016-10-13 17:40:55 +0000 | [diff] [blame] | 1 | --- |
| 2 | - hosts: {{ instance_name }} |
| 3 | gather_facts: False |
| 4 | connection: ssh |
| 5 | user: {{ username }} |
Sapan Bhatia | 22c5dca | 2017-02-07 11:32:56 -0800 | [diff] [blame^] | 6 | become: yes |
rdudyala | 996d70b | 2016-10-13 17:40:55 +0000 | [diff] [blame] | 7 | vars: |
| 8 | rabbit_user: {{ rabbit_user }} |
| 9 | rabbit_password: {{ rabbit_password }} |
| 10 | rabbit_host: {{ rabbit_host }} |
| 11 | listen_ip_addr: {{ listen_ip_addr }} |
| 12 | |
| 13 | tasks: |
| 14 | |
| 15 | - name: Verify if udpagent ([] is to avoid capturing the shell process) is already running |
| 16 | shell: pgrep -f [u]dpagent | wc -l |
| 17 | register: udpagent_job_pids_count |
| 18 | |
| 19 | - name: DEBUG |
| 20 | debug: var=udpagent_job_pids_count.stdout |
| 21 | |
| 22 | - name: stop /usr/local/share/udp_proxy if already running |
| 23 | shell: pkill -f /usr/local/share/udp_proxy/udpagent.py |
| 24 | ignore_errors: True |
| 25 | when: udpagent_job_pids_count.stdout != "0" |
| 26 | |
| 27 | - name: make sure /usr/local/share/udp_proxy exists |
| 28 | file: path=/usr/local/share/udp_proxy state=directory owner=root group=root |
| 29 | |
| 30 | - name: Copy udp_proxy component files to destination |
| 31 | copy: src=/opt/xos/synchronizers/monitoring/ceilometer/udp_proxy/udpagent.py |
| 32 | dest=/usr/local/share/udp_proxy/udpagent.py |
| 33 | |
| 34 | - name: udp_proxy config |
| 35 | template: src=/opt/xos/synchronizers/monitoring/templates/udpagent.conf.j2 dest=/usr/local/share/udp_proxy/udpagent.conf mode=0777 |
| 36 | |
| 37 | - name: install python-kombu |
| 38 | apt: name=python-kombu state=present |
| 39 | |
| 40 | - name: Launch udp_proxy |
| 41 | command: python /usr/local/share/udp_proxy/udpagent.py |
| 42 | args: |
| 43 | chdir: /usr/local/share/udp_proxy/ |
| 44 | async: 9999999999999999 |
| 45 | poll: 0 |