Browse Source

Made settings in glance and nova flexible.

feature/cinder-volume-encryption
Egon Rijpkema 5 years ago
parent
commit
70814e1a77
  1. 4
      glance-controller.yml
  2. 4
      hosts
  3. 4
      nova-controller.yml
  4. 4
      roles/glance-controller/tasks/main.yml
  5. 3
      roles/glance-controller/templates/glance.service
  6. 10
      roles/horizon/tasks/main.yml
  7. 3
      roles/horizon/templates/horizon.service
  8. 37
      roles/nova-controller/tasks/main.yml
  9. 32
      roles/nova-controller/templates/nova-controller.service
  10. 25
      roles/nova-management/tasks/main.yml
  11. 19
      roles/nova-management/templates/nova-controller.service

4
nova-management.yml → glance-controller.yml

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

4
hosts

@ -7,7 +7,7 @@ openstack01-node03 @@ -7,7 +7,7 @@ openstack01-node03
[dockerregistry]
openstack01-node01
[glance]
[glance-controller]
openstack01-node02
[horizon]
@ -37,5 +37,5 @@ run_options="" @@ -37,5 +37,5 @@ run_options=""
[next_cassandra:vars]
run_options="-e CASSANDRA_SEEDS=172.23.41.1"
[nova-management]
[nova-controller]
openstack01-node01

4
glance.yml → nova-controller.yml

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

4
roles/glance/tasks/main.yml → roles/glance-controller/tasks/main.yml

@ -26,9 +26,11 @@ @@ -26,9 +26,11 @@
-e "MYSQL_HOST={{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }}"
-e "MYSQL_ROOT_PASSWORD=geheim"
-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_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
tags: bootstrap

3
roles/glance/templates/glance.service → roles/glance-controller/templates/glance.service

@ -13,10 +13,9 @@ ExecStart=/usr/bin/docker run --name %n \ @@ -13,10 +13,9 @@ ExecStart=/usr/bin/docker run --name %n \
-e "MYSQL_HOST={{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }}" \
-e "MYSQL_ROOT_PASSWORD=geheim" \
-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_PASSWORD=geheim" \
--add-host="controller:{{ hostvars[groups['keystone'][0]]['ansible_default_ipv4']['address'] }}" \
-p 9292:9292 \
hpc/openstack-glance

10
roles/horizon/tasks/main.yml

@ -1,13 +1,5 @@ @@ -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.
template:
src: templates/horizon.service

3
roles/horizon/templates/horizon.service

@ -6,8 +6,7 @@ Requires=docker.service @@ -6,8 +6,7 @@ Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
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'] }}" \

37
roles/nova-controller/tasks/main.yml

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

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

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

25
roles/nova-management/tasks/main.yml

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

19
roles/nova-management/templates/nova-controller.service

@ -1,19 +0,0 @@ @@ -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
Loading…
Cancel
Save