Matteo Scandolo | eb0d11c | 2017-08-08 13:05:26 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
rdudyala | 996d70b | 2016-10-13 17:40:55 +0000 | [diff] [blame] | 17 | --- |
| 18 | - hosts: {{ instance_name }} |
| 19 | gather_facts: False |
| 20 | connection: ssh |
| 21 | user: {{ username }} |
Sapan Bhatia | 22c5dca | 2017-02-07 11:32:56 -0800 | [diff] [blame] | 22 | become: yes |
rdudyala | 996d70b | 2016-10-13 17:40:55 +0000 | [diff] [blame] | 23 | vars: |
| 24 | rabbit_user: {{ rabbit_user }} |
| 25 | rabbit_password: {{ rabbit_password }} |
| 26 | rabbit_host: {{ rabbit_host }} |
| 27 | listen_ip_addr: {{ listen_ip_addr }} |
| 28 | |
| 29 | tasks: |
| 30 | |
| 31 | - name: Verify if udpagent ([] is to avoid capturing the shell process) is already running |
| 32 | shell: pgrep -f [u]dpagent | wc -l |
| 33 | register: udpagent_job_pids_count |
| 34 | |
| 35 | - name: DEBUG |
| 36 | debug: var=udpagent_job_pids_count.stdout |
| 37 | |
| 38 | - name: stop /usr/local/share/udp_proxy if already running |
| 39 | shell: pkill -f /usr/local/share/udp_proxy/udpagent.py |
| 40 | ignore_errors: True |
| 41 | when: udpagent_job_pids_count.stdout != "0" |
| 42 | |
| 43 | - name: make sure /usr/local/share/udp_proxy exists |
| 44 | file: path=/usr/local/share/udp_proxy state=directory owner=root group=root |
| 45 | |
| 46 | - name: Copy udp_proxy component files to destination |
| 47 | copy: src=/opt/xos/synchronizers/monitoring/ceilometer/udp_proxy/udpagent.py |
| 48 | dest=/usr/local/share/udp_proxy/udpagent.py |
| 49 | |
| 50 | - name: udp_proxy config |
| 51 | template: src=/opt/xos/synchronizers/monitoring/templates/udpagent.conf.j2 dest=/usr/local/share/udp_proxy/udpagent.conf mode=0777 |
| 52 | |
| 53 | - name: install python-kombu |
| 54 | apt: name=python-kombu state=present |
| 55 | |
| 56 | - name: Launch udp_proxy |
| 57 | command: python /usr/local/share/udp_proxy/udpagent.py |
| 58 | args: |
| 59 | chdir: /usr/local/share/udp_proxy/ |
| 60 | async: 9999999999999999 |
| 61 | poll: 0 |