2017-06-20 14:41:01 +02:00
|
|
|
# Build and install a docker image for glance.
|
|
|
|
---
|
2017-08-14 16:40:06 +02:00
|
|
|
- name: include secrets
|
|
|
|
include_vars:
|
|
|
|
file: ../../secrets.yml
|
|
|
|
name: secrets
|
|
|
|
|
2017-07-31 13:21:03 +02:00
|
|
|
- set_fact:
|
2018-07-19 16:35:07 +02:00
|
|
|
docker_image: registry.webhosting.rug.nl/hpc/openstack-glance:latest
|
2017-07-31 13:21:03 +02:00
|
|
|
env_vars: >
|
2017-08-31 15:02:47 +02:00
|
|
|
-e "GLANCE_HOST={{ listen_ip | default(hostvars[groups['glance-controller'][0]]['ansible_default_ipv4']['address']) }}"
|
2017-08-14 16:40:06 +02:00
|
|
|
-e "GLANCE_PASSWORD={{ secrets['GLANCE_PASSWORD'] }}"
|
2017-07-31 13:21:03 +02:00
|
|
|
-e "GLANCE_USER=glance"
|
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-14 16:40:06 +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-14 16:40:06 +02:00
|
|
|
-e "RABBIT_PASSWORD={{ secrets['RABBIT_PASSWORD'] }}"
|
2017-08-10 11:17:24 +02:00
|
|
|
-e "RABBIT_USER=openstack"
|
2018-06-20 16:39:18 +02:00
|
|
|
-e "USE_CEPH={{ use_ceph }}"
|
|
|
|
-e "MON_INITIAL_MEMBERS={{ ceph_mon_initial_members }}"
|
|
|
|
-e "MON_HOST={{ ceph_mon_host }}"
|
|
|
|
-e "PUBLIC_NETWORK={{ ceph_public_network }}"
|
|
|
|
-e "OSD_POOL_DEFAULT_SIZE={{ ceph_osd_pool_default_size }}"
|
2018-04-13 16:19:17 +02:00
|
|
|
|
|
|
|
#- name: pull docker image
|
|
|
|
# docker_image:
|
|
|
|
# name: "{{ docker_image }}"
|
|
|
|
# tags: pull
|
2017-07-31 13:21:03 +02:00
|
|
|
|
2017-06-20 14:41:01 +02:00
|
|
|
- name: Make build and persistent directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
mode: 0777
|
|
|
|
with_items:
|
|
|
|
- /srv/glance
|
2017-08-14 16:40:06 +02:00
|
|
|
- /srv/glance/root
|
2018-04-13 16:19:17 +02:00
|
|
|
- /srv/glance/etc/ceph
|
2017-06-20 14:41:01 +02:00
|
|
|
|
2018-04-17 10:03:26 +02:00
|
|
|
- name: copy ceph-client configurationfile
|
|
|
|
copy:
|
|
|
|
src: files/ceph.conf
|
|
|
|
dest: /srv/glance/etc/ceph/ceph.conf
|
|
|
|
mode: 0644
|
|
|
|
|
|
|
|
- name: copy ceph-client-keyring
|
|
|
|
copy:
|
|
|
|
src: files/ceph.client.images.keyring
|
2018-06-27 17:08:04 +02:00
|
|
|
dest: /srv/glance/etc/ceph/ceph.client.images.keyring
|
2018-04-17 10:03:26 +02:00
|
|
|
mode: 0644
|
|
|
|
|
2018-07-16 14:17:13 +02:00
|
|
|
#- name: set ceph client keyring
|
|
|
|
# copy:
|
|
|
|
# content: "{{ceph_images_client_keyring}}"
|
|
|
|
# dest: /srv/cinder-storage/etc/ceph/ceph.client.images.keyring
|
|
|
|
# when: use_ceph
|
2018-06-20 16:39:18 +02:00
|
|
|
|
2017-06-20 14:41:01 +02:00
|
|
|
- name: install service file.
|
|
|
|
template:
|
|
|
|
src: templates/glance.service
|
|
|
|
dest: /etc/systemd/system/glance.service
|
|
|
|
mode: 644
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
|
2017-08-31 15:02:47 +02:00
|
|
|
- name: start service at boot.
|
|
|
|
command: systemctl reenable glance.service
|
|
|
|
|
2017-06-20 14:41:01 +02:00
|
|
|
- command: systemctl daemon-reload
|
|
|
|
|
|
|
|
- name: Initialize database.
|
2017-07-11 09:17:53 +02:00
|
|
|
command: >
|
2017-07-31 13:21:03 +02:00
|
|
|
/usr/bin/docker run --rm
|
|
|
|
{{ env_vars }}
|
2017-08-31 15:02:47 +02:00
|
|
|
--add-host=keystone:{{ listen_ip | default(hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address']) }} \
|
2017-08-14 16:40:06 +02:00
|
|
|
-v /srv/glance/root:/root \
|
2017-08-31 15:02:47 +02:00
|
|
|
-v /var/lib/glance/images:/var/lib/glance/images \
|
2017-08-01 10:19:54 +02:00
|
|
|
{{ docker_image }} /etc/bootstrap.sh
|
2017-06-20 14:41:01 +02:00
|
|
|
tags: bootstrap
|
|
|
|
|
|
|
|
- name: make sure service is started
|
|
|
|
systemd:
|
|
|
|
name: glance.service
|
|
|
|
state: restarted
|