diff options
Diffstat (limited to 'tasks/main.yml')
| -rw-r--r-- | tasks/main.yml | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/tasks/main.yml b/tasks/main.yml index dd3dd98..cf8d734 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -28,7 +28,31 @@ follow: false - name: Write pgpass for 'root' copy: - content: '{{postgres_pgpass}}' + content: | + # hostname:port:database:username:password + *:*:*:postgres:{{postgres_passwd}} dest: '/root/.pgpass' mode: '0600' - when: postgres_pgpass is defined + when: postgres_passwd is defined +- name: Check if Netdata is installed + stat: + path: /opt/netdata + register: nd +- name: Write postgres configuration for Netdata + copy: + content: | + socket: + name: 'local' + user: 'postgres' + database: 'postgres' + {% if postgres_passwd is defined %}password: {{postgres_passwd}} + {% endif %} + mode: '0600' + dest: /opt/netdata/etc/netdata/python.d/postgres.conf + owner: 'netdata' + when: nd is defined and nd.stat.exists +- name: Install the required python modules + apk: + name: py3-psycopg2 + state: present + when: nd is defined and nd.stat.exists |
