create tasks for cron extension
This commit is contained in:
parent
3824a3fe62
commit
9f6ea29148
@ -1,12 +1,58 @@
|
|||||||
- name: "Create pg_cron extension {{ timescaledb_database_name }}"
|
- name: "Install postgresql-{{ postgresql_version }}-cron"
|
||||||
tags:
|
tags:
|
||||||
- install
|
- install
|
||||||
- timescaledb_install
|
- timescaledb_install
|
||||||
- postgres_extension
|
apt:
|
||||||
postgresql_ext:
|
pkg:
|
||||||
name: pg_cron
|
- "postgresql-{{ postgresql_version }}-cron"
|
||||||
db: "{{ timescaledb_database_name }}"
|
state: latest
|
||||||
state: present
|
update_cache: yes
|
||||||
|
|
||||||
|
- name: "Add pg_cron to shared_preload_libraries"
|
||||||
|
tags:
|
||||||
|
- install
|
||||||
|
- timescaledb_install
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/postgresql/{{ postgresql_version }}/main/postgresql.conf
|
||||||
|
regexp: "^shared_preload_libraries = 'timescaledb'"
|
||||||
|
line: "shared_preload_libraries = 'timescaledb,pg_cron'"
|
||||||
|
|
||||||
|
- name: "Define cron database name"
|
||||||
|
tags:
|
||||||
|
- install
|
||||||
|
- timescaledb_install
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/postgresql/{{ postgresql_version }}/main/postgresql.conf
|
||||||
|
line: "cron.database_name = '{{ timescaledb_database_name }}'"
|
||||||
|
|
||||||
|
- name: "Define cron database name"
|
||||||
|
tags:
|
||||||
|
- install
|
||||||
|
- timescaledb_install
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/postgresql/{{ postgresql_version }}/main/postgresql.conf
|
||||||
|
line: "cron.timezone = 'Europe/Berlin'"
|
||||||
|
|
||||||
|
- name: "Restart postgresql service"
|
||||||
|
tags:
|
||||||
|
- install
|
||||||
|
- timescaledb_install
|
||||||
|
systemd:
|
||||||
|
name: postgresql
|
||||||
|
state: restarted
|
||||||
|
|
||||||
|
- postgresql_query:
|
||||||
|
db: {{ timescaledb_database_name }}
|
||||||
login_user: postgres
|
login_user: postgres
|
||||||
login_password: "{{ postgresql_admin_password }}"
|
login_password: {{ postgresql_admin_password }}
|
||||||
login_host: "{{ lxc_ip }}"
|
query:
|
||||||
|
- CREATE EXTENSION pg_cron;
|
||||||
|
- GRANT USAGE ON SCHEMA cron TO {{ timescaledb_database_user }};
|
||||||
|
|
||||||
|
- name: "Restart postgresql service"
|
||||||
|
tags:
|
||||||
|
- install
|
||||||
|
- timescaledb_install
|
||||||
|
systemd:
|
||||||
|
name: postgresql
|
||||||
|
state: restarted
|
||||||
Loading…
Reference in New Issue
Block a user