Skip to content

Commit 2019a5d

Browse files
committed
#2 pgTAP added
1 parent 3476929 commit 2019a5d

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Packer & Ansible templates that sets up a PostgreSQL server with pre-installed a
2020

2121
`postgis` enabled
2222

23+
`pgTAP` enabled
2324

2425
## Requirements
2526
🗹 [Packer](https://www.packer.io/intro/getting-started/install.html)
@@ -69,12 +70,12 @@ $ packer build \
6970
amazon.json
7071
```
7172

72-
Once this is complete, you now have a snapshot available to use for any of your droplets.
73+
Once this is complete, you now have a snapshot or AMI available to use for any of your droplets or EC2 instances respectively.
7374

7475
## Notes on provisioning
7576
1. The PostgreSQL server can be further customised. Available provisioning variables that can be manipulated are found in `ansible/vars.yml`
7677
2. There are also additional provisioning variables from the role [anxs.postgres](https://github.com/ANXS/postgresql). The exhaustive list can be found [here](https://github.com/ANXS/postgresql/blob/master/defaults/main.yml).
7778
3. To be in line with the standards of images found in the Digital Ocean Marketplace, scripts found in `scripts` are also ran to clean up the snapshot and make it compatible with the Marketplace. They are taken from [here](https://github.com/digitalocean/marketplace-partners/tree/master/scripts). More information on what these scripts achieve can be found [here](https://github.com/digitalocean/marketplace-partners/blob/master/getting-started.md).
7879

7980
## Roadmap
80-
🗹 Template for setting up a snapshot on AWS.
81+
🗹 tbc

ansible/tasks/setup-extensions.yml

+27
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,34 @@
1717
update_cache: yes
1818
cache_valid_time: 3600
1919
when: postgresql_version >= 10
20+
21+
- name: pgTAP - download latest releas
22+
get_url:
23+
url: "https://github.com/theory/pgtap/archive/{{ pgtap_release }}.tar.gz"
24+
dest: /tmp
25+
checksum: "{{ pgtap_release_checksum }}"
26+
27+
- name: pgTAP - unpack archive
28+
unarchive:
29+
remote_src: yes
30+
src: /tmp/pgtap-1.1.0.tar.gz
31+
dest: /tmp
32+
become: yes
33+
34+
- name: pgTAP - install
35+
make:
36+
chdir: /tmp/pgtap-1.1.0
37+
target: install
38+
become: yes
2039

40+
- name: Enable pgTAP extension
41+
become: yes
42+
become_user: postgres
43+
postgresql_ext:
44+
name: pgtap
45+
db: postgres
46+
schema: public
47+
2148
- name: Enable pgcrypto extension
2249
become: yes
2350
become_user: postgres

ansible/tasks/setup-system.yml

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- name: Install essentials
1313
apt:
1414
pkg:
15+
- build-essential
1516
- python3
1617
- python3-pip
1718
- ufw

ansible/vars.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@ postgresql_shared_preload_libraries: [pg_stat_statements]
1414
postgresql_pg_hba_custom:
1515
- {type: "host", database: "all", user: "all", address: "0.0.0.0/0", method: "md5" }
1616

17-
postgres_superadmin_password: "a1b2c3d4e5f6g7"
17+
postgres_superadmin_password: "a1b2c3d4e5f6g7"
18+
19+
pgtap_release: v1.1.0
20+
pgtap_release_checksum: sha1:cca57708e723de18735a723b774577dc52f6f31e

0 commit comments

Comments
 (0)