From aa91d89bce93a49317bb20edecf37e2672eacb64 Mon Sep 17 00:00:00 2001 From: tomleb Date: Sun, 7 May 2017 21:44:36 -0400 Subject: [PATCH] Add .pgpass file to avoid entering db password --- deploy/ansible/roles/postgresql/tasks/main.yml | 6 ++++++ deploy/ansible/roles/postgresql/templates/pgpass.j2 | 1 + 2 files changed, 7 insertions(+) create mode 100644 deploy/ansible/roles/postgresql/templates/pgpass.j2 diff --git a/deploy/ansible/roles/postgresql/tasks/main.yml b/deploy/ansible/roles/postgresql/tasks/main.yml index d540d746..6ecceceb 100644 --- a/deploy/ansible/roles/postgresql/tasks/main.yml +++ b/deploy/ansible/roles/postgresql/tasks/main.yml @@ -56,6 +56,12 @@ become: true become_user: postgres +- name: Add .pgpass + template: + src: pgpass.j2 + dest: ~/.pgpass + mode: 0600 + - name: Reload postgres systemd: name: postgresql diff --git a/deploy/ansible/roles/postgresql/templates/pgpass.j2 b/deploy/ansible/roles/postgresql/templates/pgpass.j2 new file mode 100644 index 00000000..c4fd452e --- /dev/null +++ b/deploy/ansible/roles/postgresql/templates/pgpass.j2 @@ -0,0 +1 @@ +localhost:5432:{{ nyaapantsu_dbname }}:{{ nyaapantsu_user }}:{{ nyaapantsu_password }}