aboutsummaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2021-04-29 20:23:58 +0200
committerRomain Gonçalves <me@rgoncalves.se>2021-04-29 20:23:58 +0200
commit53d2e322aac5295ad39f600c641c41240c801c87 (patch)
treead08951ebd2b1d09dc2e97eb0f036274e4721ed3 /roles
parent51db8d702d618b3205fe07ed585872fb35e2e083 (diff)
downloadinfrastructure-53d2e322aac5295ad39f600c641c41240c801c87.tar.gz
roles/postgres: Bypass become fail
Diffstat (limited to 'roles')
-rw-r--r--roles/postgres/tasks/main.yml6
1 files changed, 4 insertions, 2 deletions
diff --git a/roles/postgres/tasks/main.yml b/roles/postgres/tasks/main.yml
index ecf8e5f..16fce30 100644
--- a/roles/postgres/tasks/main.yml
+++ b/roles/postgres/tasks/main.yml
@@ -58,10 +58,12 @@
- name: init postgres database
shell: |
initdb -D "{{ postgres_dir }}/data/" -U "{{ postgres_dbuser }}" --encoding=UTF-8 --locale=en_US.UTF-8 {# --auth=scram-sha-256 --pwprompt #}
+ su - _postgresql -c \
+ 'initdb -D "{{ postgres_dir }}/data/" -U "{{ postgres_dbuser }}" \
+ --encoding=UTF-8 \
+ --locale=en_US.UTF-8'
args:
chdir: "{{ postgres_dir }}"
- become: true
- become_user: "{{ postgres_user }}"
register: result
failed_when: result.rc != 0 and result.stderr is defined and "exists but is not empty" not in result.stderr
remember that computers suck.