add timescale installation
This commit is contained in:
parent
09a6d5a3e1
commit
12b319171a
@ -4,17 +4,19 @@ postgres_repo: "https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_
|
|||||||
postgres_version: 13
|
postgres_version: 13
|
||||||
postgis_install: true
|
postgis_install: true
|
||||||
postgis_version: 31
|
postgis_version: 31
|
||||||
|
postgis_version_pakage_name: postgis{{postgis_version}}_{{postgres_version}}
|
||||||
pg_config_listen_addresses: localhost
|
pg_config_listen_addresses: localhost
|
||||||
pg_config_port: 5432
|
pg_config_port: 5432
|
||||||
pg_config_max_connections: 1024
|
pg_config_max_connections: 1024
|
||||||
pg_config_shared_buffers: 2GB
|
pg_config_shared_buffers: 128MB
|
||||||
pg_config_temp_buffers: 8MB
|
pg_config_temp_buffers: 8MB
|
||||||
pg_config_work_mem: 4MB
|
pg_config_work_mem: 4MB
|
||||||
pg_config_max_wal_size: 1GB
|
pg_config_max_wal_size: 1GB
|
||||||
pg_config_min_wal_size: 4G
|
pg_config_min_wal_size: 256MB
|
||||||
pg_config_log_filename: postgresql-%Y-%m-%d_%H%M%S.log
|
pg_config_log_filename: postgresql-%Y-%m-%d_%H%M%S.log
|
||||||
pg_config_timezone: "Europe/Rome"
|
pg_config_timezone: "Europe/Rome"
|
||||||
pg_config_row: ""
|
pg_config_row: ""
|
||||||
|
pg_config_shared_preload_libraries: []
|
||||||
# pg_config_row: |
|
# pg_config_row: |
|
||||||
# max_connections = 200
|
# max_connections = 200
|
||||||
# effective_cache_size = 6GB
|
# effective_cache_size = 6GB
|
||||||
@ -31,7 +33,9 @@ pg_config_row: ""
|
|||||||
# max_parallel_workers_per_gather = 1
|
# max_parallel_workers_per_gather = 1
|
||||||
# max_parallel_workers = 2
|
# max_parallel_workers = 2
|
||||||
# max_parallel_maintenance_workers = 1
|
# max_parallel_maintenance_workers = 1
|
||||||
|
additional_extension:
|
||||||
|
# - postgis
|
||||||
|
- timescale
|
||||||
pg_hba_user_options:
|
pg_hba_user_options:
|
||||||
- contype: host
|
- contype: host
|
||||||
users: all
|
users: all
|
||||||
|
|||||||
@ -1,7 +1,18 @@
|
|||||||
|
- name: Connection Wait
|
||||||
|
hosts: all
|
||||||
|
become: true
|
||||||
|
gather_facts: no
|
||||||
|
tasks:
|
||||||
|
- name: Wait 60 seconds, but only start checking after 15 seconds
|
||||||
|
wait_for_connection:
|
||||||
|
delay: 15
|
||||||
|
timeout: 60
|
||||||
|
|
||||||
- name: prepare
|
- name: prepare
|
||||||
hosts: all
|
hosts: all
|
||||||
become: true
|
become: true
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
- name: prepare | install python3-pip
|
- name: prepare | install python3-pip
|
||||||
dnf:
|
dnf:
|
||||||
name:
|
name:
|
||||||
|
|||||||
16
tasks/extension/postgis.yaml
Normal file
16
tasks/extension/postgis.yaml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
- name: postgres | install | extension | postgis | add powertools repository
|
||||||
|
yum_repository:
|
||||||
|
name: powertools
|
||||||
|
description: Rocky Linux $releasever - PowerTools
|
||||||
|
file: external_repos
|
||||||
|
mirrorlist: https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=PowerTools-$releasever
|
||||||
|
gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
|
||||||
|
enabled: yes
|
||||||
|
|
||||||
|
- name: postgres | install | extension | postgis | enable powertools and install "{{postgis_version_pakage_name}}"
|
||||||
|
dnf:
|
||||||
|
enablerepo: powertools
|
||||||
|
name:
|
||||||
|
- "{{postgis_version_pakage_name}}"
|
||||||
|
state: present
|
||||||
|
when: postgis_install
|
||||||
13
tasks/extension/timescale.yaml
Normal file
13
tasks/extension/timescale.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
- name: postgres | install | extension | timescale | add timescale repo
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: installation/timescale.repo.j2
|
||||||
|
dest: /etc/yum.repos.d/timescale_timescaledb.repo
|
||||||
|
|
||||||
|
- name: postgres | install | install postgresql
|
||||||
|
dnf:
|
||||||
|
name:
|
||||||
|
- timescaledb-2-postgresql-{{postgres_version}}
|
||||||
|
state: present
|
||||||
|
notify:
|
||||||
|
- restart postgreql
|
||||||
@ -1,7 +1,32 @@
|
|||||||
---
|
---
|
||||||
|
- name: Distribution
|
||||||
|
debug:
|
||||||
|
msg: "{{ ansible_distribution }}"
|
||||||
|
|
||||||
|
- name: Distribution version
|
||||||
|
debug:
|
||||||
|
msg: "{{ ansible_distribution_version}}"
|
||||||
|
|
||||||
|
- name: Distribution major version
|
||||||
|
debug:
|
||||||
|
msg: "{{ ansible_distribution_major_version }}"
|
||||||
|
|
||||||
|
- name: postgres | install | postgres pre-install show shared_preload_libraries list
|
||||||
|
debug:
|
||||||
|
msg: "{{ pg_config_shared_preload_libraries + ['timescaledb'] }}"
|
||||||
|
|
||||||
|
- name: postgres | install | timescale pre-install
|
||||||
|
set_fact:
|
||||||
|
pg_config_shared_preload_libraries: "{{ pg_config_shared_preload_libraries + ['timescaledb'] }}"
|
||||||
|
when: '"timescale" in additional_extension'
|
||||||
|
|
||||||
|
- name: postgres | install | postgres pre-install show shared_preload_libraries list
|
||||||
|
debug:
|
||||||
|
msg: "{{ pg_config_shared_preload_libraries }}"
|
||||||
|
|
||||||
- name: postgres | install | install postgres repo
|
- name: postgres | install | install postgres repo
|
||||||
dnf:
|
dnf:
|
||||||
name: 'https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm'
|
name: "https://download.postgresql.org/pub/repos/yum/reporpms/EL-{{ ansible_distribution_major_version }}-x86_64/pgdg-redhat-repo-latest.noarch.rpm"
|
||||||
state: present
|
state: present
|
||||||
disable_gpg_check: yes
|
disable_gpg_check: yes
|
||||||
|
|
||||||
@ -23,19 +48,7 @@
|
|||||||
name: epel-release
|
name: epel-release
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: postgres | install | enabled repo powertools
|
- name: postgres | install | install custom extension
|
||||||
yum_repository:
|
include_tasks: "tasks/extension/{{ item }}.yaml"
|
||||||
name: powertools
|
with_items: "{{ additional_extension }}"
|
||||||
description: Rocky Linux $releasever - PowerTools
|
# when: additional_extension
|
||||||
file: external_repos
|
|
||||||
mirrorlist: https://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=PowerTools-$releasever
|
|
||||||
gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
|
|
||||||
enabled: yes
|
|
||||||
|
|
||||||
- name: postgres | install | install postgis
|
|
||||||
dnf:
|
|
||||||
enablerepo: powertools
|
|
||||||
name:
|
|
||||||
- postgis31_13
|
|
||||||
state: present
|
|
||||||
when: postgis_install
|
|
||||||
10
templates/installation/timescale.repo.j2
Normal file
10
templates/installation/timescale.repo.j2
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[timescale_timescaledb]
|
||||||
|
name=timescale_timescaledb
|
||||||
|
baseurl=https://packagecloud.io/timescale/timescaledb/el/{{ ansible_distribution_major_version }}/$basearch
|
||||||
|
repo_gpgcheck=1
|
||||||
|
gpgcheck=0
|
||||||
|
enabled=1
|
||||||
|
gpgkey=https://packagecloud.io/timescale/timescaledb/gpgkey
|
||||||
|
sslverify=1
|
||||||
|
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
|
||||||
|
metadata_expire=300
|
||||||
@ -710,8 +710,11 @@ lc_time = 'en_US.UTF-8' # locale for time formatting
|
|||||||
default_text_search_config = 'pg_catalog.english'
|
default_text_search_config = 'pg_catalog.english'
|
||||||
|
|
||||||
# - Shared Library Preloading -
|
# - Shared Library Preloading -
|
||||||
|
{% if pg_config_shared_preload_libraries %}
|
||||||
|
shared_preload_libraries = '{{ pg_config_shared_preload_libraries | join(',') }}'
|
||||||
|
{% else %}
|
||||||
#shared_preload_libraries = '' # (change requires restart)
|
#shared_preload_libraries = '' # (change requires restart)
|
||||||
|
{% endif %}
|
||||||
#local_preload_libraries = ''
|
#local_preload_libraries = ''
|
||||||
#session_preload_libraries = ''
|
#session_preload_libraries = ''
|
||||||
#jit_provider = 'llvmjit' # JIT library to use
|
#jit_provider = 'llvmjit' # JIT library to use
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user