ansible/roles/copr/frontend/tasks/main.yml
2017-10-15 20:22:53 +00:00

108 lines
2.4 KiB
YAML

---
- include_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 copr-frontend and copr-selinux
dnf: state=latest name={{ item }}
with_items:
- copr-frontend
- copr-selinux
tags:
- packages
- name: ensure python2-flask-whooshee is latest
dnf: state=latest name=python2-flask-whooshee
tags:
- packages
- name: install additional pkgs for copr-frontend
dnf: state=present pkg={{ item }}
with_items:
- "bash-completion"
- "mod_ssl"
- redis
- pxz
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 copr-fedmsg-listener
service: name=copr-fedmsg-listener 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"
- "coprs.conf"
tags:
- config
- name: install copr-frontend ssl vhost for production
template: src="httpd/coprs_ssl.conf.j2" dest="/etc/httpd/conf.d/copr_ssl.conf"
when: not devel
tags:
- config
- include_tasks: "psql_setup.yml"
- name: upgrade db to head
command: alembic 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: rebuild indexes
command: ./manage.py update_indexes
become: yes
become_user: copr-fe
args:
chdir: /usr/share/copr/coprs_frontend/
- name: install ssl certificates for production
include_tasks: "install_certs.yml"
when: not devel
tags:
- config
- name: enable services
service: state=started enabled=yes name={{ item }}
with_items:
- httpd
- 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/