[copr][dist-git] implementing dist-git role
This commit is contained in:
parent
8fdf8ef319
commit
39ede60eb2
5 changed files with 103 additions and 0 deletions
17
roles/copr/dist_git/files/dist-git-epel-7.repo
Normal file
17
roles/copr/dist_git/files/dist-git-epel-7.repo
Normal file
|
@ -0,0 +1,17 @@
|
|||
[asamalik-dist-git]
|
||||
name=Copr repo for dist-git owned by asamalik
|
||||
baseurl=https://copr-be.cloud.fedoraproject.org/results/asamalik/dist-git/epel-7-$basearch/
|
||||
skip_if_unavailable=True
|
||||
gpgcheck=1
|
||||
gpgkey=https://copr-be.cloud.fedoraproject.org/results/asamalik/dist-git/pubkey.gpg
|
||||
enabled=1
|
||||
enabled_metadata=1
|
||||
|
||||
[msuchy-copr]
|
||||
name=Copr repo for copr owned by msuchy
|
||||
baseurl=https://copr-be.cloud.fedoraproject.org/results/msuchy/copr/epel-7-$basearch/
|
||||
skip_if_unavailable=True
|
||||
gpgcheck=1
|
||||
gpgkey=https://copr-be.cloud.fedoraproject.org/results/msuchy/copr/pubkey.gpg
|
||||
enabled=1
|
||||
enabled_metadata=1
|
6
roles/copr/dist_git/files/httpd/lookaside.conf
Normal file
6
roles/copr/dist_git/files/httpd/lookaside.conf
Normal file
|
@ -0,0 +1,6 @@
|
|||
alias /lookaside /var/lib/dist-git/cache/lookaside
|
||||
<Directory /var/lib/dist-git/cache/lookaside>
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
</Directory>
|
|
@ -0,0 +1,13 @@
|
|||
[Unit]
|
||||
Description=copr aux service to import srpm into dist-git
|
||||
Requires=dist-git.socket
|
||||
After=dist-git.socket
|
||||
|
||||
|
||||
[Service]
|
||||
User=copr-service
|
||||
Group=copr-service
|
||||
ExecStart=/usr/bin/python2.7 /usr/share/copr/dist-git/dist_git_importer.py
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
2
roles/copr/dist_git/handlers/main.yml
Normal file
2
roles/copr/dist_git/handlers/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
- name: restart httpd
|
||||
service: name="httpd" state="restarted"
|
65
roles/copr/dist_git/tasks/main.yml
Normal file
65
roles/copr/dist_git/tasks/main.yml
Normal file
|
@ -0,0 +1,65 @@
|
|||
- name: ensure git storage path exists
|
||||
file: path="/var/lib/dist-git/cache/lookaside" state=directory
|
||||
- file: path="/var/lib/dist-git/git/pkgs-git-repos-list" state=directory
|
||||
- file: path="/var/lib/dist-git/git/rpms/" state=directory
|
||||
|
||||
- copy: src="dist-git-epel-7.repo" dest="/etc/yum.repos.d/"
|
||||
|
||||
- name: install packages
|
||||
yum: state=present name={{ item }}
|
||||
with_items:
|
||||
- epel-release
|
||||
- cgit
|
||||
- dist-git
|
||||
- dist-git-selinux
|
||||
- copr-dist-git
|
||||
|
||||
- name: install packages which should be added as requirements
|
||||
yum: state=present name={{ item }}
|
||||
with_items:
|
||||
- pyrpkg
|
||||
|
||||
# TODO: remove, this should be done by `dist-git` package
|
||||
- group: name="cvsadmin" state=present
|
||||
|
||||
- name: create user for git repos
|
||||
user: name="copr-dist-git" groups=cvsadmin,packager
|
||||
|
||||
- name: create user for copr-git service
|
||||
user: name="copr-service" groups=apache,packager generate_ssh_key=yes ssh_key_bits=2048 ssh_key_file=.ssh/id_rsa
|
||||
|
||||
# set ssh key, so that copr-service could access gitolite
|
||||
- name: read pub key into var
|
||||
command: cat /home/copr-service/.ssh/id_rsa.pub
|
||||
register: cat_pubkey
|
||||
|
||||
- set_fact: pubkey="{{cat_pubkey.stdout|join('')}}"
|
||||
|
||||
- debug: msg={{pubkey}}
|
||||
|
||||
- name: prepare authorized key, so copr-service could interact with gitolite
|
||||
authorized_key: user="copr-dist-git" key="{{pubkey}}" key_options="command=\"HOME=/var/lib/dist-git/git/ /usr/share/gitolite3/gitolite-shell $USER \"'"
|
||||
|
||||
## keys done
|
||||
- name: install config for httpd to serve lookaside openly
|
||||
copy: src="httpd/lookaside.conf" dest="/etc/httpd/conf.d/dist-git/lookaside.conf"
|
||||
tags:
|
||||
- config
|
||||
notify:
|
||||
- restart httpd
|
||||
|
||||
- lineinfile: dest=/etc/cgitrc regexp="^project-list=" line="project-list=/var/lib/dist-git/git/pkgs-git-repos-list"
|
||||
- lineinfile: dest=/etc/cgitrc regexp="^scan-path=" line="scan-path=/var/lib/dist-git/git/rpms/"
|
||||
|
||||
- name: install systemd unit
|
||||
copy: src="systemd/copr_distgit_updater.service" dest="/etc/systemd/system/"
|
||||
|
||||
- command: "systemctl daemon-reload"
|
||||
|
||||
- name: ensure that services are enabled and started
|
||||
service: name="{{ item }}" enabled=yes state=started
|
||||
with_items:
|
||||
- "httpd"
|
||||
- "dist-git.socket"
|
||||
- "copr_distgit_updater"
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue