From 54caad2db5307870b4c0a6ee9f48e5f6b6fa8f43 Mon Sep 17 00:00:00 2001 From: Ilya Etingof Date: Thu, 30 Aug 2018 10:54:56 +0200 Subject: [PATCH] Handle VirtualBMC 1.4.0+ setup VirtualBMC 1.4.0+ RPM includes systemd unit file. Make use of systemd unit file if we are running Rocky+ (implies VirtualBMC 1.4.0+) or keep old way of VirtualBMC deployment otherwise. Because of the differences in the shipped systemd unit file versus the one that this playbook has been creating at run time, we need an extra recipe to start VirtualBMC 1.4.0+ instances. Change-Id: I047ce7d545a3dcbc3508d017d360b9c03fa895b9 Partial-Bug: #1790109 --- roles/virtbmc/tasks/configure-vbmc.yml | 43 ++++++++++++++++---------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/roles/virtbmc/tasks/configure-vbmc.yml b/roles/virtbmc/tasks/configure-vbmc.yml index 893af2d06..744d66cf4 100644 --- a/roles/virtbmc/tasks/configure-vbmc.yml +++ b/roles/virtbmc/tasks/configure-vbmc.yml @@ -1,14 +1,7 @@ --- -- name: Install VirtualBMC package - when: release not in ['liberty', 'mitaka', 'newton'] - package: - name: "python2-virtualbmc" - state: present - use: yum - become: true - - name: Create VirtualBMC directories + when: release not in ['liberty', 'mitaka', 'newton'] file: path: "{{ item }}" state: directory @@ -69,6 +62,22 @@ vbmc_libvirt_uri: "qemu+ssh://{{ non_root_user }}@{{ vbmc_address }}/session?socket=/run/user/{{ non_root_user_uid }}/libvirt/libvirt-sock&keyfile=/root/.ssh/id_rsa_virt_power&no_verify=1&no_tty=1" when: vbmc_libvirt_uri is not defined +- name: Install VirtualBMC package + when: release not in ['liberty', 'mitaka', 'newton'] + package: + name: "python2-virtualbmc" + state: present + use: yum + become: true + +- name: Start the Virtual BMCs (virtualbmc >= 1.4.0+) + when: release not in ['liberty', 'mitaka', 'newton', 'ocata', 'pike', 'queens'] + service: + name: "virtualbmc" + state: started + enabled: true + become: true + - name: Create the Virtual BMCs when: release not in ['liberty', 'mitaka', 'newton'] command: "vbmc add {{ item.name }} --port {{ item.virtualbmc_port }} --libvirt-uri {{ vbmc_libvirt_uri }}" @@ -76,12 +85,15 @@ creates: /root/.vbmc/{{ item.name }}/config with_items: "{{ overcloud_nodes }}" become: true - become_user: root -# TODO(lucasagomes): The service file should be included in the -# virtualbmc RPM package. -- name: Create the VirtualBMC systemd service - when: release not in ['liberty', 'mitaka', 'newton'] +- name: Start the Virtual BMCs (virtualbmc >= 1.4.0+) + when: release not in ['liberty', 'mitaka', 'newton', 'ocata', 'pike', 'queens'] + command: "vbmc start {{ item.name }}" + with_items: "{{ overcloud_nodes }}" + become: true + +- name: Create the VirtualBMC systemd service (virtualbmc < 1.4.0) + when: release in ['ocata', 'pike', 'queens'] copy: mode: 0664 dest: "/usr/lib/systemd/system/virtualbmc@.service" @@ -101,12 +113,11 @@ WantedBy=multi-user.target become: true -- name: Start the Virtual BMCs - when: release not in ['liberty', 'mitaka', 'newton'] +- name: Start the Virtual BMCs (virtualbmc < 1.4.0) + when: release in ['ocata', 'pike', 'queens'] service: name: "virtualbmc@{{ item.name }}" state: started enabled: true with_items: "{{ overcloud_nodes }}" become: true -