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 | |
raghunath dudyala | a927d56 | 2016-09-28 14:04:13 +0530 | [diff] [blame] | 17 | --- |
| 18 | # ceilometer_service_playbook |
| 19 | - hosts: "{{ instance_name }}" |
| 20 | gather_facts: False |
| 21 | connection: ssh |
| 22 | user: ubuntu |
raghunath dudyala | a927d56 | 2016-09-28 14:04:13 +0530 | [diff] [blame] | 23 | vars: |
| 24 | host_name: {{ instance_hostname }} |
| 25 | host_private_ip: {{ private_ip }} |
| 26 | host_nat_ip: {{ nat_ip }} |
Srikanth Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 27 | ceilometer_enable_pub_sub: {{ ceilometer_enable_pub_sub }} |
raghunath dudyala | a927d56 | 2016-09-28 14:04:13 +0530 | [diff] [blame] | 28 | tasks: |
| 29 | |
| 30 | - name: Fix /etc/hosts |
Srikanth Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 31 | become: yes |
raghunath dudyala | a927d56 | 2016-09-28 14:04:13 +0530 | [diff] [blame] | 32 | lineinfile: |
| 33 | dest=/etc/hosts |
| 34 | regexp="127.0.0.1 localhost" |
| 35 | line="127.0.0.1 localhost {{ instance_hostname }}" |
| 36 | |
| 37 | - name : Adding Rabbitmq user |
Srikanth Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 38 | become: yes |
Srikanth Vavilapalli | 4e5abb5 | 2017-01-27 04:45:06 +0000 | [diff] [blame] | 39 | shell : rabbitmqctl add_vhost /;rabbitmqctl add_user openstack "password";rabbitmqctl set_permissions openstack ".*" ".*" ".*" |
raghunath dudyala | a927d56 | 2016-09-28 14:04:13 +0530 | [diff] [blame] | 40 | |
| 41 | - name: Coping keystone endpoint script |
Srikanth Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 42 | become: yes |
raghunath dudyala | a927d56 | 2016-09-28 14:04:13 +0530 | [diff] [blame] | 43 | template: src=/opt/xos/synchronizers/monitoring/templates/update-keystone-endpoints.py.j2 dest=/usr/local/bin/update-keystone-endpoints.py owner=root group=root mode=0777 |
| 44 | |
| 45 | - name: Changing keystone public endpoint in mysql |
Srikanth Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 46 | become: yes |
raghunath dudyala | a927d56 | 2016-09-28 14:04:13 +0530 | [diff] [blame] | 47 | shell: update-keystone-endpoints.py --username root --password password --host localhost --endpoint {{ private_ip }} --endpoint-type public |
| 48 | |
| 49 | - name: Changing keystone admin endpoint in mysql |
Srikanth Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 50 | become: yes |
raghunath dudyala | a927d56 | 2016-09-28 14:04:13 +0530 | [diff] [blame] | 51 | shell: update-keystone-endpoints.py --username root --password password --host localhost --endpoint {{ private_ip }} --endpoint-type admin |
Srikanth Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 52 | |
Srikanth Vavilapalli | e88d758 | 2017-02-01 00:42:23 +0000 | [diff] [blame] | 53 | - name: Update host specific configs in /etc/kafka/server.properties |
| 54 | become: yes |
| 55 | lineinfile: |
| 56 | dest=/etc/kafka/server.properties |
| 57 | regexp="{{ '{{' }} item.regexp {{ '}}' }}" |
| 58 | line="{{ '{{' }} item.line {{ '}}' }}" |
| 59 | with_items: |
| 60 | - { regexp: '^[#]{0,}host\.name=', line: 'host.name=0.0.0.0' } |
| 61 | - { regexp: '^[#]{0,}advertised\.host\.name=', line: 'advertised.host.name={{ instance_hostname }}' } |
| 62 | - { regexp: '^[#]{0,}zookeeper\.connect=', line: 'zookeeper.connect={{ instance_hostname }}:2181' } |
| 63 | notify: |
Srikanth Vavilapalli | b2a5019 | 2017-02-03 18:25:59 +0000 | [diff] [blame] | 64 | - restart zookeeper service |
Srikanth Vavilapalli | e88d758 | 2017-02-01 00:42:23 +0000 | [diff] [blame] | 65 | - restart kafka service |
Srikanth Vavilapalli | b2a5019 | 2017-02-03 18:25:59 +0000 | [diff] [blame] | 66 | - stop ceilometer pub-sub |
| 67 | - start ceilometer pub-sub |
Srikanth Vavilapalli | e88d758 | 2017-02-01 00:42:23 +0000 | [diff] [blame] | 68 | |
Srikanth Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 69 | - name: Enabling/Disabling kafka publishing |
| 70 | become: yes |
| 71 | template: src=/opt/xos/synchronizers/monitoring/templates/ceilometer_pipeline.yaml.j2 dest=/etc/ceilometer/pipeline.yaml owner=root group=root mode=0777 |
| 72 | notify: |
| 73 | - restart ceilometer-agent-notification service |
| 74 | |
Srikanth Vavilapalli | 0d483e5 | 2017-01-31 05:21:08 +0000 | [diff] [blame] | 75 | # No need of this step as this patch is directly applied inside monitoring service custom image |
| 76 | # - name: Apply ceilometer kafka publisher patch until monitoring service is migrated to Newton release or later |
| 77 | # become: yes |
| 78 | # template: src=/opt/xos/synchronizers/monitoring/templates/kafka_broker.py dest=/usr/lib/python2.7/dist-packages/ceilometer/publisher/kafka_broker.py owner=root group=root mode=0777 |
| 79 | # notify: |
| 80 | # - restart ceilometer-agent-notification service |
Srikanth Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 81 | |
| 82 | handlers: |
Srikanth Vavilapalli | b2a5019 | 2017-02-03 18:25:59 +0000 | [diff] [blame] | 83 | - name: restart zookeeper service |
| 84 | become: yes |
| 85 | service: name=zookeeper state=restarted |
Srikanth Vavilapalli | e88d758 | 2017-02-01 00:42:23 +0000 | [diff] [blame] | 86 | - name: restart kafka service |
| 87 | become: yes |
| 88 | service: name=kafka state=restarted |
Srikanth Vavilapalli | b2a5019 | 2017-02-03 18:25:59 +0000 | [diff] [blame] | 89 | - name: stop ceilometer pub-sub |
| 90 | become: yes |
| 91 | shell: pkill -f sub_main.py |
| 92 | ignore_errors: True |
| 93 | - name: start ceilometer pub-sub |
| 94 | become: yes |
| 95 | shell: cd /etc/init.d;sudo bash zxceilostartup.sh |
Srikanth Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 96 | - name: restart ceilometer-agent-notification service |
| 97 | become: yes |
| 98 | service: name=ceilometer-agent-notification state=restarted |