Skip to content

Instantly share code, notes, and snippets.

@nigelbabu
Created April 29, 2013 10:02
Show Gist options
  • Save nigelbabu/5480736 to your computer and use it in GitHub Desktop.
Save nigelbabu/5480736 to your computer and use it in GitHub Desktop.
---
- hosts: build
vars_prompt:
- name: version
prompt: "Ckan Version"
private: False
- name: iteration
prompt: "Iteration"
private: False
tasks:
- name: make sure packages are installed
action: apt pkg=$item state=installed
with_items:
- htop
- rubygems
- python-virtualenv
- python-setuptools
- git-core
- python-dev
- ruby1.8-dev
- postgresql
- libpq-dev
- libxml2-dev
- libxslt1-dev
- build-essential
- bison
- apache2
- libapache2-mod-wsgi
- nginx
- tomcat6
- name: install fpm
action: command gem install -v 0.4.21 fpm creates=/usr/bin/fpm
- name: get ckan version
action: git repo=https://github.com/okfn/ckan dest=/usr/lib/ckan/src/ckan version=release-v${version}
- name: get pip
action: easy_install name=pip
- name: install requirements and make virtualenv
action: pip requirements=/usr/lib/ckan/src/ckan/pip-requirements.txt virtualenv=/usr/lib/ckan/ virtualenv_site_packages=yes
- name: run setup.py develop for ckan
action: command chdir=/usr/lib/ckan/src/ckan/ ../../bin/python setup.py develop
- name: remove psycopg2
action: pip name=psycopg2 virtualenv=/usr/lib/ckan/ state=absent
- name: install supervisor
action: pip name=supervisor virtualenv=/usr/lib/ckan/
- name: remove old repo
action: file path=/var/www/ckan-repo state=absent
- name: create directories
action: file path=$item state=directory
with_items:
- /etc/ckan
- /var/www/ckan-repo
- name: copy all needed files
action: copy src=$item dest=/$item
with_items:
- etc/ckan/who.ini
- etc/ckan/apache.wsgi
- etc/ckan/production.ini
- etc/supervisord.conf
- etc/apache2/conf.d/ckan.conf
- etc/apache2/conf.d/ckan-repo.conf
- etc/apache2/conf.d/ckan.conf
- etc/cron.daily/remove_old_sessions
- etc/init/supervisor.conf
- var/lib/tomcat6/webapps/fgdc2iso.war
- name: copy executables
action: copy src=$item dest=/$item mode=744
with_items:
- usr/bin/ckan
- tmp/after_web.sh
- name: create superviserctl symlink
action: file src=/usr/lib/ckan/bin/supervisorctl dest=/usr/bin/supervisorctl state=link
- name: restart apache
action: service name=apache2 state=restarted
- name: build deb main
action: command chdir=/var/www/ckan-repo/ fpm -t deb -s dir --description='CKAN package' --after-install=/tmp/after_web.sh -n ckan-2.0 --iteration $iteration -v $version -d postgresql -d nginx -d apache2 -d libapache2-mod-wsgi -d python-psycopg2 --config-files /etc/ckan/production.ini --config-files /etc/httpd/conf.d/ckan.conf /usr/bin/ckan /usr/lib/ckan/ /etc/ckan/ /etc/httpd/conf.d/ckan.conf /etc/nginx/conf.d/ckan.conf /etc/cron.daily/remove_old_sessions
- name: create repo
action: command createrepo /var/www/ckan-repo/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment