raghunath dudyala | a927d56 | 2016-09-28 14:04:13 +0530 | [diff] [blame] | 1 | --- |
| 2 | # ceilometer_service_playbook |
| 3 | - hosts: "{{ instance_name }}" |
| 4 | gather_facts: False |
| 5 | connection: ssh |
| 6 | user: ubuntu |
raghunath dudyala | a927d56 | 2016-09-28 14:04:13 +0530 | [diff] [blame] | 7 | vars: |
| 8 | host_name: {{ instance_hostname }} |
| 9 | host_private_ip: {{ private_ip }} |
| 10 | host_nat_ip: {{ nat_ip }} |
Srikanth Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 11 | ceilometer_enable_pub_sub: {{ ceilometer_enable_pub_sub }} |
raghunath dudyala | a927d56 | 2016-09-28 14:04:13 +0530 | [diff] [blame] | 12 | tasks: |
| 13 | |
| 14 | - name: Fix /etc/hosts |
Srikanth Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 15 | become: yes |
raghunath dudyala | a927d56 | 2016-09-28 14:04:13 +0530 | [diff] [blame] | 16 | 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 Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 22 | become: yes |
Srikanth Vavilapalli | 4e5abb5 | 2017-01-27 04:45:06 +0000 | [diff] [blame] | 23 | 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] | 24 | |
| 25 | - name: Coping keystone endpoint script |
Srikanth Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 26 | become: yes |
raghunath dudyala | a927d56 | 2016-09-28 14:04:13 +0530 | [diff] [blame] | 27 | 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 Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 30 | become: yes |
raghunath dudyala | a927d56 | 2016-09-28 14:04:13 +0530 | [diff] [blame] | 31 | 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 Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 34 | become: yes |
raghunath dudyala | a927d56 | 2016-09-28 14:04:13 +0530 | [diff] [blame] | 35 | 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] | 36 | |
Srikanth Vavilapalli | e88d758 | 2017-02-01 00:42:23 +0000 | [diff] [blame] | 37 | - 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 Vavilapalli | b2a5019 | 2017-02-03 18:25:59 +0000 | [diff] [blame] | 48 | - restart zookeeper service |
Srikanth Vavilapalli | e88d758 | 2017-02-01 00:42:23 +0000 | [diff] [blame] | 49 | - restart kafka service |
Srikanth Vavilapalli | b2a5019 | 2017-02-03 18:25:59 +0000 | [diff] [blame] | 50 | - stop ceilometer pub-sub |
| 51 | - start ceilometer pub-sub |
Srikanth Vavilapalli | e88d758 | 2017-02-01 00:42:23 +0000 | [diff] [blame] | 52 | |
Srikanth Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 53 | - 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 Vavilapalli | 0d483e5 | 2017-01-31 05:21:08 +0000 | [diff] [blame] | 59 | # 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 Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 65 | |
| 66 | handlers: |
Srikanth Vavilapalli | b2a5019 | 2017-02-03 18:25:59 +0000 | [diff] [blame] | 67 | - name: restart zookeeper service |
| 68 | become: yes |
| 69 | service: name=zookeeper state=restarted |
Srikanth Vavilapalli | e88d758 | 2017-02-01 00:42:23 +0000 | [diff] [blame] | 70 | - name: restart kafka service |
| 71 | become: yes |
| 72 | service: name=kafka state=restarted |
Srikanth Vavilapalli | b2a5019 | 2017-02-03 18:25:59 +0000 | [diff] [blame] | 73 | - 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 Vavilapalli | 71aa28d | 2017-01-31 00:43:13 +0000 | [diff] [blame] | 80 | - name: restart ceilometer-agent-notification service |
| 81 | become: yes |
| 82 | service: name=ceilometer-agent-notification state=restarted |