summaryrefslogtreecommitdiffstats
path: root/roles/taskotron/buildslave/tasks/main.yml
blob: 77fe7204e392decb5e040a350aee80cc194220ec (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
---
- name: ensure packages required for buildslave are installed (dnf)
  dnf: name={{ item }} state=present enablerepo={{ extra_enablerepos }}
  with_items:
    - buildbot-slave
    - git
    - rpmlint
    - koji
    - bodhi-client
    - python-virtualenv
    - gcc
    - libcurl-devel
    - rpm-build
    - pylint
    - python-pep8
    - moreutils
    - policycoreutils-python-utils
  when: ansible_distribution_major_version|int > 21 and ansible_cmdline.ostree is not defined

- name: ensure packages required for CI buildslave are installed (dnf)
  dnf: name={{ item }} state=present enablerepo={{ extra_enablerepos }}
  with_items:
    - testcloud
    - mash
    - mock
    - koji
    - python-fedora
    - python-doit
    - python2-rpmfluff
  when: (deployment_type == 'qa-stg') and (ansible_distribution_major_version|int > 21) and (ansible_cmdline.ostree is not defined)

- name: set the selinux fcontext type for the buildmaster_home to var_lib_t
  command: semanage fcontext -a -t var_lib_t "{{ slave_dir }}(/.*)?"
  when: deployment_type in ['qa-stg']

- name: add the buildslave user for taskotron
  user: name=buildslave
  when: deployment_type in ['local']

- name: add the buildslave user for ci
  user: name=buildslave groups=mock
  when: deployment_type in ['qa-stg']

- name: ensure needed groups exist
  group: name={{ item }}
  when: deployment_type == 'stg' or deployment_type in ['dev', 'prod']
  with_items:
    - testcloud
    - taskotron

- name: ensure needed groups exist
  group: name={{ slaves_group }}
  when: slaves_group is defined and (deployment_type == 'stg' or deployment_type in ['dev', 'prod'])

- name: set the selinux fcontext type for the buildslave dir to var_lib_t
  command: semanage fcontext -a -t var_lib_t "{{ item.dir }}(/.*)?"
  with_items: "{{ slaves }}"
  when: slaves is defined and deployment_type in ['dev', 'stg', 'prod']

- name: make sure the selinux fcontext is restored
  command: restorecon -R "{{ item.dir }}"
  with_items: "{{ slaves }}"
  when: slaves is defined and deployment_type in ['dev', 'stg', 'prod']

- name: add buildslave users
  user: name={{ item.user }} group={{ slaves_group }} groups=testcloud,taskotron home={{ item.home }}
  with_items: "{{ slaves }}"
  when: slaves is defined and (deployment_type == 'stg' or deployment_type in ['dev', 'prod'])