2017-07-14 10:02:55 +02:00
|
|
|
# Build and install a docker image for nova-controller.
|
|
|
|
---
|
2017-08-14 16:40:06 +02:00
|
|
|
- name: include secrets
|
|
|
|
include_vars:
|
|
|
|
file: ../../secrets.yml
|
|
|
|
name: secrets
|
2017-08-31 15:02:47 +02:00
|
|
|
tags: vars
|
2017-08-14 16:40:06 +02:00
|
|
|
|
2017-08-01 10:19:54 +02:00
|
|
|
- set_fact:
|
2018-07-20 10:07:15 +02:00
|
|
|
docker_image: registry.webhosting.rug.nl/hpc/openstack-nova-compute-merlin:latest
|
2017-08-31 15:02:47 +02:00
|
|
|
tags: vars
|
2017-08-01 10:19:54 +02:00
|
|
|
|
2017-07-31 13:21:03 +02:00
|
|
|
- name: pull docker image
|
|
|
|
docker_image:
|
2017-08-01 10:19:54 +02:00
|
|
|
name: "{{ docker_image }}"
|
2017-08-17 15:50:39 +02:00
|
|
|
force: True
|
2017-07-31 13:21:03 +02:00
|
|
|
tags: pull
|
|
|
|
|
2018-04-13 16:19:17 +02:00
|
|
|
- name: Make build and persistent directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
mode: 0777
|
|
|
|
with_items:
|
2018-06-20 15:48:31 +02:00
|
|
|
- /srv/nova-compute
|
|
|
|
- /srv/nova-compute/etc/ceph
|
2018-04-13 16:19:17 +02:00
|
|
|
|
|
|
|
- name: copy ceph-client configurationfile
|
|
|
|
copy:
|
|
|
|
src: files/ceph.conf
|
|
|
|
dest: /srv/nova-compute/etc/ceph/ceph.conf
|
2018-04-16 11:16:37 +02:00
|
|
|
mode: 0644
|
2018-04-13 16:19:17 +02:00
|
|
|
|
|
|
|
- name: copy ceph-client-keyring
|
|
|
|
copy:
|
2018-06-20 13:44:16 +02:00
|
|
|
src: files/ceph.client.compute.keyring
|
|
|
|
dest: /srv/nova-compute/etc/ceph/ceph.client.compute.keyring
|
2018-04-16 11:16:37 +02:00
|
|
|
mode: 0644
|
2018-04-13 16:19:17 +02:00
|
|
|
|
2017-07-14 10:02:55 +02:00
|
|
|
- name: install service file.
|
|
|
|
template:
|
|
|
|
src: templates/nova-compute.service
|
|
|
|
dest: /etc/systemd/system/nova-compute.service
|
|
|
|
mode: 644
|
|
|
|
owner: root
|
|
|
|
group: root
|
2017-08-31 15:02:47 +02:00
|
|
|
tags: systemd
|
2017-07-14 10:02:55 +02:00
|
|
|
|
2018-07-16 14:17:13 +02:00
|
|
|
#- name: set ceph client keyring
|
|
|
|
# copy:
|
|
|
|
# content: "{{ceph_compute_client_keyring}}"
|
|
|
|
# dest: /srv/nova-compute/etc/ceph
|
|
|
|
# when: use_ceph
|
2018-06-20 15:48:31 +02:00
|
|
|
|
2017-07-14 10:02:55 +02:00
|
|
|
- command: systemctl daemon-reload
|
2017-08-31 15:02:47 +02:00
|
|
|
tags: systemd
|
2017-07-14 10:02:55 +02:00
|
|
|
|
|
|
|
- apt:
|
2017-08-31 15:02:47 +02:00
|
|
|
name: "{{ item }}"
|
2017-07-14 10:02:55 +02:00
|
|
|
with_items:
|
2018-06-20 15:48:31 +02:00
|
|
|
- kvm
|
|
|
|
- libvirt0
|
|
|
|
- libvirt-bin
|
|
|
|
- qemu
|
2017-07-14 10:02:55 +02:00
|
|
|
|
|
|
|
- name: make sure service is started
|
|
|
|
systemd:
|
|
|
|
name: nova-compute.service
|
|
|
|
state: restarted
|
2017-08-17 12:14:41 +02:00
|
|
|
|
2017-08-31 15:02:47 +02:00
|
|
|
- name: start service at boot.
|
|
|
|
command: systemctl reenable nova-compute.service
|
|
|
|
|
2017-08-17 12:14:41 +02:00
|
|
|
- name: let nova controler discover new host
|
2017-08-31 15:02:47 +02:00
|
|
|
shell: "sleep 10 && docker exec -i nova-controller.service nova-manage cell_v2 discover_hosts"
|
2017-08-17 12:14:41 +02:00
|
|
|
delegate_to: "{{ hostvars[groups['nova-controller'][0]]['ansible_hostname'] }}"
|
2018-07-19 15:06:12 +02:00
|
|
|
register: result
|
2018-07-20 11:49:20 +02:00
|
|
|
until: result is succeeded
|
2018-07-19 15:06:12 +02:00
|
|
|
retries: 7
|
|
|
|
delay: 3
|
|
|
|
ignore_errors: yes
|