Skip to content
Merged
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## ANXS - PostgreSQL [![Build Status](https://travis-ci.org/ANXS/postgresql.png?branch=master)](https://travis-ci.org/ANXS/postgresql)
## ANXS - PostgreSQL [![Build Status](https://travis-ci.org/ANXS/postgresql.svg?branch=master)](https://travis-ci.org/ANXS/postgresql)

Ansible role which installs and configures PostgreSQL, extensions, databases and users.

Expand Down
4 changes: 3 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Vagrant.configure('2') do |config|
config.ssh.private_key_path = '~/.vagrant.d/insecure_private_key'

config.vm.define 'anxs' do |machine|
machine.vm.box = "ubuntu/trusty64"
machine.vm.box = "bento/ubuntu-16.04"
# machine.vm.box = "ubuntu/trusty64"
#machine.vm.box = "ubuntu/precise64"
#machine.vm.box = "debian/jessie64"
#machine.vm.box = "debian/wheezy64"
Expand All @@ -17,6 +18,7 @@ Vagrant.configure('2') do |config|

machine.vm.network :private_network, ip: '192.168.88.22'
machine.vm.hostname = 'anxs.local'

machine.vm.provision 'ansible' do |ansible|
ansible.playbook = 'tests/playbook.yml'
ansible.sudo = true
Expand Down
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ postgresql_ext_install_postgis: no

postgresql_ext_postgis_version: "2.1" # be careful: check whether the postgresql/postgis versions work together

postgresql_ext_postgis_deps:
- libgeos-c1
- "postgresql-{{postgresql_version}}-postgis-{{postgresql_ext_postgis_version}}"
- "postgresql-{{postgresql_version}}-postgis-scripts"

# List of databases to be created (optional)
postgresql_databases: []

Expand Down
2 changes: 1 addition & 1 deletion tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
service:
name: "{{ postgresql_service_name }}"
enabled: yes
when: "{{ postgresql_service_enabled | bool }}"
when: postgresql_service_enabled

- name: PostgreSQL | Restart PostgreSQL
service:
Expand Down
10 changes: 6 additions & 4 deletions tasks/extensions/postgis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# file: postgresql/tasks/extensions/postgis.yml

- include_vars: "{{ item }}"
with_first_found:
- "../vars/{{ ansible_distribution_release }}.yml"
- "../vars/empty.yml"

- name: PostgreSQL | Extensions | Make sure the postgis extensions are installed
apt:
name: "{{item}}"
state: present
update_cache: yes
cache_valid_time: "{{apt_cache_valid_time | default (3600)}}"
with_items:
- libgeos-c1
- "postgresql-{{postgresql_version}}-postgis-{{postgresql_ext_postgis_version}}"
- "postgresql-{{postgresql_version}}-postgis-scripts"
with_items: "{{ postgresql_ext_postgis_deps }}"
notify:
- restart postgresql
1 change: 1 addition & 0 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
name: "{{item}}"
state: present
update_cache: yes
default_release: "{{ansible_distribution_release}}-pgdg"
cache_valid_time: "{{apt_cache_valid_time | default (3600)}}"
environment: "{{postgresql_env}}"
with_items:
Expand Down
6 changes: 6 additions & 0 deletions vars/xenial.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---

postgresql_ext_postgis_deps:
- libgeos-c1v5
- "postgresql-{{postgresql_version}}-postgis-{{postgresql_ext_postgis_version}}"
- "postgresql-{{postgresql_version}}-postgis-scripts"