Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 1 | --- |
| 2 | - hosts: {{ instance_name }} |
Srikanth Vavilapalli | 666a236 | 2016-11-29 21:23:05 -0600 | [diff] [blame] | 3 | # gather_facts: False |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 4 | connection: ssh |
| 5 | user: ubuntu |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 6 | 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 Vavilapalli | d84b7b7 | 2016-06-28 00:19:07 +0000 | [diff] [blame] | 28 | 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 Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 29 | notify: |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 30 | - remove container |
| 31 | {% else %} |
| 32 | {% if full_setup %} |
Srikanth Vavilapalli | 666a236 | 2016-11-29 21:23:05 -0600 | [diff] [blame] | 33 | - 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 Vavilapalli | 562986c | 2016-12-12 05:43:10 +0000 | [diff] [blame] | 38 | become: yes |
Srikanth Vavilapalli | 666a236 | 2016-11-29 21:23:05 -0600 | [diff] [blame] | 39 | |
| 40 | - name: Add user to docker group |
| 41 | user: name=ubuntu group=docker append=yes |
Srikanth Vavilapalli | 562986c | 2016-12-12 05:43:10 +0000 | [diff] [blame] | 42 | become: yes |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 43 | {% endif %} |
| 44 | |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 45 | - name: ceilometer proxy config |
Srikanth Vavilapalli | d84b7b7 | 2016-06-28 00:19:07 +0000 | [diff] [blame] | 46 | 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 Vavilapalli | 562986c | 2016-12-12 05:43:10 +0000 | [diff] [blame] | 47 | become: yes |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 48 | notify: |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 49 | - restart monitoring-channel container |
Srikanth Vavilapalli | 666a236 | 2016-11-29 21:23:05 -0600 | [diff] [blame] | 50 | - set monitoring-channel-mtu |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 51 | |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 52 | {% endif %} |
| 53 | |
| 54 | handlers: |
Scott Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 55 | - name: restart monitoring-channel container |
Srikanth Vavilapalli | 562986c | 2016-12-12 05:43:10 +0000 | [diff] [blame] | 56 | 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 Baker | 31acc65 | 2016-06-23 15:47:56 -0700 | [diff] [blame] | 67 | |
| 68 | - name: remove container |
Srikanth Vavilapalli | 562986c | 2016-12-12 05:43:10 +0000 | [diff] [blame] | 69 | docker: name=monitoring-channel-{{ unique_id }} state=absent image=srikanthvavila/monitoring-channel |
Srikanth Vavilapalli | 666a236 | 2016-11-29 21:23:05 -0600 | [diff] [blame] | 70 | |
| 71 | - name: set monitoring-channel-mtu |
Srikanth Vavilapalli | 562986c | 2016-12-12 05:43:10 +0000 | [diff] [blame] | 72 | shell: docker exec --privileged monitoring-channel-{{ unique_id }} sudo ifconfig eth0 mtu 1450 up |