Adding pgpass file for postgres, vagrant, and root user

parent 2a3c40dd
...@@ -12,7 +12,9 @@ ...@@ -12,7 +12,9 @@
become: true become: true
become_user: postgres become_user: postgres
- name: create password file on vagrant box - name: create password file on vagrant box for postgres user
become: true
become_user: postgres
lineinfile: lineinfile:
dest: ~/.pgpass dest: ~/.pgpass
state: present state: present
...@@ -22,3 +24,29 @@ ...@@ -22,3 +24,29 @@
with_items: with_items:
- "#hostname:port:database:username:password" - "#hostname:port:database:username:password"
- "localhost:5432:{{ db_name }}:{{ db_user }}:{{ db_user_pw }}" - "localhost:5432:{{ db_name }}:{{ db_user }}:{{ db_user_pw }}"
- name: create password file on vagrant box for vagrant user
become: true
become_user: vagrant
lineinfile:
dest: ~/.pgpass
state: present
create: yes
line: "{{ item }}"
mode: 0600
with_items:
- "#hostname:port:database:username:password"
- "localhost:5432:{{ db_name }}:{{ db_user }}:{{ db_user_pw }}"
- name: create password file on vagrant box for root user
become: true
become_user: root
lineinfile:
dest: ~/.pgpass
state: present
create: yes
line: "{{ item }}"
mode: 0600
with_items:
- "#hostname:port:database:username:password"
- "localhost:5432:{{ db_name }}:{{ db_user }}:{{ db_user_pw }}"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment