Skip to content
This repository was archived by the owner on Feb 13, 2023. It is now read-only.

Commit 0aba193

Browse files
committed
Update Postgresql role to latest 1.0.3 version.
1 parent 585148d commit 0aba193

File tree

8 files changed

+57
-39
lines changed

8 files changed

+57
-39
lines changed

provisioning/requirements.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
- src: geerlingguy.postfix
6565
version: 1.1.0
6666
- src: geerlingguy.postgresql
67-
version: 1.0.2
67+
version: 1.0.3
6868
- src: geerlingguy.redis
6969
version: 1.4.1
7070
- src: geerlingguy.repo-remi
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.retry
2+
tests/test.sh

provisioning/roles/geerlingguy.postgresql/.travis.yml

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,65 +3,40 @@ services: docker
33

44
env:
55
- distro: centos7
6-
init: /usr/lib/systemd/systemd
7-
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
86
postgresql_bin_dir: /usr/bin
97
postgresql_data_dir: /var/lib/pgsql/data
108
- distro: centos6
11-
init: /sbin/init
12-
run_opts: ""
139
postgresql_bin_dir: /usr/bin
1410
postgresql_data_dir: /var/lib/pgsql/data
1511
- distro: ubuntu1604
16-
init: /lib/systemd/systemd
17-
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
1812
postgresql_bin_dir: /usr/lib/postgresql/9.5/bin
1913
postgresql_data_dir: /var/lib/postgresql/9.5/main
2014
- distro: ubuntu1404
21-
init: /sbin/init
22-
run_opts: ""
2315
postgresql_bin_dir: /usr/lib/postgresql/9.3/bin
2416
postgresql_data_dir: /var/lib/postgresql/9.3/main
2517
- distro: debian8
26-
init: /lib/systemd/systemd
27-
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
2818
postgresql_bin_dir: /usr/lib/postgresql/9.4/bin
2919
postgresql_data_dir: /var/lib/postgresql/9.4/main
3020

31-
services:
32-
- docker
33-
34-
before_install:
35-
# Pull container
36-
- 'docker pull geerlingguy/docker-${distro}-ansible:latest'
37-
3821
script:
39-
- container_id=$(mktemp)
40-
# Run container in detached state.
41-
- 'docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"'
42-
43-
# Ansible syntax check.
44-
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check'
22+
# Configure test script so we can run extra tests after playbook is run.
23+
- export container_id=$(date +%s)
24+
- export cleanup=false
4525

46-
# Test role.
47-
- 'docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml'
26+
# Download test shim.
27+
- wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/
28+
- chmod +x ${PWD}/tests/test.sh
4829

49-
# Test role idempotence.
50-
- idempotence=$(mktemp)
51-
- docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml | tee -a ${idempotence}
52-
- >
53-
tail ${idempotence}
54-
| grep -q 'changed=0.*failed=0'
55-
&& (echo 'Idempotence test: pass' && exit 0)
56-
|| (echo 'Idempotence test: fail' && exit 1)
30+
# Run tests.
31+
- ${PWD}/tests/test.sh
5732

5833
# Check PostgreSQL status.
59-
- 'docker exec -u postgres "$(cat ${container_id})" ${postgresql_bin_dir}/pg_ctl -D ${postgresql_data_dir} status'
34+
- 'docker exec -u postgres ${container_id} ${postgresql_bin_dir}/pg_ctl -D ${postgresql_data_dir} status'
6035

6136
after_failure:
6237
# Check what happened on systemd systems.
63-
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm systemctl -l status postgresql.service'
64-
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm journalctl -xe --no-pager'
38+
- 'docker exec --tty ${container_id} env TERM=xterm systemctl -l status postgresql.service'
39+
- 'docker exec --tty ${container_id} env TERM=xterm journalctl -xe --no-pager'
6540

6641
notifications:
6742
webhooks: https://galaxy.ansible.com/api/v1/notifications/
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017 Jeff Geerling
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

provisioning/roles/geerlingguy.postgresql/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,4 @@ MIT / BSD
108108

109109
## Author Information
110110

111-
This role was created in 2016 by [Jeff Geerling](http://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).
111+
This role was created in 2016 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Ansible Role tests
2+
3+
To run the test playbook(s) in this directory:
4+
5+
1. Install and start Docker.
6+
1. Download the test shim (see .travis.yml file for the URL) into `tests/test.sh`:
7+
- `wget -O tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/`
8+
1. Make the test shim executable: `chmod +x tests/test.sh`.
9+
1. Run (from the role root directory) `distro=[distro] playbook=[playbook] ./tests/test.sh`
10+
11+
If you don't want the container to be automatically deleted after the test playbook is run, add the following environment variables: `cleanup=false container_id=$(date +%s)`

provisioning/roles/geerlingguy.postgresql/tests/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
pre_tasks:
1111
- name: Update apt cache.
12-
apt: update_cache=yes
12+
apt: update_cache=yes cache_valid_time=600
1313
when: ansible_os_family == 'Debian'
1414

1515
- name: Set custom variable name for old CentOS 6 PostgreSQL install.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
__postgresql_version: "9.1"
3+
__postgresql_data_dir: "/var/lib/postgresql/{{ __postgresql_version }}/main"
4+
__postgresql_bin_path: "/usr/lib/postgresql/{{ __postgresql_version }}/bin"
5+
__postgresql_config_path: "/etc/postgresql/{{ __postgresql_version }}/main"
6+
__postgresql_daemon: postgresql
7+
__postgresql_packages:
8+
- postgresql
9+
- postgresql-contrib
10+
- libpq-dev

0 commit comments

Comments
 (0)