Browse Source

Added nova compute

Also configured horizon to display hypervisors.
feature/cinder-volume-encryption
Egon Rijpkema 5 years ago
parent
commit
d42d1495e9
  1. 4
      horizon.yml
  2. 5
      hosts
  3. 9
      nova-compute.yml
  4. 6
      roles/horizon/templates/horizon.service
  5. 24
      roles/nova-compute/tasks/main.yml
  6. 35
      roles/nova-compute/templates/nova-compute.service
  7. 1
      roles/nova-controller/templates/nova-controller.service

4
horizon.yml

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

5
hosts

@ -11,7 +11,7 @@ openstack01-node01 @@ -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" @@ -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

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

6
roles/horizon/templates/horizon.service

@ -8,8 +8,10 @@ TimeoutStartSec=0 @@ -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

24
roles/nova-compute/tasks/main.yml

@ -0,0 +1,24 @@ @@ -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

35
roles/nova-compute/templates/nova-compute.service

@ -0,0 +1,35 @@ @@ -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

1
roles/nova-controller/templates/nova-controller.service

@ -22,7 +22,6 @@ ExecStart=/usr/bin/docker run --name %n \ @@ -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 \

Loading…
Cancel
Save