Made settings in glance and nova flexible.

This commit is contained in:
Egon Rijpkema 2017-07-12 16:32:58 +02:00
parent dc8a75f6cb
commit 70814e1a77
11 changed files with 81 additions and 64 deletions

View File

@ -3,7 +3,7 @@
name: Dummy to gather facts name: Dummy to gather facts
tasks: [] tasks: []
- hosts: nova-management - hosts: glance-controller
become: True become: True
roles: roles:
- nova-management - glance-controller

4
hosts
View File

@ -7,7 +7,7 @@ openstack01-node03
[dockerregistry] [dockerregistry]
openstack01-node01 openstack01-node01
[glance] [glance-controller]
openstack01-node02 openstack01-node02
[horizon] [horizon]
@ -37,5 +37,5 @@ 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"
[nova-management] [nova-controller]
openstack01-node01 openstack01-node01

View File

@ -3,7 +3,7 @@
name: Dummy to gather facts name: Dummy to gather facts
tasks: [] tasks: []
- hosts: glance - hosts: nova-controller
become: True become: True
roles: roles:
- glance - nova-controller

View File

@ -26,9 +26,11 @@
-e "MYSQL_HOST={{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }}" -e "MYSQL_HOST={{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }}"
-e "MYSQL_ROOT_PASSWORD=geheim" -e "MYSQL_ROOT_PASSWORD=geheim"
-e "KEYSTONE_HOST={{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}" -e "KEYSTONE_HOST={{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}"
-e "GLANCE_HOST={{ hostvars[groups['glance'][0]]['ansible_default_ipv4']['address'] }}" -e "GLANCE_HOST={{ hostvars[groups['glance-controller'][0]]['ansible_default_ipv4']['address'] }}"
-e "GLANCE_USER=glance" -e "GLANCE_USER=glance"
-e "GLANCE_PASSWORD=geheim" -e "GLANCE_PASSWORD=geheim"
--add-host=nova-controller:{{ hostvars[groups['nova-controller'][0]]['ansible_default_ipv4']['address'] }} \
--add-host=keystone:{{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }} \
hpc/openstack-glance /etc/bootstrap.sh hpc/openstack-glance /etc/bootstrap.sh
tags: bootstrap tags: bootstrap

View File

@ -13,10 +13,9 @@ ExecStart=/usr/bin/docker run --name %n \
-e "MYSQL_HOST={{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }}" \ -e "MYSQL_HOST={{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }}" \
-e "MYSQL_ROOT_PASSWORD=geheim" \ -e "MYSQL_ROOT_PASSWORD=geheim" \
-e "KEYSTONE_HOST={{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}" \ -e "KEYSTONE_HOST={{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}" \
-e "GLANCE_HOST={{ hostvars[groups['glance'][0]]['ansible_default_ipv4']['address'] }}" \ -e "GLANCE_HOST={{ hostvars[groups['glance-controller'][0]]['ansible_default_ipv4']['address'] }}" \
-e "GLANCE_USER=glance" \ -e "GLANCE_USER=glance" \
-e "GLANCE_PASSWORD=geheim" \ -e "GLANCE_PASSWORD=geheim" \
--add-host="controller:{{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}" \
-p 9292:9292 \ -p 9292:9292 \
hpc/openstack-glance hpc/openstack-glance

View File

@ -1,13 +1,5 @@
# Build and install a docker image for horizon. # Run hpc/horizon
--- ---
- name: Make build and persistent directories
file:
path: "{{ item }}"
state: directory
mode: 0777
with_items:
- /srv/horizon
- name: install service file. - name: install service file.
template: template:
src: templates/horizon.service src: templates/horizon.service

View File

@ -6,8 +6,7 @@ Requires=docker.service
[Service] [Service]
TimeoutStartSec=0 TimeoutStartSec=0
Restart=always Restart=always
ExecStartPre=-/usr/bin/docker stop %n ExecStartPre=-/usr/bin/docker rm -f %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStart=/usr/bin/docker run --name %n \ ExecStart=/usr/bin/docker run --name %n \
-e "MEMCACHED_SERVER={{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}" \ -e "MEMCACHED_SERVER={{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}" \
-e "OPENSTACK_HOST={{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}" \ -e "OPENSTACK_HOST={{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}" \

View File

@ -0,0 +1,37 @@
# Build and install a docker image for nova-controller.
---
- 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
-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 "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'] }}"
--add-host=mariadb:{{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }}
hpc/novacontroller
/etc/bootstrap.sh
tags: bootstrap
- name: make sure service is started
systemd:
name: nova-controller.service
state: restarted

View File

@ -0,0 +1,32 @@
[Unit]
Description=Openstack nova-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 \
-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 "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'] }}" \
--add-host=nova-controller:{{ hostvars[groups['nova-controller'][0]]['ansible_default_ipv4']['address'] }} \
--add-host=keystone:{{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }} \
--add-host=mariadb:{{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }} \
-p 8774:8774 \
-p 8778:8778 \
hpc/novacontroller /etc/run.sh
[Install]
WantedBy=multi-user.target

View File

@ -1,25 +0,0 @@
# Build and install a docker image for nova-controller.
---
- 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
--add-host=mariadb:{{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }}
--add-host=controller:{{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}
hpc/novacontroller
/etc/bootstrap.sh
tags: bootstrap
- name: make sure service is started
systemd:
name: nova-controller.service
state: restarted

View File

@ -1,19 +0,0 @@
[Unit]
Description=Openstack nova-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 \
--add-host=mariadb:{{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }} \
--add-host=controller:{{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }} \
--add-host=keystone:{{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }} \
-p 8774:8774 \
-p 8778:8778 \
hpc/novacontroller /etc/run.sh
[Install]
WantedBy=multi-user.target