summaryrefslogtreecommitdiffstats
path: root/roles/koji_builder/tasks/main.yml
blob: dba0263e56bb6f322021e704397f10b1acea0de6 (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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#
# This is a base koji_builder role.
#
- name: set hostname
  hostname: name="{{inventory_hostname}}"
  tags:
  - koji_builder

- name: set root passwd
  user: name=root password={{ builder_rootpw }} state=present
  tags:
  - koji_builder
  - rootpw

- name: add mock user as 425
  user: name=mock uid=425 state=present home=/var/lib/mock createhome=yes system=yes
  tags:
  - koji_builder

- name: make mock homedir perms
  file: state=directory path=/var/lib/mock mode=2775 owner=root group=mock
  tags:
  - koji_builder

- name: add mock ssh dir
  file: state=directory path=/var/lib/mock/.ssh mode=700 owner=mock group=mock
  tags:
  - koji_builder

- name: add mock ssh keys
  copy: src=mock_auth_keys dest=/var/lib/mock/.ssh/authorized_keys mode=640 owner=mock group=mock
  tags:
  - koji_builder

- name: add kojibuilder
  user: name=kojibuilder groups=mock
  tags:
  - koji_builder

- name: add mockbuilder
  user: name=mockbuilder groups=mock
  tags:
  - koji_builder

- name: mockbuilder .ssh dir
  file: state=directory path=/home/mockbuilder/.ssh mode=700 owner=mockbuilder group=mockbuilder
  tags:
  - koji_builder

- name: mockbuilder ssh key
  copy: src=ftbfs_auth_keys dest=/home/mockbuilder/.ssh/authorized_keys mode=644 owner=mockbuilder group=mockbuilder
  tags:
  - koji_builder

- name: make a bunch of dirs
  file: state=directory path={{ item }}
  with_items:
    - /pub
    - /mnt/fedora_koji
    - /pub/fedora
    - /pub/epel
  tags:
  - koji_builder

- name: add pkgs
  dnf: state=present pkg={{ item }}
  with_items:
    - yum-utils
    - koji-builder
    - python-osbs-client
    - koji-containerbuild-builder
    - strace
    - mock
    - kernel-firmware
    - ntp
    - ntpdate
    - rsyslog
    - audit
    - pycdio
    - python-kickstart
    - oz
    - imagefactory
    - imagefactory-plugins-TinMan
    - imagefactory-plugins-Docker
    - imagefactory-plugins-vSphere
    - imagefactory-plugins-ovfcommon
    - imagefactory-plugins
    - imagefactory-plugins-OVA
    - imagefactory-plugins-EC2
    - imagefactory-plugins-RHEVM
    - python-psphere
    - VMDKstream
    - pykickstart
  tags:
  - koji_builder

- name: enable virtlogd service
  service: name=virtlogd state=started enabled=yes
  tags:
  - koji_builder
  when: ansible_distribution_major_version|int > 23

- name: build /etc/kojid/kojid.conf from group vars
  template: src=kojid.conf dest=/etc/kojid/kojid.conf
  notify:
  - restart kojid
  tags:
  - koji_builder

- name: build /etc/koji/koji.conf from group vars
  template: src=koji.conf dest=/etc/koji.conf
  tags:
  - koji_builder

- name: config for the kojid runroot plugin (only some builders)
  template: src=runroot.conf.j2 dest=/etc/kojid/plugins/runroot.conf
  when: "'runroot' in group_names"
  notify:
  - restart kojid
  tags:
  - koji_builder

- name: override kojid.service file to set TasksMax to unlimited
  copy: src=kojid.service dest=/etc/systemd/system/kojid.service
  notify:
  - reload systemd
  - restart kojid
  tags:
  - koji_builder

# setup for oz/imagefactory
- name: make .psphere dir
  file: state=directory path=/root/.psphere mode=775 owner=root group=root
  tags:
  - koji_builder

- name: make .psphere/templates dir
  file: state=directory path=/root/.psphere/templates mode=775 owner=root group=root
  tags:
  - koji_builder

- name: copy over /root/.psphere/config.yaml
  copy: src={{ private }}/files/koji/config.yaml dest=/root/.psphere/config.yaml
  tags:
  - koji_builder
# done oz/imagefactory

- name: copy over /etc/security/limits.conf
  copy: src=limits.conf dest=/etc/security/limits.conf
  tags:
  - koji_builder

# oz.cfg  upstream ram and cpu definitions are not enough
- name: oz.cfg
  copy: src=oz.cfg dest=/etc/oz/oz.cfg
  when: not inventory_hostname.startswith('buildppc')
  tags:
  - koji_builder

# install libvirtd.conf
#
# This provides us with the ability to use virt-manager from non root accounts.
# This is useful in the oz/imagefactory context for debugging

- name: install libvirtd.conf
  copy: src="{{ files }}/virthost/libvirtd.conf" dest=/etc/libvirt/libvirtd.conf
  notify:
  - restart libvirtd
  tags:
  - koji_builder

#
# On primary we want to make a /mnt/koji link to /mnt/fedora_koji/koji
#

- name: make a mnt/koji link
  file: state=link src=/mnt/fedora_koji/koji dest=/mnt/koji
  when: koji_hub_nfs is defined and koji_hub_nfs == "fedora_koji" and createrepo == True
  tags:
  - koji_builder

#
# alternative arch builders however want to link to just /mnt/fedora_koji
#

- name: make a mnt/koji link
  file: state=link src=/mnt/fedora_koji dest=/mnt/koji
  when: koji_hub_nfs is defined and koji_hub_nfs != "fedora_koji" and createrepo == True
  tags:
  - koji_builder

# mock configs for pungify job
- name: put extra special  mock configs in
  copy: src=builders/{{ item }} dest="/etc/mock/{{ item }}" mode=644
  with_items:
    - fedora-branched-pungi-armhfp.cfg
    - fedora-branched-pungi-i386.cfg
    - fedora-branched-pungi-x86_64.cfg
    - fedora-branched-pungi-aarch64.cfg
    - fedora-branched-pungi-ppc64.cfg
    - fedora-branched-pungi-ppc64le.cfg
    - fedora-rawhide-pungi-i386.cfg
    - fedora-rawhide-pungi-x86_64.cfg
    - fedora-rawhide-pungi-armhfp.cfg
    - fedora-rawhide-pungi-aarch64.cfg
    - fedora-rawhide-pungi-ppc64.cfg
    - fedora-rawhide-pungi-ppc64le.cfg
  tags:
  - koji_builder

- name: mock site-defaults.cfg
  template: src=builders/site-defaults.cfg dest=/etc/mock/site-defaults.cfg mode=0644 owner=root group=mock
  when: not inventory_hostname.startswith('bkernel')
  tags:
  - koji_builder

#
# We want more loop devices on builders to allow more image creates
#

- name: check for max_loop with grub2
  command: cat /etc/grub2.cfg
  register: max_loop
  check_mode: no
  changed_when: '1 != 1'
  when: ansible_distribution_major_version|int != 6 and ansible_architecture == 'x86_64'
  tags:
  - koji_builder

- name: check for max_loop with grub1
  command: cat /etc/grub.conf
  register: max_loop
  check_mode: no
  changed_when: '1 != 1'
  when: ansible_distribution == 'RedHat' and ansible_architecture == 'x86_64' and ansible_distribution_major_version|int == 6
  tags:
  - koji_builder

- name: set kernel params for more loops
  command: /sbin/grubby --update-kernel=ALL --args=max_loop=64
  when: max_loop is defined and ansible_architecture == 'x86_64'
  tags:
  - koji_builder

#
# x86_64 builders run pungify, that needs hfs module in order to make
# The efi/mac images. This module is only needed on rhel.
#

- name: special pkgs for the x86_64 builders
  yum: state=present pkg={{ item }}
  with_items:
  - kmod-hfsplus
  when: is_rhel is defined and ansible_architecture == 'x86_64' and ansible_distribution_major_version|int == '6'
  tags:
  - koji_builder