aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/pgBadger.sh.j2
diff options
context:
space:
mode:
authorPaul B <paul.bonaud@capitainetrain.com>2018-08-31 11:49:09 +0200
committerPaul B <paul.bonaud@capitainetrain.com>2018-08-31 12:00:24 +0200
commitd0bc90e08c29e881c388c6803ed9c49dff1f1776 (patch)
treee5f633a7461f3d339ef89758fc7bb3f1b91563d3 /templates/pgBadger.sh.j2
downloadansible-postgresql-role-d0bc90e08c29e881c388c6803ed9c49dff1f1776.tar.gz
ansible-postgresql-role-d0bc90e08c29e881c388c6803ed9c49dff1f1776.tar.zst
ansible-postgresql-role-d0bc90e08c29e881c388c6803ed9c49dff1f1776.zip
Initial commit open sourcing Postgresql Ansible role1.0.0
Diffstat (limited to 'templates/pgBadger.sh.j2')
-rw-r--r--templates/pgBadger.sh.j210
1 files changed, 10 insertions, 0 deletions
diff --git a/templates/pgBadger.sh.j2 b/templates/pgBadger.sh.j2
new file mode 100644
index 0000000..93a2247
--- /dev/null
+++ b/templates/pgBadger.sh.j2
@@ -0,0 +1,10 @@
1#!/bin/bash
2# {{ ansible_managed }}
3
4{% for cluster in postgres_clusters %}
5install --mode=0644 --owner=pgbadger {{ postgres_log_dir | default("/var/log/postgresql") }}/postgresql-{{ cluster.version }}-{{ cluster.name }}.log.1 ~pgbadger/
6sudo -H -u pgbadger scp ~pgbadger/postgresql-{{ cluster.version }}-{{ cluster.name }}.log.1 {{Ā postgres_pgbadger_server }}:postgresql-{{ ansible_nodename }}-{{ cluster.version }}-{{ cluster.name }}.log.1
7sudo -H -u pgbadger ssh {{Ā postgres_pgbadger_server }} ./update.sh {{ ansible_nodename }}-{{ cluster.version }}-{{ cluster.name }}
8{% else %}
9# No servers are configured for sending logs to pgbadger
10{% endfor %}