blob: 6fb680c213e205c227599baf8929ed6ed5f4fcc2 [file] [log] [blame]
raghunath dudyalaa927d562016-09-28 14:04:13 +05301---
2# ceilometer_service_playbook
3- hosts: "{{ instance_name }}"
4 gather_facts: False
5 connection: ssh
6 user: ubuntu
raghunath dudyalaa927d562016-09-28 14:04:13 +05307 vars:
8 host_name: {{ instance_hostname }}
9 host_private_ip: {{ private_ip }}
10 host_nat_ip: {{ nat_ip }}
Srikanth Vavilapalli71aa28d2017-01-31 00:43:13 +000011 ceilometer_enable_pub_sub: {{ ceilometer_enable_pub_sub }}
raghunath dudyalaa927d562016-09-28 14:04:13 +053012 tasks:
13
14 - name: Fix /etc/hosts
Srikanth Vavilapalli71aa28d2017-01-31 00:43:13 +000015 become: yes
raghunath dudyalaa927d562016-09-28 14:04:13 +053016 lineinfile:
17 dest=/etc/hosts
18 regexp="127.0.0.1 localhost"
19 line="127.0.0.1 localhost {{ instance_hostname }}"
20
21 - name : Adding Rabbitmq user
Srikanth Vavilapalli71aa28d2017-01-31 00:43:13 +000022 become: yes
Srikanth Vavilapalli4e5abb52017-01-27 04:45:06 +000023 shell : rabbitmqctl add_vhost /;rabbitmqctl add_user openstack "password";rabbitmqctl set_permissions openstack ".*" ".*" ".*"
raghunath dudyalaa927d562016-09-28 14:04:13 +053024
25 - name: Coping keystone endpoint script
Srikanth Vavilapalli71aa28d2017-01-31 00:43:13 +000026 become: yes
raghunath dudyalaa927d562016-09-28 14:04:13 +053027 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
28
29 - name: Changing keystone public endpoint in mysql
Srikanth Vavilapalli71aa28d2017-01-31 00:43:13 +000030 become: yes
raghunath dudyalaa927d562016-09-28 14:04:13 +053031 shell: update-keystone-endpoints.py --username root --password password --host localhost --endpoint {{ private_ip }} --endpoint-type public
32
33 - name: Changing keystone admin endpoint in mysql
Srikanth Vavilapalli71aa28d2017-01-31 00:43:13 +000034 become: yes
raghunath dudyalaa927d562016-09-28 14:04:13 +053035 shell: update-keystone-endpoints.py --username root --password password --host localhost --endpoint {{ private_ip }} --endpoint-type admin
Srikanth Vavilapalli71aa28d2017-01-31 00:43:13 +000036
Srikanth Vavilapallie88d7582017-02-01 00:42:23 +000037 - name: Update host specific configs in /etc/kafka/server.properties
38 become: yes
39 lineinfile:
40 dest=/etc/kafka/server.properties
41 regexp="{{ '{{' }} item.regexp {{ '}}' }}"
42 line="{{ '{{' }} item.line {{ '}}' }}"
43 with_items:
44 - { regexp: '^[#]{0,}host\.name=', line: 'host.name=0.0.0.0' }
45 - { regexp: '^[#]{0,}advertised\.host\.name=', line: 'advertised.host.name={{ instance_hostname }}' }
46 - { regexp: '^[#]{0,}zookeeper\.connect=', line: 'zookeeper.connect={{ instance_hostname }}:2181' }
47 notify:
Srikanth Vavilapallib2a50192017-02-03 18:25:59 +000048 - restart zookeeper service
Srikanth Vavilapallie88d7582017-02-01 00:42:23 +000049 - restart kafka service
Srikanth Vavilapallib2a50192017-02-03 18:25:59 +000050 - stop ceilometer pub-sub
51 - start ceilometer pub-sub
Srikanth Vavilapallie88d7582017-02-01 00:42:23 +000052
Srikanth Vavilapalli71aa28d2017-01-31 00:43:13 +000053 - name: Enabling/Disabling kafka publishing
54 become: yes
55 template: src=/opt/xos/synchronizers/monitoring/templates/ceilometer_pipeline.yaml.j2 dest=/etc/ceilometer/pipeline.yaml owner=root group=root mode=0777
56 notify:
57 - restart ceilometer-agent-notification service
58
Srikanth Vavilapalli0d483e52017-01-31 05:21:08 +000059# No need of this step as this patch is directly applied inside monitoring service custom image
60# - name: Apply ceilometer kafka publisher patch until monitoring service is migrated to Newton release or later
61# become: yes
62# 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
63# notify:
64# - restart ceilometer-agent-notification service
Srikanth Vavilapalli71aa28d2017-01-31 00:43:13 +000065
66 handlers:
Srikanth Vavilapallib2a50192017-02-03 18:25:59 +000067 - name: restart zookeeper service
68 become: yes
69 service: name=zookeeper state=restarted
Srikanth Vavilapallie88d7582017-02-01 00:42:23 +000070 - name: restart kafka service
71 become: yes
72 service: name=kafka state=restarted
Srikanth Vavilapallib2a50192017-02-03 18:25:59 +000073 - name: stop ceilometer pub-sub
74 become: yes
75 shell: pkill -f sub_main.py
76 ignore_errors: True
77 - name: start ceilometer pub-sub
78 become: yes
79 shell: cd /etc/init.d;sudo bash zxceilostartup.sh
Srikanth Vavilapalli71aa28d2017-01-31 00:43:13 +000080 - name: restart ceilometer-agent-notification service
81 become: yes
82 service: name=ceilometer-agent-notification state=restarted