| --- |
| - hosts: {{ instance_name }} |
| gather_facts: False |
| connection: ssh |
| user: ubuntu |
| sudo: yes |
| vars: |
| unique_id: {{ unique_id }} |
| auth_url: {{ auth_url }} |
| admin_user: {{ admin_user }} |
| admin_password: {{ admin_password }} |
| admin_tenant: {{ admin_tenant }} |
| shared_lan_ip: {{ private_ip }} |
| shared_lan_mac: {{ private_mac }} |
| headnode_flat_lan_ip: {{ rabbit_host }} |
| ceilometer_client_acess_ip: {{ ceilometer_ip }} |
| ceilometer_client_acess_mac: {{ ceilometer_mac }} |
| ceilometer_host_port: {{ ceilometer_port }} |
| ceilometer_pub_sub_url: {{ ceilometer_pub_sub_url }} |
| allowed_tenant_ids: |
| {% for allowed_tenant_id in allowed_tenant_ids %} |
| - {{ allowed_tenant_id }} |
| {% endfor %} |
| |
| tasks: |
| {% if delete %} |
| - name: Remove tenant |
| # FIXME: Adding dummy template action to avoid "action attribute missing in task" error |
| template: src=/opt/xos/synchronizers/monitoring/templates/ceilometer_proxy_config.j2 dest=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config mode=0777 |
| notify: |
| - stop monitoring-channel |
| - remove container |
| {% else %} |
| {% if full_setup %} |
| # - name: Docker repository |
| # copy: src=/opt/xos/synchronizers/monitoring/files/docker.list |
| # dest=/etc/apt/sources.list.d/docker.list |
| # |
| # - name: Import the repository key |
| # apt_key: keyserver=keyserver.ubuntu.com id=36A1D7869245C8950F966E92D8576A8BA88D21E9 |
| # |
| # - name: install Docker |
| # apt: name=lxc-docker state=present update_cache=yes |
| # |
| # - name: install python-setuptools |
| # apt: name=python-setuptools state=present |
| # |
| # - name: install pip |
| # easy_install: name=pip |
| # |
| # - name: install docker-py |
| # pip: name=docker-py version=0.5.3 |
| # |
| # - name: install Pipework |
| # get_url: url=https://raw.githubusercontent.com/jpetazzo/pipework/master/pipework |
| # dest=/usr/local/bin/pipework |
| # mode=0755 |
| # |
| # - name: Disable resolvconf service |
| # shell: service resolvconf stop |
| # shell: echo manual > /etc/init/resolvconf.override |
| # shell: rm -f /etc/resolv.conf |
| # |
| # - name: Install resolv.conf |
| # copy: src=/opt/xos/synchronizers/monitoring_channel/files/vm-resolv.conf |
| # dest=/etc/resolv.conf |
| {% endif %} |
| |
| # FIXME: Temporary workaround to delete the monitoring-channel_ceilometer_proxy_config file always |
| # to trigger ansible notify handlers in the following task. |
| # Due to some issue, ansible "changed" flag is set to false even though there is a change of |
| # ceilometer configuration file, because of which the configuration change is not reflecting in |
| # ceilometer containers |
| # - file: path=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config state=absent |
| |
| - name: ceilometer proxy config |
| template: src=/opt/xos/synchronizers/monitoring/templates/ceilometer_proxy_config.j2 dest=/usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config mode=0777 |
| notify: |
| - copy ceilo-config-file |
| - restart monitoring-channel container |
| # - stop monitoring-channel |
| # - remove container |
| # - start monitoring-channel |
| |
| - name: Monitoring channel upstart |
| template: src=/opt/xos/synchronizers/monitoring/templates/monitoring-channel.conf.j2 dest=/etc/init/monitoring-channel-{{ unique_id }}.conf |
| |
| - name: Monitoring channel startup script |
| template: src=/opt/xos/synchronizers/monitoring/templates/start-monitoring-channel.sh.j2 dest=/usr/local/sbin/start-monitoring-channel-{{ unique_id }}.sh mode=0755 |
| notify: |
| # - restart monitoring-channel |
| - stop monitoring-channel |
| - remove container |
| - start monitoring-channel |
| |
| # - name: Start monitoring-channel container |
| # docker: |
| # docker_api_version: "1.18" |
| # name: monitoring-channel-{{ unique_id }} |
| # # was: reloaded |
| # state: running |
| # image: srikanthvavila/monitoring-channel |
| # expose: |
| # - 8000 |
| # ports: |
| # - "{{ ceilometer_port }}:8000" |
| # volumes: |
| # - /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config:/usr/local/share/ceilometer_proxy_config |
| # |
| # - name: Get Docker IP |
| # #TODO: copy dockerip.sh to monitoring service synchronizer |
| # script: /opt/xos/synchronizers/onos/scripts/dockerip.sh monitoring-channel-{{ unique_id }} |
| # register: dockerip |
| # |
| # - name: Wait for Monitoring channel to come up |
| # wait_for: |
| # host={{ '{{' }} dockerip.stdout {{ '}}' }} |
| # port={{ '{{' }} item {{ '}}' }} |
| # state=present |
| # with_items: |
| # - {{ ceilometer_port }} |
| # These are samples, not necessary for correct function of demo |
| |
| - name: Make sure Monitoring channel service is running |
| service: name=monitoring-channel-{{ unique_id }} state=started |
| {% endif %} |
| |
| handlers: |
| - name: copy ceilo-config-file |
| shell: docker cp /usr/local/share/monitoring-channel-{{ unique_id }}_ceilometer_proxy_config monitoring-channel-{{ unique_id }}:/usr/local/share/ceilometer_proxy_config |
| |
| - name: restart monitoring-channel container |
| shell: docker restart monitoring-channel-{{ unique_id }} |
| |
| - name: restart monitoring-channel |
| shell: service monitoring-channel-{{ unique_id }} stop; sleep 1; service monitoring-channel-{{ unique_id }} start |
| |
| - name: stop monitoring-channel |
| service: name=monitoring-channel-{{ unique_id }} state=stopped |
| |
| - name: remove container |
| docker: name=monitoring-channel-{{ unique_id }} state=absent image=monitoring-channel |
| |
| - name: start monitoring-channel |
| service: name=monitoring-channel-{{ unique_id }} state=started |