added neutron-controller

This commit is contained in:
Egon Rijpkema 2017-07-26 09:59:59 +02:00
parent 482333215a
commit 741ba512bc
4 changed files with 78 additions and 0 deletions

3
hosts
View File

@ -37,6 +37,9 @@ run_options=""
[next_cassandra:vars] [next_cassandra:vars]
run_options="-e CASSANDRA_SEEDS=172.23.41.1" run_options="-e CASSANDRA_SEEDS=172.23.41.1"
[neutron-controller]
openstack01-node01
[nova-controller] [nova-controller]
openstack01-node01 openstack01-node01

9
neutron-controller.yml Normal file
View File

@ -0,0 +1,9 @@
---
- hosts: all
name: Dummy to gather facts
tasks: []
- hosts: neutron-controller
become: True
roles:
- neutron-controller

View File

@ -0,0 +1,44 @@
# Build and install a docker image for neutron-controller.
---
- 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"
-e "OVERLAY_INTERFACE_IP_ADDRESS={{ hostvars[groups['neutron-controller'][0]]['ansible_default_ipv4']['address'] }}"
-e "PROVIDER_INTERFACE_NAME={{ hostvars[groups['neutron-controller'][0]]['ansible_default_ipv4']['interface'] }}"
-e "RABBIT_PASSWORD=geheim"
-e "RABBIT_USER=openstack"
- 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
hpc/neutroncontroller
/etc/bootstrap.sh
tags: bootstrap
- name: make sure service is started
systemd:
name: neutron-controller.service
state: restarted

View File

@ -0,0 +1,22 @@
[Unit]
Description=Openstack neutron-controller Container
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker rm -f %n
ExecStart=/usr/bin/docker run --name %n \
{{ env_vars | replace('\n', '') }} \
--add-host=nova-controller:{{ hostvars[groups['nova-controller'][0]]['ansible_default_ipv4']['address'] }} \
--add-host=mariadb:{{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }} \
--add-host=keystone:{{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }} \
--privileged \
--network host \
-p 8774:8774 \
-p 8778:8778 \
hpc/neutroncontroller /etc/run.sh
[Install]
WantedBy=multi-user.target