diff --git a/ansible/roles/postgres/tasks/main.yml b/ansible/roles/postgres/tasks/main.yml index fc57945f..d4cf6af7 100644 --- a/ansible/roles/postgres/tasks/main.yml +++ b/ansible/roles/postgres/tasks/main.yml @@ -121,3 +121,6 @@ - role::postgres notify: - Reload the postgres service + +- name: Install and configure pg_repack + include_tasks: pg_repack.yml diff --git a/ansible/roles/postgres/tasks/pg_repack.yml b/ansible/roles/postgres/tasks/pg_repack.yml new file mode 100644 index 00000000..907c83f0 --- /dev/null +++ b/ansible/roles/postgres/tasks/pg_repack.yml @@ -0,0 +1,21 @@ +--- +- name: Install pg_repack + apt: + name: + - postgresql-{{ postgres_version }}-repack + state: present + tags: + - role::postgres + - role::postgres-pg_repack + +- name: Add pg_repack to all databases + become: true + become_user: "{{ postgres_user }}" + community.postgresql.postgresql_ext: + db: "{{ item.name }}" + name: pg_repack + state: present + loop: "{{ postgres_databases }}" + tags: + - role::postgres + - role::postgres-pg_repack