Fix database deploy idempotency
This commit is contained in:
parent
00b0ccf4cb
commit
4340b894aa
@ -4,6 +4,25 @@
|
||||
name: "services/include"
|
||||
vars_from: "user"
|
||||
|
||||
- name: "stat the pgadmin password file"
|
||||
ansible.builtin.stat:
|
||||
path: "{{ services_service_user_home }}/.config/service/pgadmin.password"
|
||||
register: services_deploy_database_pgadmin_password_file_stat
|
||||
|
||||
- name: "configure pgadmin password"
|
||||
ansible.builtin.template:
|
||||
src: "./pgadmin/pgadmin.password"
|
||||
dest: "{{ services_service_user_home }}/.config/service/pgadmin.password"
|
||||
mode: 0600
|
||||
# Being root allows ansible to read the file, determine the diff, and preserve the uid:gid.
|
||||
become_user: "\
|
||||
{% if services_deploy_database_pgadmin_password_file_stat.stat.exists %}\
|
||||
root\
|
||||
{% else %}\
|
||||
{{ services_service_user_name }}\
|
||||
{% endif %}"
|
||||
register: services_deploy_database_pgadmin_password_file
|
||||
|
||||
- block:
|
||||
|
||||
- name: "configure postgres password"
|
||||
@ -13,13 +32,6 @@
|
||||
mode: 0600
|
||||
register: services_deploy_database_postgres_password_file
|
||||
|
||||
- name: "configure pgadmin password"
|
||||
ansible.builtin.template:
|
||||
src: "./pgadmin/pgadmin.password"
|
||||
dest: "{{ services_service_user_home }}/.config/service/pgadmin.password"
|
||||
mode: 0600
|
||||
register: services_deploy_database_pgadmin_password_file
|
||||
|
||||
- name: "configure systemd service"
|
||||
ansible.builtin.template:
|
||||
src: "./systemd/{{ item }}"
|
||||
|
Loading…
Reference in New Issue
Block a user