Added nova compute

Also configured horizon to display hypervisors.
This commit is contained in:
Egon Rijpkema 2017-07-14 10:02:55 +02:00
parent 1b7fa48714
commit d42d1495e9
7 changed files with 80 additions and 4 deletions

View File

@ -1,4 +1,8 @@
---
- hosts: all
name: Dummy to gather facts
tasks: []
- hosts: horizon
become: True
roles:

5
hosts
View File

@ -11,7 +11,7 @@ openstack01-node01
openstack01-node02
[horizon]
kolla2
openstack01-node03
[rabbitmq]
openstack01-node01
@ -39,3 +39,6 @@ run_options="-e CASSANDRA_SEEDS=172.23.41.1"
[nova-controller]
openstack01-node01
[nova-compute]
openstack01-node04

9
nova-compute.yml Normal file
View File

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

View File

@ -8,8 +8,10 @@ TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker rm -f %n
ExecStart=/usr/bin/docker run --name %n \
-e "MEMCACHED_SERVER={{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}" \
-e "OPENSTACK_HOST={{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}" \
-e "MEMCACHED_SERVER={{ hostvars[groups['memcached'][0]]['ansible_default_ipv4']['address'] }}" \
-e "KEYSTONE_HOST={{ hostvars[groups['keystone'][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'] }} \
-p 80:80 \
hpc/horizon

View File

@ -0,0 +1,24 @@
# Build and install a docker image for nova-controller.
---
- name: install service file.
template:
src: templates/nova-compute.service
dest: /etc/systemd/system/nova-compute.service
mode: 644
owner: root
group: root
- command: systemctl daemon-reload
- apt:
name: '{{ item }}'
with_items:
- kvm
- libvirt0
- libvirt-bin
- qemu
- name: make sure service is started
systemd:
name: nova-compute.service
state: restarted

View File

@ -0,0 +1,35 @@
[Unit]
Description=Openstack nova-compute 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-compute'][0]]['ansible_default_ipv4']['address'] }}" \
-e "NOVA_USER=nova" \
-e "NOVA_COMPUTE_USER=nova_compute" \
-e "NOVA_PASSWORD=geheim" \
-e "NOVA_PLACEMENT_USER=placement" \
-e "NOVA_PLACEMENT_PASSWORD=geheim" \
-e "RABBIT_USER=openstack" \
-e "RABBIT_PASSWORD=geheim" \
-e "RABBIT_HOST={{ hostvars[groups['rabbitmq'][0]]['ansible_default_ipv4']['address'] }}" \
-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'] }} \
--privileged \
-v /var/run/libvirt/libvirt-sock:/var/run/libvirt/libvirt-sock \
-v /srv/osdisks:/var/lib/nova/instances \
hpc/novacompute /etc/run.sh
[Install]
WantedBy=multi-user.target

View File

@ -22,7 +22,6 @@ ExecStart=/usr/bin/docker run --name %n \
-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'] }} \
--privileged \
-p 8774:8774 \