blob: ca72c5f66e73cb829273bcb8e40c72d5bc87e906 [file] [log] [blame]
Scott Baker31acc652016-06-23 15:47:56 -07001---
2- hosts: {{ instance_name }}
3 gather_facts: False
4 connection: ssh
5 user: ubuntu
6 sudo: yes
7 vars:
8 unique_id: {{ unique_id }}
9 auth_url: {{ auth_url }}
10 admin_user: {{ admin_user }}
11 admin_password: {{ admin_password }}
12 admin_tenant: {{ admin_tenant }}
13 shared_lan_ip: {{ private_ip }}
14 shared_lan_mac: {{ private_mac }}
15 headnode_flat_lan_ip: {{ rabbit_host }}
16 ceilometer_client_acess_ip: {{ ceilometer_ip }}
17 ceilometer_client_acess_mac: {{ ceilometer_mac }}
18 ceilometer_host_port: {{ ceilometer_port }}
19 ceilometer_pub_sub_url: {{ ceilometer_pub_sub_url }}
20 allowed_tenant_ids:
21 {% for allowed_tenant_id in allowed_tenant_ids %}
22 - {{ allowed_tenant_id }}
23 {% endfor %}
24
25 tasks:
26{% if delete %}
27 - name: Remove tenant
28# FIXME: Adding dummy template action to avoid "action attribute missing in task" error
29 template: src=/opt/xos/synchronizers/monitoring_channel/templates/ceilometer_proxy_config.j2 dest=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config mode=0777
30 notify:
31 - stop monitoring-channel
32 - remove container
33{% else %}
34{% if full_setup %}
35# - name: Docker repository
36# copy: src=/opt/xos/synchronizers/monitoring_channel/files/docker.list
37# dest=/etc/apt/sources.list.d/docker.list
38#
39# - name: Import the repository key
40# apt_key: keyserver=keyserver.ubuntu.com id=36A1D7869245C8950F966E92D8576A8BA88D21E9
41#
42# - name: install Docker
43# apt: name=lxc-docker state=present update_cache=yes
44#
45# - name: install python-setuptools
46# apt: name=python-setuptools state=present
47#
48# - name: install pip
49# easy_install: name=pip
50#
51# - name: install docker-py
52# pip: name=docker-py version=0.5.3
53#
54# - name: install Pipework
55# get_url: url=https://raw.githubusercontent.com/jpetazzo/pipework/master/pipework
56# dest=/usr/local/bin/pipework
57# mode=0755
58#
59# - name: Disable resolvconf service
60# shell: service resolvconf stop
61# shell: echo manual > /etc/init/resolvconf.override
62# shell: rm -f /etc/resolv.conf
63#
64# - name: Install resolv.conf
65# copy: src=/opt/xos/synchronizers/monitoring_channel/files/vm-resolv.conf
66# dest=/etc/resolv.conf
67{% endif %}
68
69# FIXME: Temporary workaround to delete the monitoring-channel_ceilometer_proxy_config file always
70# to trigger ansible notify handlers in the following task.
71# Due to some issue, ansible "changed" flag is set to false even though there is a change of
72# ceilometer configuration file, because of which the configuration change is not reflecting in
73# ceilometer containers
74# - file: path=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config state=absent
75
76 - name: ceilometer proxy config
77 template: src=/opt/xos/synchronizers/monitoring_channel/templates/ceilometer_proxy_config.j2 dest=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config mode=0777
78 notify:
79 - copy ceilo-config-file
80 - restart monitoring-channel container
81# - stop monitoring-channel
82# - remove container
83# - start monitoring-channel
84
85 - name: Monitoring channel upstart
86 template: src=/opt/xos/synchronizers/monitoring_channel/templates/monitoring-channel.conf.j2 dest=/etc/init/monitoring-channel-{{ unique_id }}.conf
87
88 - name: Monitoring channel startup script
89 template: src=/opt/xos/synchronizers/monitoring_channel/templates/start-monitoring-channel.sh.j2 dest=/usr/local/sbin/start-monitoring-channel-{{ unique_id }}.sh mode=0755
90 notify:
91# - restart monitoring-channel
92 - stop monitoring-channel
93 - remove container
94 - start monitoring-channel
95
96# - name: Start monitoring-channel container
97# docker:
98# docker_api_version: "1.18"
99# name: monitoring-channel-{{ unique_id }}
100# # was: reloaded
101# state: running
102# image: srikanthvavila/monitoring-channel
103# expose:
104# - 8000
105# ports:
106# - "{{ ceilometer_port }}:8000"
107# volumes:
108# - /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config:/usr/local/share/ceilometer_proxy_config
109#
110# - name: Get Docker IP
111# #TODO: copy dockerip.sh to monitoring service synchronizer
112# script: /opt/xos/synchronizers/onos/scripts/dockerip.sh monitoring-channel-{{ unique_id }}
113# register: dockerip
114#
115# - name: Wait for Monitoring channel to come up
116# wait_for:
117# host={{ '{{' }} dockerip.stdout {{ '}}' }}
118# port={{ '{{' }} item {{ '}}' }}
119# state=present
120# with_items:
121# - {{ ceilometer_port }}
122# These are samples, not necessary for correct function of demo
123
124 - name: Make sure Monitoring channel service is running
125 service: name=monitoring-channel-{{ unique_id }} state=started
126{% endif %}
127
128 handlers:
129 - name: copy ceilo-config-file
130 shell: docker cp /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config monitoring-channel-{{ unique_id }}:/usr/local/share/ceilometer_proxy_config
131
132 - name: restart monitoring-channel container
133 shell: docker restart monitoring-channel-{{ unique_id }}
134
135 - name: restart monitoring-channel
136 shell: service monitoring-channel-{{ unique_id }} stop; sleep 1; service monitoring-channel-{{ unique_id }} start
137
138 - name: stop monitoring-channel
139 service: name=monitoring-channel-{{ unique_id }} state=stopped
140
141 - name: remove container
142 docker: name=monitoring-channel-{{ unique_id }} state=absent image=monitoring-channel
143
144 - name: start monitoring-channel
145 service: name=monitoring-channel-{{ unique_id }} state=started