create tasks for cron extension

This commit is contained in:
Tobias Lehmann 2024-04-16 13:52:02 +02:00
parent d7b18ef1a1
commit 2886fc012f

View File

@ -8,6 +8,14 @@
state: latest state: latest
update_cache: yes update_cache: yes
- name: "Stop postgresql service"
tags:
- install
- timescaledb_install
systemd:
name: postgresql
state: stop
- name: "Add pg_cron to shared_preload_libraries" - name: "Add pg_cron to shared_preload_libraries"
tags: tags:
- install - install
@ -25,7 +33,7 @@
dest: /etc/postgresql/{{ postgresql_version }}/main/postgresql.conf dest: /etc/postgresql/{{ postgresql_version }}/main/postgresql.conf
line: "cron.database_name = '{{ timescaledb_database_name }}'" line: "cron.database_name = '{{ timescaledb_database_name }}'"
- name: "Define cron database name" - name: "Define cron timezone"
tags: tags:
- install - install
- timescaledb_install - timescaledb_install
@ -47,11 +55,11 @@
- timescaledb_install - timescaledb_install
postgresql_query: postgresql_query:
db: "{{ timescaledb_database_name }}" db: "{{ timescaledb_database_name }}"
login_user: "postgres" login_user: "{{ timescaledb_database_user }}"
login_password: "{{ postgresql_admin_password }}" login_password: "{{ timescaledb_database_password }}"
login_host: "{{ lxc_ip }}"
query: query:
- CREATE EXTENSION pg_cron; - CREATE EXTENSION pg_cron;
- GRANT USAGE ON SCHEMA cron TO {{ timescaledb_database_user }};
- name: "Restart postgresql service" - name: "Restart postgresql service"
tags: tags: