summaryrefslogtreecommitdiffstats
path: root/roles/openqa/dispatcher/tasks/main.yml
blob: 1a3fc0de22e0a51b1f61c417b6bddd0ca3aaa592 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# 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
# - external_hostname
##       string - The public hostname of the openQA server (used in ResultsDB links)
##       default - ansible_nodename
#
# 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, the
##               fedora_openqa config file will be set appropriately
##               for infra deployments if this is set, so don't set
##               it for private deployments
#
# 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. Result
# reporting to ResultsDB will also be enabled for the production
# deployment. 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"
  check_mode: no

- name: Install openQA-python-client
  command: "python setup.py install"
  args:
    chdir: /root/openQA-python-client
  when: "gitclient|changed or instclient.rc > 0"

- name: Remove old openqa_fedora_tools checkout
  file: path=/root/openqa_fedora_tools-dispatcher state=absent

- name: Remove old fedora-openqa-schedule script
  file: path=/usr/bin/fedora-openqa-schedule state=absent

- name: Check out fedora_openqa (scheduler / reporter tool)
  git:
    repo: https://pagure.io/fedora-qa/fedora_openqa.git
    dest: /root/fedora_openqa
  register: gittools

- name: Check if fedora_openqa has ever been installed
  stat: path=/usr/bin/fedora-openqa
  register: insttools
  changed_when: "1 != 1"
  failed_when: "1 != 1"
  check_mode: no

- name: Install fedora_openqa
  command: "python setup.py install"
  args:
    chdir: /root/fedora_openqa
  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 config directory
  file: path=/etc/fedora-openqa state=directory owner=root group=root mode=0755

- name: Write schedule.conf
  template: src=schedule.conf.j2 dest=/etc/fedora-openqa/schedule.conf owner=root group=root mode=0644
  notify:
  - restart fedmsg-hub
  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

- name: Set up cron job to schedule live-respins jobs
  copy: src=schedule-live-respins.cron dest=/etc/cron.hourly/schedule-live-respins owner=root group=root mode=0755
  tags:
  - config