hpc-cloud/roles/nova-compute/tasks/main.yml

77 lines
1.7 KiB
YAML

# Build and install a docker image for nova-controller.
---
- name: include secrets
include_vars:
file: ../../secrets.yml
name: secrets
tags: vars
- set_fact:
docker_image: registry.webhosting.rug.nl/hpc/openstack-nova-compute-merlin:latest
tags: vars
- name: pull docker image
docker_image:
name: "{{ docker_image }}"
force: True
tags: pull
- name: Make build and persistent directories
file:
path: "{{ item }}"
state: directory
mode: 0777
with_items:
- /srv/nova-compute
- /srv/nova-compute/etc/ceph
- name: copy ceph-client configurationfile
copy:
src: files/ceph.conf
dest: /srv/nova-compute/etc/ceph/ceph.conf
mode: 0644
- name: copy ceph-client-keyring
copy:
src: files/ceph.client.compute.keyring
dest: /srv/nova-compute/etc/ceph/ceph.client.compute.keyring
mode: 0644
- name: install service file.
template:
src: templates/nova-compute.service
dest: /etc/systemd/system/nova-compute.service
mode: 644
owner: root
group: root
tags: systemd
#- name: set ceph client keyring
# copy:
# content: "{{ceph_compute_client_keyring}}"
# dest: /srv/nova-compute/etc/ceph
# when: use_ceph
- command: systemctl daemon-reload
tags: systemd
- apt:
name: "{{ item }}"
with_items:
- kvm
- libvirt0
- libvirt-bin
- qemu
- name: make sure service is started
systemd:
name: nova-compute.service
state: restarted
- name: start service at boot.
command: systemctl reenable nova-compute.service
- name: let nova controler discover new host
shell: "sleep 10 && docker exec -i nova-controller.service nova-manage cell_v2 discover_hosts"
delegate_to: "{{ hostvars[groups['nova-controller'][0]]['ansible_hostname'] }}"