Permalink
Fetching contributors…
Cannot retrieve contributors at this time
76 lines (59 sloc) 2.22 KB
---
# This is an Ansible playbook specifying the instructions for deploying the purl.obolibrary.org site.
- hosts: all
user: ubuntu
sudo: True
gather_facts: True
vars:
mode: production
domain: purl.obolibrary.org
owner: OBOFoundry
repo: purl.obolibrary.org
repo_dir: "/var/www/{{ repo }}"
repo_url: "https://github.com/{{ owner }}/{{ repo }}.git"
cron_job: "cd {{ repo_dir }} && make safe-update"
handlers:
- name: restart apache
service: name=apache2 state=restarted
tasks:
- name: Update apt-get cache
apt: update_cache=yes
- name: Install system-wide packages (not Travis)
when: mode != "travis"
apt: pkg={{ item }} state=installed
with_items:
- ntp
- git
- ruby
- ruby-dev
- python3
- name: Install system-wide packages (All)
apt: pkg={{ item }} state=installed
with_items:
- apache2
- python3-pip
- name: Install Travis command-line
when: mode == "production"
command: gem install travis --no-rdoc --no-ri creates=/usr/local/bin/travis
- name: Install kwalify
command: gem install kwalify creates=/usr/local/bin/kwalify
- name: Install PyYAML
pip: name=PyYAML executable=pip3
- name: Clone the Git repo
when: mode == "production"
git: repo={{ repo_url }} dest={{ repo_dir }}
- name: Immediately update the PURLs
when: mode == "production"
shell: "{{ cron_job }}; exit 0"
- name: Set cron to update PURLs every 10 minutes
when: mode == "production"
cron: name="update PURLs" minute="*/10" job="PATH=/usr/local/bin:$PATH; {{ cron_job }} >> /var/log/obo-purl-cron 2>&1"
- name: Disable default Apache site
command: a2dissite 000-default removes=/etc/apache2/sites-enabled/000-default.conf
notify: restart apache
- name: Make the PURL site available
template: src=etc_apache2_sites-available_site.j2 dest="/etc/apache2/sites-available/{{ repo }}.conf" group=root owner=root force=yes
notify: restart apache
- name: Enable the PURL site
command: "a2ensite {{ repo }}.conf creates=/etc/apache2/sites-enabled/{{ repo }}.conf"
notify: restart apache