aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks/postgres-database-extensions.yml
diff options
context:
space:
mode:
authorPaul B <paul@bonaud.fr>2019-01-25 11:55:41 +0100
committerPaul B <paul@bonaud.fr>2019-01-29 11:42:40 +0100
commit4d626d5a5c05f4676c0a403929de775404f9e63c (patch)
treeec8f117f8368ce22a87e785362839c387a2e3c33 /tasks/postgres-database-extensions.yml
parent2bedf1bbf762903d955e4a76f674799a6acb2258 (diff)
downloadansible-postgresql-role-4d626d5a5c05f4676c0a403929de775404f9e63c.tar.gz
ansible-postgresql-role-4d626d5a5c05f4676c0a403929de775404f9e63c.tar.zst
ansible-postgresql-role-4d626d5a5c05f4676c0a403929de775404f9e63c.zip
feat(extensions): adds creation of extension on databases if needed
Diffstat (limited to 'tasks/postgres-database-extensions.yml')
-rw-r--r--tasks/postgres-database-extensions.yml23
1 files changed, 23 insertions, 0 deletions
diff --git a/tasks/postgres-database-extensions.yml b/tasks/postgres-database-extensions.yml
new file mode 100644
index 0000000..edc4e8d
--- /dev/null
+++ b/tasks/postgres-database-extensions.yml
@@ -0,0 +1,23 @@
1---
2- name: "Install required packages for 'postgres_ext' ansible module"
3 apt:
4 name:
5 - libpq-dev
6 - python-psycopg2
7
8- name: Install system dependencies of extensions
9 apt:
10 name: "{{ postgres_extension.apt_deps | default([]) }}"
11 cache_valid_time: 86400
12
13- name: "CREATE EXTENSION on database {{ postgres_dbname }}"
14 become: true
15 become_user: postgres
16 become_method: su
17 postgresql_ext:
18 name: "{{ postgres_extension_name }}"
19 db: "{{ postgres_dbname }}"
20 port: "{{ postgres_port }}"
21 loop: "{{ postgres_extension.names | default([]) }}"
22 loop_control:
23 loop_var: postgres_extension_name