Files
fedora-infra_ansible/roles/copr/frontend-cloud/tasks/main.yml
2019-06-01 14:42:02 +02:00

133 lines
3.0 KiB
YAML

---
- import_tasks: "mount_fs.yml"
- command: "ls -dZ /var/lib/pgsql"
register: pgsql_ls
- name: update selinux context for postgress db dir if it's wrong
command: "restorecon -vvRF /var/lib/pgsql"
when: pgsql_ls.stdout is defined and 'postgresql_db_t' not in pgsql_ls.stdout
- name: install daily custom copr-frontend-crontab
copy: src=cron.daily/copr-frontend-optional dest=/etc/cron.daily/
tags: [cron_tasks]
- name: install hourly custom copr-frontend-crontab
copy: src=cron.hourly/copr-frontend-optional dest=/etc/cron.hourly/
tags: [cron_tasks]
- name: install copr-frontend and copr-selinux
dnf:
state: present
name:
- copr-frontend
- copr-selinux
tags:
- packages
# we install python-alembic because https://bugzilla.redhat.com/show_bug.cgi?id=1536058
- name: install additional pkgs for copr-frontend
dnf:
state: present
pkg:
- "bash-completion"
- "mod_ssl"
- redis
- pxz
- python3-alembic
tags:
- packages
- name: install copr configs
template: src="copr.conf" dest=/etc/copr/copr.conf mode=600
notify:
- reload httpd
tags:
- config
- name: enable and start redis # TODO: .service in copr-backend should depend on redis
service: name=redis enabled=yes state=started
- name: enable and start pagure-events
service: name=pagure-events enabled=yes state=started
- name: copy apache files to conf.d
copy: src="httpd/{{ item }}" dest="/etc/httpd/conf.d/{{ item }}"
with_items:
- "welcome.conf"
tags:
- config
- name: copy crond conf
copy: src="crond" dest="/etc/sysconfig/crond"
- name: copy apache files to conf.d (templates)
template: src="httpd/{{ item }}" dest="/etc/httpd/conf.d/{{ item }}"
with_items:
- "coprs.conf"
tags:
- config
# https://bugzilla.redhat.com/show_bug.cgi?id=1535689
- name: Allow execmem for Apache
seboolean:
name: httpd_execmem
state: yes
persistent: yes
- import_tasks: "psql_setup.yml"
- name: upgrade db to head
command: alembic-3 upgrade head
become: yes
become_user: copr-fe
args:
chdir: /usr/share/copr/coprs_frontend/
- name: set up admins
command: ./manage.py alter_user --admin {{ item }}
become: yes
become_user: copr-fe
args:
chdir: /usr/share/copr/coprs_frontend/
ignore_errors: yes
with_items:
- msuchy
- sgallagh
- spot
- nb
- kevin
- name: install ssl certificates for production
import_tasks: "install_certs.yml"
when: not devel
tags:
- config
- name: install letsencrypt ssl certificates for dev
import_tasks: "letsencrypt.yml"
when: devel
tags:
- config
- name: enable services
service: state=started enabled=yes name={{ item }}
with_items:
- httpd
- crond
- name: set dev banner for dev instance
when: devel
copy: src=banner-include.html dest=/var/lib/copr/
- name: disallow robots on dev instance
when: devel
copy: src=robots.txt dest=/var/www/html/
- name: rebuild indexes
command: ./manage.py update_indexes
become: yes
become_user: copr-fe
args:
chdir: /usr/share/copr/coprs_frontend/