From 76d3ead677c64cb9f14c8853154ce2fb3f1c5f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bompard?= Date: Tue, 10 Aug 2021 10:37:06 +0200 Subject: [PATCH] Deploy TimescaleDB on staging datanommer DB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Aurélien Bompard --- roles/postgresql_server/tasks/datanommer.yml | 51 ++++++++++++++++++++ roles/postgresql_server/tasks/main.yml | 3 ++ 2 files changed, 54 insertions(+) create mode 100644 roles/postgresql_server/tasks/datanommer.yml diff --git a/roles/postgresql_server/tasks/datanommer.yml b/roles/postgresql_server/tasks/datanommer.yml new file mode 100644 index 0000000000..74fb00db7c --- /dev/null +++ b/roles/postgresql_server/tasks/datanommer.yml @@ -0,0 +1,51 @@ +# Use a custom module until TimescaleDB is available in EPEL +# https://bugzilla.redhat.com/show_bug.cgi?id=1987790 +- name: Install the timescaledb repo + copy: + dest: /etc/yum.repos.d/timescaledb.repo + content: | + [timescaledb] + name = Copr modules repo for timescaledb + baseurl = https://download.copr.fedorainfracloud.org/results/abompard/timescaledb/modules/epel-8-$basearch+timescaledb-master-20210730083523/latest/$basearch + gpgcheck=0 + gpgkey=https://download.copr.fedorainfracloud.org/results/abompard/timescaledb/pubkey.gpg + repo_gpgcheck=0 + enabled = 1 + tags: + - postgresql + - timescaledb + when: ansible_distribution_major_version|int >= 8 and ansible_distribution == 'RedHat' +# +- name: Install the timescaledb module + copy: + dest: /etc/dnf/modules.d/timescaledb.module + content: | + [timescaledb] + name=timescaledb + stream=master + profiles= + state=enabled + tags: + - postgresql + - timescaledb + when: ansible_distribution_major_version|int >= 8 and ansible_distribution == 'RedHat' + +- name: Install timescaledb + dnf: + name: + - timescaledb + state: present + tags: + - postgresql + - timescaledb + +- name: Add timescaledb to postgresql config + lineinfile: + path: /var/lib/pgsql/data/postgresql.conf + regexp: ^shared_preload_libraries = + line: "shared_preload_libraries = 'timescaledb'" + notify: + - restart postgresql + tags: + - postgresql + - timescaledb diff --git a/roles/postgresql_server/tasks/main.yml b/roles/postgresql_server/tasks/main.yml index 340f8c0e16..020f1ad8d1 100644 --- a/roles/postgresql_server/tasks/main.yml +++ b/roles/postgresql_server/tasks/main.yml @@ -209,3 +209,6 @@ - postgresql - SAR - GBDR + +- include_tasks: datanommer.yml + when: inventory_hostname.startswith('db-datanommer01') and env == "staging"