2017-07-12 16:32:58 +02:00
|
|
|
# Build and install a docker image for nova-controller.
|
|
|
|
---
|
2017-07-26 16:30:19 +02:00
|
|
|
- set_fact:
|
2017-08-01 10:19:54 +02:00
|
|
|
docker_image: webhost12.service.rug.nl/hpc/openstack-nova-service:latest
|
2017-07-26 16:30:19 +02:00
|
|
|
env_vars: >
|
|
|
|
-e "MY_IP={{ hostvars[groups['nova-controller'][0]]['ansible_default_ipv4']['address'] }}"
|
|
|
|
-e "NOVA_USER=nova"
|
|
|
|
-e "NOVA_PASSWORD=geheim"
|
|
|
|
-e "NOVA_PLACEMENT_USER=placement"
|
|
|
|
-e "NOVA_PLACEMENT_PASSWORD=geheim"
|
|
|
|
-e "RABBIT_USER=openstack"
|
|
|
|
-e "RABBIT_PASSWORD=geheim"
|
|
|
|
-e "KEYSTONE_HOST={{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}"
|
|
|
|
-e "NEUTRON_CONTROLLER_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=geheim"
|
|
|
|
-e "NOVA_CONTROLLER_HOST=={{ hostvars[groups['nova-controller'][0]]['ansible_default_ipv4']['address'] }}"
|
|
|
|
-e "GLANCE_CONTROLLER_HOST=={{ hostvars[groups['glance-controller'][0]]['ansible_default_ipv4']['address'] }}"
|
|
|
|
-e "NEUTRON_PASSWORD=geheim"
|
|
|
|
-e "NEUTRON_USER=neutron"
|
|
|
|
-e "METADATA_SECRET=geheim"
|
2017-08-01 10:19:54 +02:00
|
|
|
tags: facts
|
|
|
|
|
|
|
|
- name: pull docker image
|
|
|
|
docker_image:
|
|
|
|
name: "{{ docker_image }}"
|
|
|
|
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
|
|
|
|
|
|
|
|
- name: Initialize database.
|
|
|
|
command: >
|
|
|
|
/usr/bin/docker run --rm
|
2017-07-26 16:30:19 +02:00
|
|
|
{{ env_vars }}
|
2017-07-12 16:32:58 +02:00
|
|
|
--add-host=mariadb:{{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }}
|
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
|