ansible/roles/copr/dist_git/tasks/main.yml

100 lines
3 KiB
YAML

- include: "mount_fs.yml"
# pre-create users/groups and copy uids/gids from the current prod copr-dist-git
- group: name="packager" state=present gid=987
- group: name="copr-dist-git" state=present gid=1003
- group: name="docker" state=present gid=1004
- group: name="apache" state=present gid=48
- group: name="mock" state=present gid=135
- name: create user for git repos and copr-dist-git service
user: name="copr-dist-git" group=copr-dist-git groups=packager,docker,apache,mock uid=1002
- name: install packages
dnf: state=present name={{ item }}
with_items:
- cgit
- copr-dist-git
- rdiff-backup
- tmpwatch
- highlight
- name: install latest dist-git and copr-dist-git
dnf: state=latest name={{ item }}
with_items:
- dist-git
- dist-git-selinux
- copr-dist-git
- name: switch selinux to permissive
selinux: policy=targeted state=permissive
- name: make sure directories are owned by copr-dist-git user
file: path={{ item }} owner=copr-dist-git group=copr-dist-git state=directory recurse=yes
with_items:
- /var/log/copr-dist-git/
- name: install config for copr-dist-git
template: src=copr-dist-git.conf.j2 dest=/etc/copr/copr-dist-git.conf mode=0644
tags:
- config
- name: set git variables for copr-dist-git user
copy: src=".gitconfig" dest="/home/copr-dist-git/.gitconfig"
- name: set git config username
git_config: name=user.name scope=global value="Copr dist git"
- name: install httpd config needed for COPR lookaside cache
copy: src="httpd/dist-git/{{ item }}" dest="/etc/httpd/conf.d/dist-git/{{ item }}"
with_items:
- lookaside-copr.conf
tags:
- config
notify:
- reload httpd
- name: install copr-dist-git httpd config
copy: src="httpd/{{ item }}" dest="/etc/httpd/conf.d/{{ item }}"
with_items:
- copr-dist-git.conf
tags:
- config
notify:
- reload httpd
- name: temporary logrotation fix until copr-dist-git 0.26 is released & deployed
copy: src="logrotate.d/copr-dist-git" dest="/etc/logrotate.d/copr-dist-git"
- copy: src="dist-git.conf" dest="/etc/dist-git/dist-git.conf" mode=0644
tags:
- config
- copy: src="copr-dist-git.hourly" dest="/etc/cron.hourly/copr-dist-git" mode=755
tags:
- config
- template: src="cgitrc" dest="/etc/cgitrc" owner=root group=root mode=0644
- template: src="cgitrc.slow" dest="/etc/cgitrc.slow" owner=root group=root mode=0644
- name: allow httpd to run cgit
seboolean: name=httpd_enable_cgi state=true persistent=true
- name: install robots.txt
copy: src="robots.txt" dest="/var/www/html/" mode=0644
tags:
- config
- name: set up tmpwatch cron job
cron: name="clean tmp" minute="0" job="/usr/sbin/tmpwatch 2h /tmp/"
- name: ensure that services are enabled and started
service: name="{{ item }}" enabled=yes state=started
with_items:
- "httpd"
- "dist-git.socket"
- "copr-dist-git"
- name: Create /var/cache/cgit/repo-list.rc if does not exists (it last 30 minutes to generate)
command: /etc/cron.hourly/copr-dist-git creates=/var/cache/cgit/repo-list.rc