Added playbook for hpc/nova-controller docker
This commit is contained in:
parent
aa535dc3d4
commit
be8e476e3e
5
nova-management.yml
Normal file
5
nova-management.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: nova-management
|
||||
become: True
|
||||
roles:
|
||||
- nova-management
|
48
roles/nova-management/tasks/main.yml
Normal file
48
roles/nova-management/tasks/main.yml
Normal file
@ -0,0 +1,48 @@
|
||||
# Build and install a docker image for nova-controller.
|
||||
---
|
||||
- include: ../common/tasks/docker.yml
|
||||
|
||||
- name: Make build and persistent directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: 0777
|
||||
with_items:
|
||||
- /srv/nova-controller
|
||||
|
||||
# Todo: remove this when we have a docker repo
|
||||
# Disabled because of https://github.com/ansible/ansible/issues/20653
|
||||
#- name: clone docker-glance repo
|
||||
# git:
|
||||
# accept_hostkey: True
|
||||
# repo: ssh://git@git.webhosting.rug.nl:222/HPC/docker-nova-service
|
||||
# dest: /srv/docker-nova-service
|
||||
|
||||
- name: build nova-controller image
|
||||
docker_image:
|
||||
path: /srv/docker-nova-service
|
||||
name: hpc/novacontroller
|
||||
|
||||
- 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
Normal file
19
roles/nova-management/templates/nova-controller.service
Normal file
@ -0,0 +1,19 @@
|
||||
[Unit]
|
||||
Description=Openstack nova-controller Container
|
||||
After=docker.service
|
||||
Requires=docker.service
|
||||
|
||||
[Service]
|
||||
TimeoutStartSec=0
|
||||
Restart=always
|
||||
ExecStartPre=-/usr/bin/docker stop %n
|
||||
ExecStartPre=-/usr/bin/docker rm %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'] }} \
|
||||
-p 8774:8774 \
|
||||
-p 8778:8778 \
|
||||
hpc/novacontroller /etc/run.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user