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 | |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 17 | --- |
| 18 | - hosts: {{ instance_name }} |
Srikanth Vavilapalli | 666a236 | 2016-11-29 21:23:05 -0600 | [diff] [blame] | 19 | # gather_facts: False |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 20 | connection: ssh |
| 21 | user: ubuntu |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 22 | vars: |
| 23 | unique_id: {{ unique_id }} |
| 24 | auth_url: {{ auth_url }} |
| 25 | admin_user: {{ admin_user }} |
| 26 | admin_password: {{ admin_password }} |
| 27 | admin_tenant: {{ admin_tenant }} |
| 28 | shared_lan_ip: {{ private_ip }} |
| 29 | shared_lan_mac: {{ private_mac }} |
| 30 | headnode_flat_lan_ip: {{ rabbit_host }} |
| 31 | ceilometer_client_acess_ip: {{ ceilometer_ip }} |
| 32 | ceilometer_client_acess_mac: {{ ceilometer_mac }} |
| 33 | ceilometer_host_port: {{ ceilometer_port }} |
| 34 | ceilometer_pub_sub_url: {{ ceilometer_pub_sub_url }} |
| 35 | allowed_tenant_ids: |
| 36 | {% for allowed_tenant_id in allowed_tenant_ids %} |
| 37 | - {{ allowed_tenant_id }} |
| 38 | {% endfor %} |
| 39 | |
| 40 | tasks: |
| 41 | {% if delete %} |
| 42 | - name: Remove tenant |
| 43 | # FIXME: Adding dummy template action to avoid "action attribute missing in task" error |
Srikanth Vavilapalli | d84b7b7 | 2016-06-28 00:19:07 +0000 | [diff] [blame] | 44 | template: src=/opt/xos/synchronizers/monitoring/templates/ceilometer_proxy_config.j2 dest=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config mode=0777 |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 45 | notify: |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 46 | - remove container |
| 47 | {% else %} |
| 48 | {% if full_setup %} |
Srikanth Vavilapalli | 666a236 | 2016-11-29 21:23:05 -0600 | [diff] [blame] | 49 | - name: Add hostname to /etc/hosts |
| 50 | lineinfile: dest=/etc/hosts |
| 51 | regexp='^127\.0\.0\.1' |
| 52 | line="127.0.0.1 localhost {{ '{{' }} ansible_hostname {{ '}}' }}" |
| 53 | owner=root group=root mode=0644 |
Srikanth Vavilapalli | 562986c | 2016-12-12 05:43:10 +0000 | [diff] [blame] | 54 | become: yes |
Srikanth Vavilapalli | 666a236 | 2016-11-29 21:23:05 -0600 | [diff] [blame] | 55 | |
| 56 | - name: Add user to docker group |
| 57 | user: name=ubuntu group=docker append=yes |
Srikanth Vavilapalli | 562986c | 2016-12-12 05:43:10 +0000 | [diff] [blame] | 58 | become: yes |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 59 | {% endif %} |
| 60 | |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 61 | - name: ceilometer proxy config |
Srikanth Vavilapalli | d84b7b7 | 2016-06-28 00:19:07 +0000 | [diff] [blame] | 62 | template: src=/opt/xos/synchronizers/monitoring/templates/ceilometer_proxy_config.j2 dest=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config mode=0777 |
Srikanth Vavilapalli | 562986c | 2016-12-12 05:43:10 +0000 | [diff] [blame] | 63 | become: yes |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 64 | notify: |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 65 | - restart monitoring-channel container |
Srikanth Vavilapalli | 666a236 | 2016-11-29 21:23:05 -0600 | [diff] [blame] | 66 | - set monitoring-channel-mtu |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 67 | |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 68 | {% endif %} |
| 69 | |
| 70 | handlers: |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 71 | - name: restart monitoring-channel container |
Srikanth Vavilapalli | 562986c | 2016-12-12 05:43:10 +0000 | [diff] [blame] | 72 | docker: |
| 73 | docker_api_version: "1.18" |
| 74 | name: monitoring-channel-{{ unique_id }} |
| 75 | state: restarted |
| 76 | image: srikanthvavila/monitoring-channel |
| 77 | expose: |
| 78 | - 8000 |
| 79 | ports: |
| 80 | - "{{ ceilometer_port }}:8000" |
| 81 | volumes: |
| 82 | - /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config:/usr/local/share/ceilometer_proxy_config |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 83 | |
| 84 | - name: remove container |
Srikanth Vavilapalli | 562986c | 2016-12-12 05:43:10 +0000 | [diff] [blame] | 85 | docker: name=monitoring-channel-{{ unique_id }} state=absent image=srikanthvavila/monitoring-channel |
Srikanth Vavilapalli | 666a236 | 2016-11-29 21:23:05 -0600 | [diff] [blame] | 86 | |
| 87 | - name: set monitoring-channel-mtu |
Srikanth Vavilapalli | 562986c | 2016-12-12 05:43:10 +0000 | [diff] [blame] | 88 | shell: docker exec --privileged monitoring-channel-{{ unique_id }} sudo ifconfig eth0 mtu 1450 up |