blob: d6571eaecc374e8666bda95cacd20144a37fb132 [file] [log] [blame]
Scott Baker31acc652016-06-23 15:47:56 -07001---
2- hosts: {{ instance_name }}
Srikanth Vavilapalli666a2362016-11-29 21:23:05 -06003# gather_facts: False
Scott Baker31acc652016-06-23 15:47:56 -07004 connection: ssh
5 user: ubuntu
Scott Baker31acc652016-06-23 15:47:56 -07006 vars:
7 unique_id: {{ unique_id }}
8 auth_url: {{ auth_url }}
9 admin_user: {{ admin_user }}
10 admin_password: {{ admin_password }}
11 admin_tenant: {{ admin_tenant }}
12 shared_lan_ip: {{ private_ip }}
13 shared_lan_mac: {{ private_mac }}
14 headnode_flat_lan_ip: {{ rabbit_host }}
15 ceilometer_client_acess_ip: {{ ceilometer_ip }}
16 ceilometer_client_acess_mac: {{ ceilometer_mac }}
17 ceilometer_host_port: {{ ceilometer_port }}
18 ceilometer_pub_sub_url: {{ ceilometer_pub_sub_url }}
19 allowed_tenant_ids:
20 {% for allowed_tenant_id in allowed_tenant_ids %}
21 - {{ allowed_tenant_id }}
22 {% endfor %}
23
24 tasks:
25{% if delete %}
26 - name: Remove tenant
27# FIXME: Adding dummy template action to avoid "action attribute missing in task" error
Srikanth Vavilapallid84b7b72016-06-28 00:19:07 +000028 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 -070029 notify:
Scott Baker31acc652016-06-23 15:47:56 -070030 - remove container
31{% else %}
32{% if full_setup %}
Srikanth Vavilapalli666a2362016-11-29 21:23:05 -060033 - name: Add hostname to /etc/hosts
34 lineinfile: dest=/etc/hosts
35 regexp='^127\.0\.0\.1'
36 line="127.0.0.1 localhost {{ '{{' }} ansible_hostname {{ '}}' }}"
37 owner=root group=root mode=0644
Srikanth Vavilapalli562986c2016-12-12 05:43:10 +000038 become: yes
Srikanth Vavilapalli666a2362016-11-29 21:23:05 -060039
40 - name: Add user to docker group
41 user: name=ubuntu group=docker append=yes
Srikanth Vavilapalli562986c2016-12-12 05:43:10 +000042 become: yes
Scott Baker31acc652016-06-23 15:47:56 -070043{% endif %}
44
Scott Baker31acc652016-06-23 15:47:56 -070045 - name: ceilometer proxy config
Srikanth Vavilapallid84b7b72016-06-28 00:19:07 +000046 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 +000047 become: yes
Scott Baker31acc652016-06-23 15:47:56 -070048 notify:
Scott Baker31acc652016-06-23 15:47:56 -070049 - restart monitoring-channel container
Srikanth Vavilapalli666a2362016-11-29 21:23:05 -060050 - set monitoring-channel-mtu
Scott Baker31acc652016-06-23 15:47:56 -070051
Scott Baker31acc652016-06-23 15:47:56 -070052{% endif %}
53
54 handlers:
Scott Baker31acc652016-06-23 15:47:56 -070055 - name: restart monitoring-channel container
Srikanth Vavilapalli562986c2016-12-12 05:43:10 +000056 docker:
57 docker_api_version: "1.18"
58 name: monitoring-channel-{{ unique_id }}
59 state: restarted
60 image: srikanthvavila/monitoring-channel
61 expose:
62 - 8000
63 ports:
64 - "{{ ceilometer_port }}:8000"
65 volumes:
66 - /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config:/usr/local/share/ceilometer_proxy_config
Scott Baker31acc652016-06-23 15:47:56 -070067
68 - name: remove container
Srikanth Vavilapalli562986c2016-12-12 05:43:10 +000069 docker: name=monitoring-channel-{{ unique_id }} state=absent image=srikanthvavila/monitoring-channel
Srikanth Vavilapalli666a2362016-11-29 21:23:05 -060070
71 - name: set monitoring-channel-mtu
Srikanth Vavilapalli562986c2016-12-12 05:43:10 +000072 shell: docker exec --privileged monitoring-channel-{{ unique_id }} sudo ifconfig eth0 mtu 1450 up