ansible-edda/playbooks/roles/services/deploy/database/tasks/main.yml

45 lines
1.5 KiB
YAML
Raw Normal View History

2022-12-18 23:43:40 +01:00
---
2022-12-16 23:42:57 +01:00
- name: "set the user variables"
ansible.builtin.import_role:
2022-12-18 19:36:21 +01:00
name: "services/include"
2022-12-16 23:42:57 +01:00
vars_from: "user"
2023-08-17 21:46:38 +02:00
- 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
2022-12-16 23:42:57 +01:00
- block:
- name: "configure postgres password"
ansible.builtin.template:
2023-07-08 10:04:37 +02:00
src: "./postgres/database.password"
dest: "{{ services_service_user_home }}/.config/service/database.password"
2022-12-16 23:42:57 +01:00
mode: 0600
2023-08-17 17:09:30 +02:00
register: services_deploy_database_postgres_password_file
2022-12-16 23:42:57 +01:00
become_user: "{{ services_service_user_name }}"
2023-11-11 21:54:08 +01:00
- name: "{{ services_service_name }} : configure systemd service"
ansible.builtin.include_role:
name: "services/deploy/pod"
vars:
services_deploy_pod_needs_restart: "{{
services_deploy_database_postgres_password_file.changed or
services_deploy_database_pgadmin_password_file.changed
}}"