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: ubuntu |
| 6 | sudo: yes |
| 7 | |
| 8 | tasks: |
| 9 | |
| 10 | - name: Installing python-dev |
| 11 | apt: name=python-dev state=present update_cache=yes |
| 12 | |
| 13 | - name: Installing Flask |
| 14 | pip: name=Flask |
| 15 | |
| 16 | - name: Verify if ([monitoring_agent] is to avoid capturing the shell process) is already running |
| 17 | shell: pgrep -f [m]onitoring_agent | wc -l |
| 18 | register: monitoringagent_job_pids_count |
| 19 | |
| 20 | - name: DEBUG |
| 21 | debug: var=monitoringagent_job_pids_count.stdout |
| 22 | |
| 23 | - name: stop /usr/local/share/monitoring_agent if already running |
| 24 | shell: pkill -f /usr/local/share/monitoring_agent/monitoring_agent.py |
| 25 | ignore_errors: True |
| 26 | when: monitoringagent_job_pids_count.stdout != "0" |
| 27 | |
| 28 | - name: Deleting monitoring agent folder(if already exists) |
| 29 | file: path=/usr/local/share/monitoring_agent state=absent owner=root group=root |
| 30 | |
| 31 | - name: make sure /usr/local/share/monitoring_agent exists |
| 32 | file: path=/usr/local/share/monitoring_agent state=directory owner=root group=root |
| 33 | |
| 34 | - name: Copying monitoring agent conf file |
| 35 | when : "'ceilometer' in instance_name" |
| 36 | set_fact: ceilometer_services="ceilometer-agent-central,ceilometer-agent-notification,ceilometer-collector,ceilometer-api" |
| 37 | |
| 38 | - name: Copying monitoring agent conf file |
| 39 | when : "'ceilometer' not in instance_name" |
| 40 | set_fact: ceilometer_services="ceilometer-agent-compute" |
| 41 | |
| 42 | - name : DEBUG |
| 43 | debug: var=ceilometer_services |
| 44 | |
| 45 | - name: Copying monitoring agent conf file |
| 46 | template: src=monitoring_agent.conf.j2 dest=/usr/local/share/monitoring_agent/monitoring_agent.conf mode=0777 |
| 47 | |
| 48 | - name: Copying file to /usr/local/share |
| 49 | copy: src=monitoring_agent.py dest=/usr/local/share/monitoring_agent/monitoring_agent.py mode=0777 |
| 50 | |
| 51 | - name: Copying file to /usr/local/share |
| 52 | copy: src=generate_pipeline.py dest=/usr/local/share/monitoring_agent/generate_pipeline.py mode=0777 |
| 53 | |
| 54 | - name: Copying file to /usr/local/share |
| 55 | copy: src=pipeline.yaml.j2 dest=/usr/local/share/monitoring_agent/pipeline.yaml.j2 mode=0777 |
| 56 | |
| 57 | - name: Copying file to /usr/local/share |
| 58 | copy: src=start_monitoring_agent.sh dest=/usr/local/share/monitoring_agent/start_monitoring_agent.sh mode=0777 |
| 59 | |
| 60 | - name: Starting monitoring agent |
| 61 | command: nohup python /usr/local/share/monitoring_agent/monitoring_agent.py & |
| 62 | args: |
| 63 | chdir: /usr/local/share/monitoring_agent/ |
| 64 | async: 9999999999999999 |
| 65 | poll: 0 |
| 66 | |
| 67 | - name: Configuring monitoring agent |
| 68 | shell: /usr/local/share/monitoring_agent/start_monitoring_agent.sh |
| 69 | |
| 70 | #TODO: |
| 71 | #Copy ONOS notification handlers |
| 72 | #from ~/xos_services/monitoring/xos/synchronizer/ceilometer/ceilometer-plugins/network/statistics/onos |
| 73 | #to /usr/lib/python2.7/dist-packages/ceilometer/network/statistics/onos in the headnode ceilometer node |
| 74 | #Copy a file from ~/xos_services/monitoring/xos/synchronizer/ceilometer/ceilometer-plugins/network/statistics/__init__.py |
| 75 | #to /usr/lib/python2.7/dist-packages/ceilometer/network/statistics/ folder |
| 76 | #Also, update the entry_points.txt with the following changes: |
| 77 | #[network.statistics.drivers] |
| 78 | #.... |
| 79 | #onos = ceilometer.network.statistics.onos.driver:ONOSDriver |