hpc-cloud/roles/nova-controller/tasks/main.yml

70 lines
2.5 KiB
YAML
Raw Permalink Normal View History

# Build and install a docker image for nova-controller.
---
- 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-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 "GLANCE_CONTROLLER_HOST={{ hostvars[groups['glance-controller'][0]]['ansible_default_ipv4']['address'] }}"
2017-07-26 16:30:19 +02:00
-e "KEYSTONE_HOST={{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}"
-e "MEMCACHED_HOST={{ hostvars[groups['memcached'][0]]['ansible_default_ipv4']['address'] }}"
-e "MY_IP={{ hostvars[groups['nova-controller'][0]]['ansible_default_ipv4']['address'] }}"
2017-07-26 16:30:19 +02:00
-e "MYSQL_HOST={{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }}"
-e "MYSQL_ROOT_PASSWORD={{ secrets['MYSQL_ROOT_PASSWORD'] }}"
-e "NEUTRON_CONTROLLER_HOST={{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}"
-e "NEUTRON_PASSWORD={{ secrets['NEUTRON_PASSWORD'] }}"
2017-07-26 16:30:19 +02:00
-e "NEUTRON_USER=neutron"
-e "NOVA_CONTROLLER_HOST={{ hostvars[groups['nova-controller'][0]]['ansible_default_ipv4']['address'] }}"
-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 }}"
force: True
2017-08-01 10:19:54 +02:00
tags: pull
2017-07-26 16:30:19 +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 }}
--add-host=mariadb:{{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }}
2017-08-02 15:22:10 +02:00
--add-host=keystone:{{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}
-v /srv/nova-controller/root:/root
2017-08-01 10:19:54 +02:00
{{ docker_image }}
/etc/bootstrap.sh
tags: bootstrap
- name: make sure service is started
systemd:
name: nova-controller.service
state: restarted