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

54 lines
1.9 KiB
YAML
Raw Normal View History

2017-07-26 09:59:59 +02:00
# Build and install a docker image for neutron-controller.
---
2017-08-01 10:19:54 +02:00
- set_fact:
docker_image: "webhost12.service.rug.nl/hpc/openstack-neutron-controller:latest"
2017-07-31 13:21:03 +02:00
- name: pull docker image
docker_image:
2017-08-01 10:19:54 +02:00
name: "{{ docker_image }}"
2017-07-31 13:21:03 +02:00
tags: pull
2017-07-26 09:59:59 +02:00
- set_fact:
env_vars: >
-e "KEYSTONE_HOST={{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}"
-e "METADATA_SECRET=geheim"
-e "MY_IP={{ hostvars[groups['neutron-controller'][0]]['ansible_default_ipv4']['address'] }}"
-e "MYSQL_HOST={{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }}"
-e "MYSQL_ROOT_PASSWORD=geheim"
-e "NEUTRON_PASSWORD=geheim"
-e "NEUTRON_USER=neutron"
-e "NOVA_CONTROLLER_HOST={{ hostvars[groups['nova-controller'][0]]['ansible_default_ipv4']['address'] }}"
-e "NOVA_PASSWORD=geheim"
-e "NOVA_USER=nova"
2017-07-26 16:31:31 +02:00
-e "MEMCACHED_HOST={{ hostvars[groups['memcached'][0]]['ansible_default_ipv4']['address'] }}"
2017-07-26 09:59:59 +02:00
-e "PROVIDER_INTERFACE_NAME={{ hostvars[groups['neutron-controller'][0]]['ansible_default_ipv4']['interface'] }}"
-e "RABBIT_PASSWORD=geheim"
-e "RABBIT_USER=openstack"
2017-08-01 10:19:54 +02:00
tags: env
2017-07-26 09:59:59 +02:00
- name: install service file.
template:
src: templates/neutron-controller.service
dest: /etc/systemd/system/neutron-controller.service
mode: 644
owner: root
group: root
- command: systemctl daemon-reload
- name: Initialize neutron
command: >
/usr/bin/docker run --rm
{{ env_vars }}
--add-host=mariadb:{{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }}
--add-host=keystone:{{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}
--network host
2017-08-01 10:19:54 +02:00
{{ docker_image }}
2017-07-26 09:59:59 +02:00
/etc/bootstrap.sh
tags: bootstrap
- name: make sure service is started
systemd:
name: neutron-controller.service
state: restarted