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"
|
|
|
|
|
|
|
|
- name: "set the version variables"
|
|
|
|
ansible.builtin.import_role:
|
2022-12-18 19:36:21 +01:00
|
|
|
name: "services/deploy/include"
|
2022-12-16 23:42:57 +01:00
|
|
|
vars_from: "versions"
|
|
|
|
|
|
|
|
- block:
|
|
|
|
|
|
|
|
- name: "configure postgres password"
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "./postgres/database.password.j2"
|
|
|
|
dest: "{{ services_service_user_home }}/.config/{{ services_service_user_name }}/database.password"
|
|
|
|
mode: 0600
|
|
|
|
register: services_deploy_database_password_file
|
|
|
|
|
|
|
|
- name: "configure systemd service"
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "./systemd/{{ item }}.j2"
|
|
|
|
dest: "{{ services_service_user_home }}/.config/systemd/user/{{ item }}"
|
2022-12-17 00:39:25 +01:00
|
|
|
mode: 0600
|
2022-12-16 23:42:57 +01:00
|
|
|
loop:
|
|
|
|
- "pod-database.service"
|
|
|
|
- "container-database-postgres.service"
|
|
|
|
register: services_deploy_database_systemd_files
|
|
|
|
|
|
|
|
- name: "systemd user daemon reload"
|
|
|
|
ansible.builtin.systemd:
|
|
|
|
daemon_reload: true
|
|
|
|
scope: "user"
|
|
|
|
when:
|
|
|
|
services_deploy_database_systemd_files.changed
|
|
|
|
|
|
|
|
- name: "enable the service"
|
|
|
|
ansible.builtin.systemd:
|
|
|
|
name: "pod-{{ services_service_name }}.service"
|
|
|
|
enabled: true
|
|
|
|
scope: "user"
|
|
|
|
|
|
|
|
- name: "start the service"
|
|
|
|
ansible.builtin.systemd:
|
|
|
|
name: "pod-{{ services_service_name }}.service"
|
|
|
|
state: "started"
|
|
|
|
scope: "user"
|
|
|
|
register: services_deploy_database_service_start
|
|
|
|
|
|
|
|
- name: "restart the service"
|
|
|
|
ansible.builtin.systemd:
|
|
|
|
name: "pod-{{ services_service_name }}.service"
|
2022-12-17 00:39:25 +01:00
|
|
|
state: "restarted"
|
|
|
|
scope: "user"
|
2022-12-16 23:42:57 +01:00
|
|
|
when:
|
|
|
|
(services_deploy_database_password_file.changed or
|
|
|
|
services_deploy_database_systemd_files.changed) and
|
|
|
|
not services_deploy_database_service_start.changed
|
|
|
|
|
|
|
|
become_user: "{{ services_service_user_name }}"
|