2017-08-31 15:02:47 +02:00
|
|
|
# Build and install a docker image for heat.
|
|
|
|
---
|
|
|
|
- name: include secrets
|
|
|
|
include_vars:
|
|
|
|
file: ../../secrets.yml
|
|
|
|
name: secrets
|
|
|
|
|
|
|
|
- set_fact:
|
2018-10-08 16:46:06 +02:00
|
|
|
docker_image: registry.webhosting.rug.nl/hpc/openstack-heat-merlin:latest
|
2017-08-31 15:02:47 +02:00
|
|
|
env_vars: >
|
|
|
|
-e "HEAT_HOST={{ listen_ip | default(hostvars[groups['heat'][0]]['ansible_default_ipv4']['address']) }}"
|
|
|
|
-e "HEAT_PASSWORD={{ secrets['HEAT_PASSWORD'] }}"
|
|
|
|
-e "HEAT_USER=heat"
|
2018-08-16 16:27:45 +02:00
|
|
|
-e "KEYSTONE_HOST={{ keystone_external_fqdn | default(hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address']) }}"
|
2017-08-31 15:02:47 +02:00
|
|
|
-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']) }}"
|
|
|
|
-e "MYSQL_ROOT_PASSWORD={{ secrets['MYSQL_ROOT_PASSWORD'] }}"
|
|
|
|
-e "OS_PASSWORD={{ secrets['OS_PASSWORD'] }}"
|
|
|
|
-e "RABBIT_HOST={{ listen_ip | default(hostvars[groups['rabbitmq'][0]]['ansible_default_ipv4']['address']) }}"
|
|
|
|
-e "RABBIT_PASSWORD={{ secrets['RABBIT_PASSWORD'] }}"
|
|
|
|
-e "RABBIT_USER=openstack"
|
|
|
|
|
|
|
|
- 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:
|
|
|
|
- /srv/heat
|
|
|
|
- /srv/heat/root
|
|
|
|
|
|
|
|
- name: install service file.
|
|
|
|
template:
|
|
|
|
src: templates/heat.service
|
|
|
|
dest: /etc/systemd/system/heat.service
|
|
|
|
mode: 644
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
|
|
|
|
- name: start service at boot.
|
|
|
|
command: systemctl reenable heat.service
|
|
|
|
|
|
|
|
- command: systemctl daemon-reload
|
|
|
|
|
|
|
|
- name: Initialize database.
|
|
|
|
command: >
|
|
|
|
/usr/bin/docker run --rm
|
|
|
|
{{ env_vars }}
|
|
|
|
--add-host=keystone:{{ listen_ip | default(hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address']) }} \
|
|
|
|
-v /srv/heat/root:/root \
|
|
|
|
{{ docker_image }} /etc/bootstrap.sh
|
|
|
|
tags: bootstrap
|
|
|
|
|
|
|
|
- name: make sure service is started
|
|
|
|
systemd:
|
|
|
|
name: heat.service
|
|
|
|
state: restarted
|