hpc-cloud/roles/glance-controller/tasks/main.yml
Egon Rijpkema 7a6c9ac360 Made Roles use repo wide secrets file.
Made keystone use repo wide secrets file.

Made glance-controller use repo wide secrets file.

kill and then remove image

Made neutron-controller use repo wide secrets file.

Made nova-controller use repo wide secrets file

Made nova-compute use repo wide secrets file.

 Made rabbitmq use repo wide secrets file.

Allow creation of admin-openrc.sh in docker.

added provider_interfaces.

added persistent root folder.

make each dir explicitely

added missing env vars.

mapped kvm machine-id from host
2017-08-17 10:41:01 +02:00

60 lines
1.9 KiB
YAML

# Build and install a docker image for glance.
---
- name: include secrets
include_vars:
file: ../../secrets.yml
name: secrets
- set_fact:
docker_image: webhost12.service.rug.nl/hpc/openstack-glance:latest
env_vars: >
-e "GLANCE_HOST={{ hostvars[groups['glance-controller'][0]]['ansible_default_ipv4']['address'] }}"
-e "GLANCE_PASSWORD={{ secrets['GLANCE_PASSWORD'] }}"
-e "GLANCE_USER=glance"
-e "KEYSTONE_HOST={{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}"
-e "MEMCACHED_HOST={{ hostvars[groups['memcached'][0]]['ansible_default_ipv4']['address'] }}"
-e "MYSQL_HOST={{ 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={{ 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/glance
- /srv/glance/root
- name: install service file.
template:
src: templates/glance.service
dest: /etc/systemd/system/glance.service
mode: 644
owner: root
group: root
- command: systemctl daemon-reload
- name: Initialize database.
command: >
/usr/bin/docker run --rm
{{ env_vars }}
--add-host=keystone:{{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }} \
-v /srv/glance/root:/root \
{{ docker_image }} /etc/bootstrap.sh
tags: bootstrap
- name: make sure service is started
systemd:
name: glance.service
state: restarted