2017-07-12 16:32:58 +02:00
|
|
|
# Build and install a docker image for nova-controller.
|
|
|
|
---
|
2017-08-14 16:40:06 +02:00
|
|
|
- name: include secrets
|
|
|
|
include_vars:
|
|
|
|
file: ../../secrets.yml
|
|
|
|
name: secrets
|
|
|
|
|
|
|
|
- name: Make persistent directories
|
|
|
|
file:
|
|
|
|
path: "{ item }}"
|
|
|
|
state: directory
|
|
|
|
mode: 0777
|
|
|
|
with_items:
|
|
|
|
- /srv/nova-controller
|
|
|
|
- /srv/nova-controller/root
|
|
|
|
|
2017-07-26 16:30:19 +02:00
|
|
|
- set_fact:
|
2017-08-31 15:02:47 +02:00
|
|
|
docker_image: registry.webhosting.rug.nl/hpc/openstack-nova-service:latest
|
2017-07-26 16:30:19 +02:00
|
|
|
env_vars: >
|
2017-08-31 15:02:47 +02:00
|
|
|
-e "GLANCE_CONTROLLER_HOST={{ listen_ip | default(hostvars[groups['glance-controller'][0]]['ansible_default_ipv4']['address']) }}"
|
|
|
|
-e "KEYSTONE_HOST={{ listen_ip | default(hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address']) }}"
|
|
|
|
-e "METADATA_SECRET={{ secrets['METADATA_SECRET'] }}"
|
|
|
|
-e "MEMCACHED_HOST={{ listen_ip | default(hostvars[groups['memcached'][0]]['ansible_default_ipv4']['address']) }}"
|
|
|
|
-e "MY_IP={{ listen_ip | default(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'] }}"
|
2017-08-31 15:02:47 +02:00
|
|
|
-e "NEUTRON_CONTROLLER_HOST={{ hostvars[groups['neutron-controller'][0]]['listen_ip'] | default(hostvars[groups['neutron-controller'][0]]['ansible_default_ipv4']['address']) }}"
|
2017-08-14 16:40:06 +02:00
|
|
|
-e "NEUTRON_PASSWORD={{ secrets['NEUTRON_PASSWORD'] }}"
|
2017-07-26 16:30:19 +02:00
|
|
|
-e "NEUTRON_USER=neutron"
|
2017-08-31 15:02:47 +02:00
|
|
|
-e "NOVA_CONTROLLER_HOST={{ listen_ip | default(hostvars[groups['nova-controller'][0]]['ansible_default_ipv4']['address']) }}"
|
2017-08-14 16:40:06 +02:00
|
|
|
-e "NOVA_PASSWORD={{ secrets['NOVA_PASSWORD'] }}"
|
|
|
|
-e "NOVA_PLACEMENT_PASSWORD={{ secrets['NOVA_PLACEMENT_PASSWORD'] }}"
|
|
|
|
-e "NOVA_PLACEMENT_USER=placement"
|
|
|
|
-e "NOVA_USER=nova"
|
|
|
|
-e "OS_PASSWORD={{ secrets['OS_PASSWORD'] }}"
|
|
|
|
-e "RABBIT_PASSWORD={{ secrets['RABBIT_PASSWORD'] }}"
|
|
|
|
-e "RABBIT_USER=openstack"
|
2017-08-01 10:19:54 +02:00
|
|
|
tags: facts
|
|
|
|
|
|
|
|
- name: pull docker image
|
|
|
|
docker_image:
|
|
|
|
name: "{{ docker_image }}"
|
2017-08-17 15:50:39 +02:00
|
|
|
force: True
|
2017-08-01 10:19:54 +02:00
|
|
|
tags: pull
|
2017-07-26 16:30:19 +02:00
|
|
|
|
2017-07-12 16:32:58 +02:00
|
|
|
- name: install service file.
|
|
|
|
template:
|
|
|
|
src: templates/nova-controller.service
|
|
|
|
dest: /etc/systemd/system/nova-controller.service
|
|
|
|
mode: 644
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
|
|
|
|
- command: systemctl daemon-reload
|
|
|
|
|
2017-08-31 15:02:47 +02:00
|
|
|
- name: start service at boot.
|
|
|
|
command: systemctl reenable nova-controller.service
|
|
|
|
|
2017-07-12 16:32:58 +02:00
|
|
|
- name: Initialize database.
|
|
|
|
command: >
|
|
|
|
/usr/bin/docker run --rm
|
2017-07-26 16:30:19 +02:00
|
|
|
{{ env_vars }}
|
2017-08-31 15:02:47 +02:00
|
|
|
--add-host=mariadb:{{ listen_ip | default(hostvars[groups['databases'][0]]['ansible_default_ipv4']['address']) }}
|
|
|
|
--add-host=keystone:{{ listen_ip | default(hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address']) }}
|
2017-08-14 16:40:06 +02:00
|
|
|
-v /srv/nova-controller/root:/root
|
2017-08-01 10:19:54 +02:00
|
|
|
{{ docker_image }}
|
2017-07-12 16:32:58 +02:00
|
|
|
/etc/bootstrap.sh
|
|
|
|
tags: bootstrap
|
|
|
|
|
|
|
|
- name: make sure service is started
|
|
|
|
systemd:
|
|
|
|
name: nova-controller.service
|
|
|
|
state: restarted
|