| |
| # Copyright 2017-present Open Networking Foundation |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| |
| --- |
| # ceilometer_service_playbook |
| - hosts: "{{ instance_name }}" |
| gather_facts: False |
| connection: ssh |
| user: ubuntu |
| vars: |
| host_name: {{ instance_hostname }} |
| host_private_ip: {{ private_ip }} |
| host_nat_ip: {{ nat_ip }} |
| ceilometer_enable_pub_sub: {{ ceilometer_enable_pub_sub }} |
| tasks: |
| |
| - name: Fix /etc/hosts |
| become: yes |
| lineinfile: |
| dest=/etc/hosts |
| regexp="127.0.0.1 localhost" |
| line="127.0.0.1 localhost {{ instance_hostname }}" |
| |
| - name : Adding Rabbitmq user |
| become: yes |
| shell : rabbitmqctl add_vhost /;rabbitmqctl add_user openstack "password";rabbitmqctl set_permissions openstack ".*" ".*" ".*" |
| |
| - name: Coping keystone endpoint script |
| become: yes |
| 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 |
| |
| - name: Changing keystone public endpoint in mysql |
| become: yes |
| shell: update-keystone-endpoints.py --username root --password password --host localhost --endpoint {{ private_ip }} --endpoint-type public |
| |
| - name: Changing keystone admin endpoint in mysql |
| become: yes |
| shell: update-keystone-endpoints.py --username root --password password --host localhost --endpoint {{ private_ip }} --endpoint-type admin |
| |
| - name: Update host specific configs in /etc/kafka/server.properties |
| become: yes |
| lineinfile: |
| dest=/etc/kafka/server.properties |
| regexp="{{ '{{' }} item.regexp {{ '}}' }}" |
| line="{{ '{{' }} item.line {{ '}}' }}" |
| with_items: |
| - { regexp: '^[#]{0,}host\.name=', line: 'host.name=0.0.0.0' } |
| - { regexp: '^[#]{0,}advertised\.host\.name=', line: 'advertised.host.name={{ instance_hostname }}' } |
| - { regexp: '^[#]{0,}zookeeper\.connect=', line: 'zookeeper.connect={{ instance_hostname }}:2181' } |
| notify: |
| - restart zookeeper service |
| - restart kafka service |
| - stop ceilometer pub-sub |
| - start ceilometer pub-sub |
| |
| - name: Enabling/Disabling kafka publishing |
| become: yes |
| template: src=/opt/xos/synchronizers/monitoring/templates/ceilometer_pipeline.yaml.j2 dest=/etc/ceilometer/pipeline.yaml owner=root group=root mode=0777 |
| notify: |
| - restart ceilometer-agent-notification service |
| |
| # No need of this step as this patch is directly applied inside monitoring service custom image |
| # - name: Apply ceilometer kafka publisher patch until monitoring service is migrated to Newton release or later |
| # become: yes |
| # 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 |
| # notify: |
| # - restart ceilometer-agent-notification service |
| |
| handlers: |
| - name: restart zookeeper service |
| become: yes |
| service: name=zookeeper state=restarted |
| - name: restart kafka service |
| become: yes |
| service: name=kafka state=restarted |
| - name: stop ceilometer pub-sub |
| become: yes |
| shell: pkill -f sub_main.py |
| ignore_errors: True |
| - name: start ceilometer pub-sub |
| become: yes |
| shell: cd /etc/init.d;sudo bash zxceilostartup.sh |
| - name: restart ceilometer-agent-notification service |
| become: yes |
| service: name=ceilometer-agent-notification state=restarted |