summaryrefslogtreecommitdiffstats
path: root/roles/openqa/worker/tasks
diff options
context:
space:
mode:
authorAdam Williamson <awilliam@redhat.com>2015-11-13 09:49:00 -0800
committerAdam Williamson <awilliam@redhat.com>2015-11-13 09:49:00 -0800
commit2b098b34bd776a2992185827cf8ddc67c42b7040 (patch)
treedfa2d3fc63c03918eb14521d3d592049ae8837fe /roles/openqa/worker/tasks
parent5359b5b363d0ffeb08915a90c30d99664b67b286 (diff)
downloadansible-2b098b34bd776a2992185827cf8ddc67c42b7040.tar.gz
ansible-2b098b34bd776a2992185827cf8ddc67c42b7040.tar.xz
ansible-2b098b34bd776a2992185827cf8ddc67c42b7040.zip
set up for openQA deployment
This adds openQA server, worker and dispatcher roles, and applies them to the appropriate hosts. A few secret vars are required. See trac #4958 for discussion.
Diffstat (limited to 'roles/openqa/worker/tasks')
-rw-r--r--roles/openqa/worker/tasks/main.yml45
-rw-r--r--roles/openqa/worker/tasks/nfs-client.yml24
2 files changed, 69 insertions, 0 deletions
diff --git a/roles/openqa/worker/tasks/main.yml b/roles/openqa/worker/tasks/main.yml
new file mode 100644
index 000000000..70c4c70ed
--- /dev/null
+++ b/roles/openqa/worker/tasks/main.yml
@@ -0,0 +1,45 @@
+# Required vars
+# - openqa_workers
+## integer - number of worker instances to create/run
+
+# Required vars with defaults
+# - openqa_hostname
+## string - hostname of openQA server to run jobs for
+## default - localhost
+
+- name: Ensure DNF COPR plugin is available
+ dnf: pkg="dnf-command(copr)" state=present
+ tags:
+ - packages
+
+- name: Install openQA repo if needed
+ command: "dnf -y copr enable adamwill/openQA"
+ args:
+ creates: /etc/yum.repos.d/_copr_adamwill-openQA.repo
+ tags:
+ - config
+
+- name: Install packages
+ dnf: name={{ item }} state=present enablerepo=adamwill-openQA
+ with_items:
+ - openqa-worker
+ - libselinux-python
+ tags:
+ - packages
+
+- include: nfs-client.yml
+ when: openqa_hostname is defined and openqa_hostname != "localhost"
+
+- name: openQA client config
+ template: src=client.conf.j2 dest=/etc/openqa/client.conf owner=_openqa-worker group=root mode=0600
+ tags:
+ - config
+
+- name: openQA worker config
+ template: src=workers.ini.j2 dest=/etc/openqa/workers.ini owner=_openqa-worker group=root mode=0644
+ tags:
+ - config
+
+- name: Worker services
+ service: name=openqa-worker@{{ item }} enabled=yes state=started
+ with_sequence: "count={{ openqa_workers }}"
diff --git a/roles/openqa/worker/tasks/nfs-client.yml b/roles/openqa/worker/tasks/nfs-client.yml
new file mode 100644
index 000000000..2eedd0ec3
--- /dev/null
+++ b/roles/openqa/worker/tasks/nfs-client.yml
@@ -0,0 +1,24 @@
+# Required vars
+# - openqa_hostname
+## string - hostname of the openQA server (we assume it is hosting the NFS mount)
+
+- name: Install NFS client
+ dnf: name=nfs-utils state=present
+ tags:
+ - packages
+
+# We don't check ownership as, after mounting, it's owned by whatever the
+# UID of geekotest is on the server
+- name: Ensure mount target exists
+ file: path=/var/lib/openqa/share state=directory mode=0755
+
+- name: Create mount unit
+ template: src=var-lib-openqa-share.mount.j2 dest=/etc/systemd/system/var-lib-openqa-share.mount owner=root group=root mode=0644
+ tags:
+ - config
+
+- name: Enable and start mount
+ service: name={{ item }} enabled=yes state=started
+ with_items:
+ - var-lib-openqa-share.mount
+ - remote-fs.target