summaryrefslogtreecommitdiffstats
path: root/roles/openqa
diff options
context:
space:
mode:
authorAdam Williamson <awilliam@redhat.com>2017-08-17 14:31:05 -0700
committerAdam Williamson <awilliam@redhat.com>2017-08-17 14:31:57 -0700
commite0dba51352d3f4225fb1ff0d0f3444f9c165d984 (patch)
tree046612dfbcd6aadeac40fce4852d7f926cdc543d /roles/openqa
parentcd13c1f7ed6766e97c38dd0b35e8bbc4bf8d9ed8 (diff)
downloadansible-e0dba51352d3f4225fb1ff0d0f3444f9c165d984.tar.gz
ansible-e0dba51352d3f4225fb1ff0d0f3444f9c165d984.tar.xz
ansible-e0dba51352d3f4225fb1ff0d0f3444f9c165d984.zip
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).
Diffstat (limited to 'roles/openqa')
-rw-r--r--roles/openqa/worker/tasks/createhdds.yml41
-rw-r--r--roles/openqa/worker/tasks/main.yml3
2 files changed, 44 insertions, 0 deletions
diff --git a/roles/openqa/worker/tasks/createhdds.yml b/roles/openqa/worker/tasks/createhdds.yml
new file mode 100644
index 000000000..38c6042ac
--- /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 5cb4f31af..83a1e448c 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 }}"