From e0dba51352d3f4225fb1ff0d0f3444f9c165d984 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 17 Aug 2017 14:31:05 -0700 Subject: [PATCH] openqa/worker: do createhdds on ppc worker This is needed to create the ppc virt-install images (has to be done on a machine of compatible arch). --- roles/openqa/worker/tasks/createhdds.yml | 41 ++++++++++++++++++++++++ roles/openqa/worker/tasks/main.yml | 3 ++ 2 files changed, 44 insertions(+) create mode 100644 roles/openqa/worker/tasks/createhdds.yml diff --git a/roles/openqa/worker/tasks/createhdds.yml b/roles/openqa/worker/tasks/createhdds.yml new file mode 100644 index 0000000000..38c6042ac0 --- /dev/null +++ b/roles/openqa/worker/tasks/createhdds.yml @@ -0,0 +1,41 @@ +# Required vars +# (none) + +- name: Install required packages + dnf: name={{ item }} state=present + with_items: + - libvirt-python3 + - python3-libguestfs + - python3-fedfind + tags: + - packages + +- name: Check out createhdds + git: + repo: https://pagure.io/fedora-qa/createhdds.git + dest: /root/createhdds + +- name: Set up createhdds cron job + copy: src=createhdds dest=/etc/cron.daily/createhdds owner=root group=root mode=0755 + +- name: Check if any hard disk images need (re)building + command: "/root/createhdds/createhdds.py check" + args: + chdir: /var/lib/openqa/share/factory/hdd/fixed + register: diskcheck + failed_when: "1 != 1" + changed_when: "1 != 1" + check_mode: no + +- name: Ensure libvirt is running if needed to create images + service: name=libvirtd enabled=yes state=started + when: "diskcheck.rc > 1" + +# > 1 is not a typo; check exits with 1 if all images are present but some +# are outdated, and 2 if any images are missing. We only want to handle +# outright *missing* images here in the playbook (to handle the case of +# first deployment). Outdated images are handled by the daily cron run. +- name: Create hard disk images (this may take a long time!) + command: "/etc/cron.daily/createhdds" + when: "diskcheck.rc > 1" + ignore_errors: yes diff --git a/roles/openqa/worker/tasks/main.yml b/roles/openqa/worker/tasks/main.yml index 5cb4f31af6..83a1e448cc 100644 --- a/roles/openqa/worker/tasks/main.yml +++ b/roles/openqa/worker/tasks/main.yml @@ -49,6 +49,9 @@ tags: - config +- include: createhdds.yml + when: "inventory_hostname in groups['openqa-hdds-workers']" + - name: Enable and start worker services service: name=openqa-worker@{{ item }} enabled=yes state=started with_sequence: "count={{ openqa_workers }}"