ansible/roles/pagure/tasks/main.yml
2015-05-13 13:30:22 +02:00

195 lines
4.3 KiB
YAML

---
# Configuration for the pagure webapp
- name: install needed packages
yum: pkg={{ item }} state=present
with_items:
- pagure
- pagure-milters
- python-psycopg2
- libsemanage-python
tags:
- pagure
- packages
- name: Initialize postgres if necessary
command: /usr/bin/postgresql-setup initdb
creates=/var/lib/pgsql/data
notify:
- restart postgresql
tags:
- pagure
# Set-up gitolite
- name: install needed packages
yum: pkg=gitolite3 state=present
tags:
- pagure
- gitolite
- packages
- name: Rename the user gitolite into git
command: usermod --move-home --login git --home /srv/git/ gitolite3
creates=/srv/git/
tags:
- gitolite
- pagure
- name: Rename the group gitolite into git
command: groupmod --new-name git gitolite3
creates=/srv/git/
tags:
- gitolite
- pagure
- name: create the /srv/git/.gitolite/conf folder
action: file state=directory
path=/srv/git/.gitolite/conf
owner=git group=git mode=0775
tags:
- gitolite
- pagure
- name: create the /srv/git/.gitolite/keydir folder
action: file state=directory
path=/srv/git/.gitolite/keydir
owner=git group=git mode=0775
tags:
- gitolite
- pagure
- name: create the /srv/git/.gitolite/logs folder
action: file state=directory
path=/srv/git/.gitolite/logs
owner=git group=git mode=0775
tags:
- gitolite
- pagure
- name: Adjust owner of /srv/git
command: chown git:git -R /srv/git/
tags:
- gitolite
- pagure
- name: Adjust permissions of /srv/git/.gitolite
command: chown git:git -R /srv/git/.gitolite
tags:
- gitolite
- pagure
- name: install our own gitolite configuration
template: src=gitolite.rc
dest=/srv/git/.gitolite.rc
owner=git group=git mode=0755
tags:
- gitolite
- pagure
- name: create all the directories where we store the git repos
action: file state=directory
path={{ item }}
owner=git group=git mode=0775
with_items:
- /srv/git/repositories/
- /srv/git/repositories/forks
- /srv/git/repositories/docs
- /srv/git/repositories/tickets
- /srv/git/repositories/requests
tags:
- gitolite
- pagure
# Set-up postfix and the milter for postfix
- name: Add the /etc/aliases file
copy: src=aliases dest=/etc/aliases owner=root mode=644
tags:
- config
- pagure
- postfix
notify:
- restart pagure_milter
- name: Set pagure_milter to run on boot
service: name=pagure_milter enabled=yes
ignore_errors: true
notify:
- restart pagure_milter
tags:
- service
- postfix
- pagure
# Set-up Pagure
- name: copy sundry pagure configuration
template: src={{ item.file }}
dest={{ item.location }}/{{ item.dest }}
owner=apache group=apache mode=0600
with_items:
- { file: pagure_admin.cfg, location: /etc/pagure, dest: pagure.cfg }
# - { file: alembic.ini, location: /etc/pagure, dest: alembic.ini }
changed_when: "1 != 1"
tags:
- config
- web
- pagure
notify:
- restart apache
- name: create the database scheme
command: /usr/bin/python2 /usr/share/pagure/pagure_createdb.py
changed_when: "1 != 1"
environment:
PAGURE_CONFIG: /etc/pagure/pagure.cfg
tags:
- web
- pagure
- name: Install all the configuration files of pagure
template: src={{ item.file }}
dest={{ item.location }}/{{ item.file }}
owner={{ item.user }} group={{ item.user }} mode=0600
with_items:
- { file: pagure.cfg, location: /etc/pagure, user: git }
- { file: pagure.conf, location: /etc/httpd/conf.d, user: apache }
tags:
- config
- web
- pagure
notify:
- restart apache
- name: Install the wsgi file
template: src=pagure.wsgi
dest=/var/www/pagure.wsgi
owner=git group=git mode=0644
tags:
- config
- web
- pagure
notify:
- restart apache
- name: set sebooleans so pkgdb2 can talk to the db
action: seboolean name=httpd_can_network_connect_db
state=true
persistent=true
tags:
- selinux
- web
- pagure
- name: set sebooleans so apache can send emails
action: seboolean name=httpd_can_sendmail
state=true
persistent=true
tags:
- selinux
- web
- pagure