From f1971a75b513085b8f03f85ef0b6668b7fb93903 Mon Sep 17 00:00:00 2001 From: Tobias Lehmann Date: Tue, 16 Apr 2024 11:50:28 +0200 Subject: [PATCH] create tasks for cron extension --- playbooks/captica-automation-timescaledb.yml | 21 +++++++++++++++++--- roles/common/tasks/postgres_cron.yml | 13 ++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 roles/common/tasks/postgres_cron.yml diff --git a/playbooks/captica-automation-timescaledb.yml b/playbooks/captica-automation-timescaledb.yml index e96a99c..fed2804 100644 --- a/playbooks/captica-automation-timescaledb.yml +++ b/playbooks/captica-automation-timescaledb.yml @@ -50,8 +50,7 @@ lxc_ip: 192.168.150.130 postgresql_admin_password: captica postgresql_allowed_hosts: - - '192.168.150.1/32' - - '192.168.110.1/32' + - '0.0.0.0/0' timescaledb_database_name: datalogger timescaledb_database_schema: captica timescaledb_database_user: captica @@ -60,4 +59,20 @@ - ansible - root roles: - - timescaledb \ No newline at end of file + - timescaledb + +- hosts: "timescaledb" + vars: + lxc_ip: 192.168.150.130 + postgresql_admin_password: captica + postgresql_allowed_hosts: + - '0.0.0.0/0' + timescaledb_database_name: datalogger + timescaledb_database_schema: captica + timescaledb_database_user: captica + timescaledb_database_password: captica + tools_install_users: + - ansible + - root + tasks: + - import_tasks: "../roles/common/tasks/postgres_cron.yml" \ No newline at end of file diff --git a/roles/common/tasks/postgres_cron.yml b/roles/common/tasks/postgres_cron.yml new file mode 100644 index 0000000..70e6d80 --- /dev/null +++ b/roles/common/tasks/postgres_cron.yml @@ -0,0 +1,13 @@ +- name: "Create pg_cron extension {{ timescaledb_database_name }}" + tags: + - install + - timescaledb_install + - postgres_extension + postgresql_ext: + name: pg_cron + db: "{{ timescaledb_database_name }}" + schema: "{{ timescaledb_database_schema }}" + state: present + login_user: "{{ timescaledb_database_user }}" + login_password: "{{ timescaledb_database_password }}" + login_host: "{{ lxc_ip }}" \ No newline at end of file