blob: c4e7b86c124cf35a15a824125896521d478b4e3b [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
Scott Baker31acc652016-06-23 15:47:56 -070017---
18- hosts: {{ instance_name }}
Srikanth Vavilapalli666a2362016-11-29 21:23:05 -060019# gather_facts: False
Scott Baker31acc652016-06-23 15:47:56 -070020 connection: ssh
21 user: ubuntu
Scott Baker31acc652016-06-23 15:47:56 -070022 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 Vavilapallid84b7b72016-06-28 00:19:07 +000044 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 Baker31acc652016-06-23 15:47:56 -070045 notify:
Scott Baker31acc652016-06-23 15:47:56 -070046 - remove container
47{% else %}
48{% if full_setup %}
Srikanth Vavilapalli666a2362016-11-29 21:23:05 -060049 - 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 Vavilapalli562986c2016-12-12 05:43:10 +000054 become: yes
Srikanth Vavilapalli666a2362016-11-29 21:23:05 -060055
56 - name: Add user to docker group
57 user: name=ubuntu group=docker append=yes
Srikanth Vavilapalli562986c2016-12-12 05:43:10 +000058 become: yes
Scott Baker31acc652016-06-23 15:47:56 -070059{% endif %}
60
Scott Baker31acc652016-06-23 15:47:56 -070061 - name: ceilometer proxy config
Srikanth Vavilapallid84b7b72016-06-28 00:19:07 +000062 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 Vavilapalli562986c2016-12-12 05:43:10 +000063 become: yes
Scott Baker31acc652016-06-23 15:47:56 -070064 notify:
Scott Baker31acc652016-06-23 15:47:56 -070065 - restart monitoring-channel container
Srikanth Vavilapalli666a2362016-11-29 21:23:05 -060066 - set monitoring-channel-mtu
Scott Baker31acc652016-06-23 15:47:56 -070067
Scott Baker31acc652016-06-23 15:47:56 -070068{% endif %}
69
70 handlers:
Scott Baker31acc652016-06-23 15:47:56 -070071 - name: restart monitoring-channel container
Srikanth Vavilapalli562986c2016-12-12 05:43:10 +000072 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 Baker31acc652016-06-23 15:47:56 -070083
84 - name: remove container
Srikanth Vavilapalli562986c2016-12-12 05:43:10 +000085 docker: name=monitoring-channel-{{ unique_id }} state=absent image=srikanthvavila/monitoring-channel
Srikanth Vavilapalli666a2362016-11-29 21:23:05 -060086
87 - name: set monitoring-channel-mtu
Srikanth Vavilapalli562986c2016-12-12 05:43:10 +000088 shell: docker exec --privileged monitoring-channel-{{ unique_id }} sudo ifconfig eth0 mtu 1450 up