From 7a071552375f727678db742666fa06bfbf28db92 Mon Sep 17 00:00:00 2001 From: Jeltz Date: Wed, 10 Mar 2021 13:35:18 +0100 Subject: [PATCH] Install python3-psycopg2 (required by Ansible) --- roles/postgresql_server/tasks/main.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/roles/postgresql_server/tasks/main.yml b/roles/postgresql_server/tasks/main.yml index 6748c04..f4f3909 100644 --- a/roles/postgresql_server/tasks/main.yml +++ b/roles/postgresql_server/tasks/main.yml @@ -1,8 +1,10 @@ --- -- name: Install postgresql +- name: Install postgresql and psycopg2 apt: update_cache: true - name: postgresql + pkg: + - postgresql + - python3-psycopg2 state: present register: apt_result retries: 3 @@ -39,11 +41,15 @@ - restart postgresql - name: Create databases + become: true + become_user: postgres postgresql_db: - name: "{{ item.name }}" + name: "{{ item }}" loop: "{{ postgresql_databases }}" - name: Create users + become: true + become_user: postgres postgresql_user: db: "{{ item.database }}" name: "{{ item.name }}"