| --- |
| - hosts: {{ instance_name }} |
| # gather_facts: False |
| connection: ssh |
| user: ubuntu |
| 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: |
| - remove container |
| {% else %} |
| {% if full_setup %} |
| - name: Add hostname to /etc/hosts |
| lineinfile: dest=/etc/hosts |
| regexp='^127\.0\.0\.1' |
| line="127.0.0.1 localhost {{ '{{' }} ansible_hostname {{ '}}' }}" |
| owner=root group=root mode=0644 |
| become: yes |
| |
| - name: Add user to docker group |
| user: name=ubuntu group=docker append=yes |
| become: yes |
| {% endif %} |
| |
| - 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 |
| become: yes |
| notify: |
| - restart monitoring-channel container |
| - set monitoring-channel-mtu |
| |
| {% endif %} |
| |
| handlers: |
| - name: restart monitoring-channel container |
| docker: |
| docker_api_version: "1.18" |
| name: monitoring-channel-{{ unique_id }} |
| state: restarted |
| 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: remove container |
| docker: name=monitoring-channel-{{ unique_id }} state=absent image=srikanthvavila/monitoring-channel |
| |
| - name: set monitoring-channel-mtu |
| shell: docker exec --privileged monitoring-channel-{{ unique_id }} sudo ifconfig eth0 mtu 1450 up |