ansible/roles/openqa/dispatcher/tasks/main.yml
2016-08-10 12:06:41 -07:00

124 lines
4 KiB
YAML

# Required vars with defaults
# - openqa_hostname
## string - hostname of openQA server to run jobs for
## default - localhost
# - openqa_consumer
## bool - whether to enable the fedmsg consumer and run whenever
## a compose completes
## default - true
#
# Optional vars
# - wikitcms_user
## string - FAS username for reporting results to wiki
# - wikitcms_password
## string - password for relval_user
# - deployment_type
## string - Fedora Infrastructure thing; for this role, decides
## whether and where to submit wiki results
#
# When all of the above are set, a wikitcms 'credentials' file will
# be created and result submission to the wiki will be enabled. If
# deployment_type is set to 'prod', results will be submitted to the
# production wiki in response to openQA production 'job complete'
# fedmsgs; if set to 'stg', results will be submitted to the staging
# wiki in response to openQA staging 'job complete' fedmsgs. You
# probably should NOT set these unless you're maintaining the Fedora
# infrastructure deployments.
#
# NOTE: There are still currently a couple of assumptions that the
# openQA server boxes will always act as their own dispatchers, but
# there is no longer any fundamental reason why this must be the case,
# as we now use the openQA asset downloading capability so that the
# scheduler is no longer responsible for downloading assets.
# just keeping this around for convenience as we often need it
#- name: Install required packages (testing)
# dnf: name={{ item }} state=present enablerepo="updates-testing"
# with_items:
# tags:
# - packages
- name: Install required packages
dnf: name={{ item }} state=present
with_items:
- fedfind
- python2-fedmsg-consumers
- python2-requests
- python-resultsdb_api
- python-setuptools
- python-six
- python2-wikitcms
tags:
- packages
- name: Check out openQA-python-client
git:
repo: https://github.com/os-autoinst/openQA-python-client.git
dest: /root/openQA-python-client
register: gitclient
- name: Check if python-client has ever been installed
command: "python -c 'import openqa_client'"
register: instclient
changed_when: "1 != 1"
failed_when: "1 != 1"
always_run: true
- name: Install openQA-python-client
command: "python setup.py install"
args:
chdir: /root/openQA-python-client
when: "gitclient|changed or instclient.rc > 0"
# We check this out to a different place from the 'server' task, because
# otherwise it's hard to make sure we install each time it changes.
- name: Check out openqa_fedora_tools
git:
repo: https://bitbucket.org/rajcze/openqa_fedora_tools
dest: /root/openqa_fedora_tools-dispatcher
register: gittools
- name: Check if openqa_fedora_tools has ever been installed
stat: path=/usr/bin/fedora-openqa-schedule
register: insttools
changed_when: "1 != 1"
failed_when: "1 != 1"
always_run: true
- name: Install openqa_fedora_tools
command: "python setup.py install"
args:
chdir: /root/openqa_fedora_tools-dispatcher/scheduler
when: "gittools|changed or not insttools.stat.exists"
notify:
- restart fedmsg-hub
- name: openQA client config
template: src=client.conf.j2 dest=/etc/openqa/client.conf owner=root group=fedmsg mode=0640
tags:
- config
- name: Create fedora-openqa-schedule config directory
file: path=/etc/fedora-qa state=directory owner=root group=root mode=0755
- name: Write schedule.conf
template: src=schedule.conf.j2 dest=/etc/fedora-qa/schedule.conf owner=root group=root mode=0644
tags:
- config
- name: Create /etc/fedora (credentials files location)
file: path=/etc/fedora state=directory owner=root group=fedmsg mode=0750
- name: Write wikitcms credentials file
template: src=credentials.j2 dest=/etc/fedora/credentials owner=root group=fedmsg mode=0640
when: "wikitcms_user is defined and wikitcms_password is defined"
tags:
- config
- name: Enable fedmsg consumer
template: src=openqa_consumer.py.j2 dest=/etc/fedmsg.d/openqa_consumer.py owner=root group=root mode=0644
notify:
- restart fedmsg-hub
tags:
- config