| --- |
| - hosts: {{ instance_name }} |
| gather_facts: False |
| connection: ssh |
| user: {{ username }} |
| become: yes |
| vars: |
| rabbit_user: {{ rabbit_user }} |
| rabbit_password: {{ rabbit_password }} |
| rabbit_host: {{ rabbit_host }} |
| listen_ip_addr: {{ listen_ip_addr }} |
| |
| tasks: |
| |
| - name: Verify if udpagent ([] is to avoid capturing the shell process) is already running |
| shell: pgrep -f [u]dpagent | wc -l |
| register: udpagent_job_pids_count |
| |
| - name: DEBUG |
| debug: var=udpagent_job_pids_count.stdout |
| |
| - name: stop /usr/local/share/udp_proxy if already running |
| shell: pkill -f /usr/local/share/udp_proxy/udpagent.py |
| ignore_errors: True |
| when: udpagent_job_pids_count.stdout != "0" |
| |
| - name: make sure /usr/local/share/udp_proxy exists |
| file: path=/usr/local/share/udp_proxy state=directory owner=root group=root |
| |
| - name: Copy udp_proxy component files to destination |
| copy: src=/opt/xos/synchronizers/monitoring/ceilometer/udp_proxy/udpagent.py |
| dest=/usr/local/share/udp_proxy/udpagent.py |
| |
| - name: udp_proxy config |
| template: src=/opt/xos/synchronizers/monitoring/templates/udpagent.conf.j2 dest=/usr/local/share/udp_proxy/udpagent.conf mode=0777 |
| |
| - name: install python-kombu |
| apt: name=python-kombu state=present |
| |
| - name: Launch udp_proxy |
| command: python /usr/local/share/udp_proxy/udpagent.py |
| args: |
| chdir: /usr/local/share/udp_proxy/ |
| async: 9999999999999999 |
| poll: 0 |