Skip to content

Commit

Permalink
Fixed PostGIS install on CentOS, and increased Travis tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Clough committed Apr 25, 2018
1 parent f0ad7e4 commit 9aa5605
Show file tree
Hide file tree
Showing 59 changed files with 9,816 additions and 707 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Icon
.Trashes
.vagrant
test
*.retry
37 changes: 30 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
---

language: python
python: "2.7"
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq python-apt python-pycurl
sudo: required
dist: trusty
services:
- docker

env:
matrix:
- IMAGE_NAME="ubuntu-upstart:14.04"
- IMAGE_NAME="ubuntu:16.04-builded"
- IMAGE_NAME="debian:8-builded"
- IMAGE_NAME="debian:9-builded"
- IMAGE_NAME="centos:7-builded"
- IMAGE_NAME="centos:6-builded"

install:
- pip install ansible==1.5.0
- pip install ansible=="2.4.2.0" docker-py
- ln -s ${PWD} tests/docker/ANXS.postgresql

script:
- echo localhost > inventory
- ansible-playbook --syntax-check -i inventory test.yml
- ansible-playbook -i inventory test.yml --connection=local --sudo
# Syntax check
- ansible-playbook -i tests/docker/hosts -e image_name=${IMAGE_NAME} tests/docker/site.yml --syntax-check

# Play test
- ansible-playbook -i tests/docker/hosts -e image_name=${IMAGE_NAME} tests/docker/site.yml

# Idempotence test
- ansible-playbook -i tests/docker/hosts -e image_name=${IMAGE_NAME} tests/docker/site.yml > idempotence_out
- ./tests/idempotence_check.sh idempotence_out

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
96 changes: 87 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,81 @@
## ANXS - PostgreSQL [![Build Status](https://travis-ci.org/ANXS/postgresql.png)](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)

---
Help Wanted! If you are able and willing to help maintain this Ansible role then please open a GitHub issue. A lot of people seem to use this role and we (quite obviously) need assistance!
💖
---

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


#### Requirements & Dependencies
- Tested on Ansible 1.4 or higher.
#### Installation

This has been tested on Ansible 2.4.0 and higher.

To install:

```
ansible-galaxy install ANXS.postgresql
```


#### Dependencies

- ANXS.monit ([Galaxy](https://galaxy.ansible.com/list#/roles/502)/[GH](https://github.com/ANXS/monit)) if you want monit protection (in that case, you should set `monit_protection: true`)


#### Compatibility matrix

| Distribution / PostgreSQL | <= 9.2 | 9.3 | 9.4 | 9.5 | 9.6 | 10 | 11 |
| ------------------------- |:------:|:---:|:---:|:---:|:---:|:--:|:--:|
| Ubuntu 14.04 | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :grey_question:|
| Ubuntu 16.04 | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :grey_question:|
| Debian 8.x | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :grey_question:|
| Debian 9.x | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :grey_question:|
| CentOS 6.x | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :grey_question:|
| CentOS 7.x | :no_entry: | :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :white_check_mark:| :grey_question:|

- :white_check_mark: - tested, works fine
- :grey_question: - will work in the future (help out if you can)
- :interrobang: - maybe works, not tested
- :no_entry: - PostgreSQL has reached EOL


#### Variables

```yaml
# Basic settings
postgresql_version: 9.3
postgresql_encoding: 'UTF-8'
postgresql_locale: 'en_US.UTF-8'
postgresql_version: 9.6
postgresql_encoding: "UTF-8"
postgresql_locale: "en_US.UTF-8"
postgresql_ctype: "en_US.UTF-8"

postgresql_admin_user: "postgres"
postgresql_default_auth_method: "trust"

postgresql_service_enabled: false # should the service be enabled, default is true

postgresql_cluster_name: "main"
postgresql_cluster_reset: false

# List of databases to be created (optional)
# Note: for more flexibility with extensions use the postgresql_database_extensions setting.
postgresql_databases:
- name: foobar
owner: baz # optional; specify the owner of the database
hstore: yes # flag to install the hstore extension on this database (yes/no)
uuid_ossp: yes # flag to install the uuid-ossp extension on this database (yes/no)
citext: yes # flag to install the citext extension on this database (yes/no)
encoding: "UTF-8" # override global {{ postgresql_encoding }} variable per database
lc_collate: "en_GB.UTF-8" # override global {{ postgresql_locale }} variable per database
lc_ctype: "en_GB.UTF-8" # override global {{ postgresql_ctype }} variable per database

# List of database extensions to be created (optional)
postgresql_database_extensions:
- db: foobar
extensions:
- hstore
- citext

# List of users to be created (optional)
postgresql_users:
Expand All @@ -42,16 +91,45 @@ postgresql_user_privileges:
role_attr_flags: "CREATEDB" # role attribute flags
```
There's a lot more knobs and bolts to set, which you can find in the defaults/main.yml
There's a lot more knobs and bolts to set, which you can find in the [defaults/main.yml](./defaults/main.yml)
#### Testing
This project comes with a Vagrantfile, this is a fast and easy way to test changes to the role, fire it up with `vagrant up`

See [vagrant docs](https://docs.vagrantup.com/v2/) for getting setup with vagrant

Once your VM is up, you can reprovision it using either `vagrant provision`, or `ansible-playbook tests/playbook.yml -i vagrant-inventory`

If you want to toy with the test play, see [tests/playbook.yml](./tests/playbook.yml), and change the variables in [tests/vars.yml](./tests/vars.yml)

If you are contributing, please first test your changes within the vagrant environment, (using the targeted distribution), and if possible, ensure your change is covered in the tests found in [.travis.yml](./.travis.yml)


#### License

Licensed under the MIT License. See the LICENSE file for details.
Licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.


#### Thanks

To the contributors:
Creator:
- [Pjan Vandaele](https://github.com/pjan)

Maintainers:
- [Jonathan Lozada D.](https://github.com/jlozadad)
- [Jonathan Freedman](https://github.com/otakup0pe)
- [Sergei Antipov](https://github.com/UnderGreen)

Top Contributors:
- [David Farrington](https://github.com/farridav)
- [Jesse Lang](https://github.com/jesselang)
- [Greg Clough](https://github.com/gclough)
- [Michael Conrad](https://github.com/MichaelConrad)
- [Sébastien Alix](https://github.com/sebalix)
- [Copperfield](https://github.com/Copperfield)

- [Ralph von der Heyden](https://github.com/ralph)


Expand Down
32 changes: 32 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure('2') do |config|

# Ensure we use our vagrant private key
config.ssh.insert_key = false
config.ssh.private_key_path = '~/.vagrant.d/insecure_private_key'

config.vm.define 'anxs' do |machine|
#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"
machine.vm.box = "centos/7"
#machine.vm.box = "centos/6"

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.verbose = "v"
ansible.become = true
ansible.inventory_path = 'vagrant-inventory'
ansible.host_key_checking = false
end

end

end
3 changes: 3 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[defaults]
roles_path = ../
allow_world_readable_tmpfiles = True
Loading

0 comments on commit 9aa5605

Please sign in to comment.