blob: 51cbc1ada39d0754b07604c0ea909c560dc1564c [file] [log] [blame]
Matteo Scandoloeb0d11c2017-08-08 13:05:26 -07001
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 dudyalaa927d562016-09-28 14:04:13 +053017---
18# ceilometer_service_playbook
19- hosts: "{{ instance_name }}"
20 gather_facts: False
21 connection: ssh
22 user: ubuntu
raghunath dudyalaa927d562016-09-28 14:04:13 +053023 vars:
24 host_name: {{ instance_hostname }}
25 host_private_ip: {{ private_ip }}
26 host_nat_ip: {{ nat_ip }}
Srikanth Vavilapalli71aa28d2017-01-31 00:43:13 +000027 ceilometer_enable_pub_sub: {{ ceilometer_enable_pub_sub }}
raghunath dudyalaa927d562016-09-28 14:04:13 +053028 tasks:
29
30 - name: Fix /etc/hosts
Srikanth Vavilapalli71aa28d2017-01-31 00:43:13 +000031 become: yes
raghunath dudyalaa927d562016-09-28 14:04:13 +053032 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 Vavilapalli71aa28d2017-01-31 00:43:13 +000038 become: yes
Srikanth Vavilapalli4e5abb52017-01-27 04:45:06 +000039 shell : rabbitmqctl add_vhost /;rabbitmqctl add_user openstack "password";rabbitmqctl set_permissions openstack ".*" ".*" ".*"
raghunath dudyalaa927d562016-09-28 14:04:13 +053040
41 - name: Coping keystone endpoint script
Srikanth Vavilapalli71aa28d2017-01-31 00:43:13 +000042 become: yes
raghunath dudyalaa927d562016-09-28 14:04:13 +053043 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 Vavilapalli71aa28d2017-01-31 00:43:13 +000046 become: yes
raghunath dudyalaa927d562016-09-28 14:04:13 +053047 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 Vavilapalli71aa28d2017-01-31 00:43:13 +000050 become: yes
raghunath dudyalaa927d562016-09-28 14:04:13 +053051 shell: update-keystone-endpoints.py --username root --password password --host localhost --endpoint {{ private_ip }} --endpoint-type admin
Srikanth Vavilapalli71aa28d2017-01-31 00:43:13 +000052
Srikanth Vavilapallie88d7582017-02-01 00:42:23 +000053 - 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 Vavilapallib2a50192017-02-03 18:25:59 +000064 - restart zookeeper service
Srikanth Vavilapallie88d7582017-02-01 00:42:23 +000065 - restart kafka service
Srikanth Vavilapallib2a50192017-02-03 18:25:59 +000066 - stop ceilometer pub-sub
67 - start ceilometer pub-sub
Srikanth Vavilapallie88d7582017-02-01 00:42:23 +000068
Srikanth Vavilapalli71aa28d2017-01-31 00:43:13 +000069 - 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 Vavilapalli0d483e52017-01-31 05:21:08 +000075# 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 Vavilapalli71aa28d2017-01-31 00:43:13 +000081
82 handlers:
Srikanth Vavilapallib2a50192017-02-03 18:25:59 +000083 - name: restart zookeeper service
84 become: yes
85 service: name=zookeeper state=restarted
Srikanth Vavilapallie88d7582017-02-01 00:42:23 +000086 - name: restart kafka service
87 become: yes
88 service: name=kafka state=restarted
Srikanth Vavilapallib2a50192017-02-03 18:25:59 +000089 - 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 Vavilapalli71aa28d2017-01-31 00:43:13 +000096 - name: restart ceilometer-agent-notification service
97 become: yes
98 service: name=ceilometer-agent-notification state=restarted