Created
September 18, 2013 14:02
-
-
Save kerin/6609568 to your computer and use it in GitHub Desktop.
geodjango ansible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
user: vagrant | |
sudo: yes | |
tasks: | |
- name: update apt | |
apt: update_cache=yes cache_valid_time=86400 | |
- name: install base packages | |
apt: pkg=$item state=installed | |
with_items: | |
- build-essential | |
- python-setuptools | |
- python-dev | |
- python-software-properties | |
- git | |
- sudo | |
- postgresql-9.1 | |
- postgresql-server-dev-9.1 | |
- name: add ubuntugis ppa | |
apt_repository: repo=ppa:ubuntugis/ubuntugis-unstable state=present | |
- name: install geo packages | |
apt: pkg=$item state=installed | |
with_items: | |
- postgresql-9.1-postgis-2.0 | |
- proj | |
- gdal-bin | |
- libgeos-3.2.2 | |
- name: install pip | |
easy_install: name=pip | |
- name: install python packages | |
pip: requirements=/vagrant/requirements.txt | |
- name: update postgresql.conf | |
copy: src=templates/postgresql.conf dest=/etc/postgresql/9.1/main/postgresql.conf | |
notify: | |
- restart postgresql | |
- name: update postgres hba.conf | |
copy: src=templates/pg_hba.conf dest=/etc/postgresql/9.1/main/pg_hba.conf | |
notify: | |
- restart postgresql | |
handlers: | |
- name: restart postgresql | |
service: name=postgresql state=restarted | |
- hosts: all | |
user: vagrant | |
sudo: yes | |
sudo_user: postgres | |
tasks: | |
- name: create db | |
postgresql_db: name=graftr | |
encoding='UTF-8' | |
lc_collate='en_GB.UTF-8' | |
lc_ctype='en_GB.UTF-8' | |
template='template0' | |
- name: ensure postgis_extension is installed | |
command: /usr/bin/psql -d graftr -c 'CREATE EXTENSION IF NOT EXISTS postgis;' | |
- name: create postgresql user | |
postgresql_user: db=graftr user=geodjango password=geodjango priv=ALL/spatial_ref_sys:ALL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment