blob: a84914953d08ff0ff31028174ec3b75b5908ab9a (
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
|
---
- name: ensure grokmirror packages are installed (yum)
yum: name={{ item }} state=present enablerepo={{ extra_enablerepos }}
with_items:
- git
- python-grokmirror
when: ansible_distribution_major_version|int < 22
- name: ensure grokmirror packages are installed (dnf)
dnf: name={{ item }} state=present enablerepo={{ extra_enablerepos }}
with_items:
- git
- python-grokmirror
when: ansible_distribution_major_version|int > 21 and ansible_cmdline.ostree is not defined
- name: create grokmirror user
user: name={{ grokmirror_user }}
- name: add buildslave cert to grokmirror for cloning
authorized_key: user={{ grokmirror_user }} key="{{ buildslave_ssh_pubkey }}"
- name: create grokmirror conf dir
file: path=/etc/grokmirror/ state=directory owner=root group=root mode=1755
- name: create grokmirror root directory
file: path={{ grokmirror_basedir }} state=directory owner={{ grokmirror_user }} group={{ grokmirror_user }} mode=1755
- name: create log directory for grokmirror
file: path=/var/log/grokmirror state=directory owner={{ grokmirror_user }} group={{ grokmirror_user }} mode=1775
- name: create directory for grokmirror locks
file: path=/var/lock/grokmirror state=directory owner={{ grokmirror_user }} group={{ grokmirror_user }} mode=1755
- name: clone initial git repos
git: repo={{ item.url }} bare=yes dest={{ grokmirror_basedir }}/{{ item.name }} update=no
become: true
become_user: "{{ grokmirror_user }}"
with_items: "{{ grokmirror_repos }}"
- name: set up default branch
command: chdir={{ grokmirror_basedir }}/{{ item.name }} git symbolic-ref HEAD refs/heads/{{ grokmirror_default_branch }}
become: true
become_user: "{{ grokmirror_user }}"
with_items: "{{ grokmirror_repos }}"
- name: generate grokmirror config
template: src=repos.conf.j2 dest=/etc/grokmirror/repos.conf owner={{ grokmirror_user }} group={{ grokmirror_user }} mode=0644
- name: install cron jobs to update repos
cron:
name="pull repo for {{ item.name }}"
user={{ grokmirror_user }}
special_time=hourly
job="cd {{ grokmirror_basedir }}/{{ item.name }} && git fetch origin {{ grokmirror_default_branch }}:{{ grokmirror_default_branch }}"
with_items: "{{ grokmirror_repos }}"
|