2017-08-21 11:36:43 +02:00
|
|
|
# Build and install a docker image for cinder.
|
|
|
|
---
|
|
|
|
- name: include secrets
|
|
|
|
include_vars:
|
|
|
|
file: ../../secrets.yml
|
|
|
|
name: secrets
|
2018-09-17 13:40:50 +02:00
|
|
|
tags:
|
|
|
|
- facts
|
2017-08-21 11:36:43 +02:00
|
|
|
|
|
|
|
- set_fact:
|
2018-09-17 13:45:13 +02:00
|
|
|
docker_image: registry.webhosting.rug.nl/hpc/openstack-cinder-controller-merlin:latest
|
2017-08-21 11:36:43 +02:00
|
|
|
env_vars: >
|
2017-08-31 15:02:47 +02:00
|
|
|
-e "MY_IP={{ listen_ip | default(ansible_default_ipv4.address) }}"
|
|
|
|
-e "CINDER_HOST={{ listen_ip | default(hostvars[groups['cinder-controller'][0]]['ansible_default_ipv4']['address']) }}"
|
2017-08-21 11:36:43 +02:00
|
|
|
-e "CINDER_PASSWORD={{ secrets['CINDER_PASSWORD'] }}"
|
|
|
|
-e "CINDER_USER=cinder"
|
2017-08-31 15:02:47 +02:00
|
|
|
-e "KEYSTONE_HOST={{ listen_ip | default(hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address']) }}"
|
|
|
|
-e "MEMCACHED_HOST={{ listen_ip | default(hostvars[groups['memcached'][0]]['ansible_default_ipv4']['address']) }}"
|
|
|
|
-e "MYSQL_HOST={{ listen_ip | default(hostvars[groups['databases'][0]]['ansible_default_ipv4']['address']) }}"
|
2017-08-21 11:36:43 +02:00
|
|
|
-e "MYSQL_ROOT_PASSWORD={{ secrets['MYSQL_ROOT_PASSWORD'] }}"
|
|
|
|
-e "OS_PASSWORD={{ secrets['OS_PASSWORD'] }}"
|
2017-08-31 15:02:47 +02:00
|
|
|
-e "RABBIT_HOST={{ listen_ip | default(hostvars[groups['rabbitmq'][0]]['ansible_default_ipv4']['address']) }}"
|
2017-08-21 11:36:43 +02:00
|
|
|
-e "RABBIT_PASSWORD={{ secrets['RABBIT_PASSWORD'] }}"
|
|
|
|
-e "RABBIT_USER=openstack"
|
2018-09-17 13:28:49 +02:00
|
|
|
-e "RBD_SECRET_UUID={{ secrets['CINDER_RBD_SECRET_UUID']}}"
|
2018-09-17 13:40:50 +02:00
|
|
|
tags:
|
|
|
|
- facts
|
2017-08-21 11:36:43 +02:00
|
|
|
|
|
|
|
- name: pull docker image
|
|
|
|
docker_image:
|
|
|
|
name: "{{ docker_image }}"
|
|
|
|
tags: pull
|
|
|
|
|
|
|
|
- name: Make build and persistent directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
mode: 0777
|
|
|
|
with_items:
|
2017-08-28 11:50:57 +02:00
|
|
|
- /srv/cinder-controller
|
|
|
|
- /srv/cinder-controller/root
|
2017-08-21 11:36:43 +02:00
|
|
|
|
|
|
|
- name: install service file.
|
|
|
|
template:
|
|
|
|
src: templates/cinder-controller.service
|
|
|
|
dest: /etc/systemd/system/cinder-controller.service
|
|
|
|
mode: 644
|
|
|
|
owner: root
|
|
|
|
group: root
|
2018-09-17 13:40:50 +02:00
|
|
|
tags:
|
|
|
|
- systemd
|
2017-08-21 11:36:43 +02:00
|
|
|
|
2017-08-31 15:02:47 +02:00
|
|
|
- name: start service at boot.
|
|
|
|
command: systemctl reenable cinder-controller.service
|
2018-09-17 13:40:50 +02:00
|
|
|
tags:
|
|
|
|
- systemd
|
2017-08-31 15:02:47 +02:00
|
|
|
|
2017-08-21 11:36:43 +02:00
|
|
|
- command: systemctl daemon-reload
|
2018-09-17 13:40:50 +02:00
|
|
|
tags:
|
|
|
|
- systemd
|
2017-08-21 11:36:43 +02:00
|
|
|
|
|
|
|
- name: Initialize database.
|
|
|
|
command: >
|
|
|
|
/usr/bin/docker run --rm
|
|
|
|
{{ env_vars }}
|
2017-08-28 11:50:57 +02:00
|
|
|
-v /srv/cinder-controller/root:/root \
|
2017-08-21 11:36:43 +02:00
|
|
|
{{ docker_image }} /etc/bootstrap.sh
|
|
|
|
tags: bootstrap
|
|
|
|
|
|
|
|
- name: make sure service is started
|
|
|
|
systemd:
|
|
|
|
name: cinder-controller.service
|
|
|
|
state: restarted
|