cleanup
This commit is contained in:
parent
ad3a53bed7
commit
e340d11ad5
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Restart PostgreSQL
|
- name: Restart PostgreSQL
|
||||||
service:
|
ansible.builtin.service:
|
||||||
name: postgres
|
name: postgres
|
||||||
state: restarted
|
state: restarted
|
||||||
daemon_reload: True
|
daemon_reload: True
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
---
|
---
|
||||||
- block:
|
- name: Create network specs
|
||||||
- name: Create network specs
|
ansible.builtin.template:
|
||||||
template:
|
|
||||||
src: etc/containers/systemd/postgres.network.j2
|
src: etc/containers/systemd/postgres.network.j2
|
||||||
dest: "/etc/containers/systemd/postgres.network"
|
dest: "/etc/containers/systemd/postgres.network"
|
||||||
owner: root
|
owner: root
|
||||||
@ -10,7 +9,7 @@
|
|||||||
when: postgres_network | splitext | last == ".network"
|
when: postgres_network | splitext | last == ".network"
|
||||||
notify: __postgres_restart
|
notify: __postgres_restart
|
||||||
|
|
||||||
- name: Create container volumes
|
- name: Create container volumes
|
||||||
containers.podman.podman_volume:
|
containers.podman.podman_volume:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.name }}"
|
||||||
options: "{{ item.options | default(omit) }}"
|
options: "{{ item.options | default(omit) }}"
|
||||||
@ -21,12 +20,12 @@
|
|||||||
when: item.type | default("volume") | lower == "volume"
|
when: item.type | default("volume") | lower == "volume"
|
||||||
register: __postgres_volumes_raw
|
register: __postgres_volumes_raw
|
||||||
|
|
||||||
- name: Register container volumes map
|
- name: Register container volumes map
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
__postgres_volumes_map: "{{ __postgres_volumes_raw.results | json_query('[].volume') | items2dict(key_name='Name', value_name='Mountpoint') }}"
|
__postgres_volumes_map: "{{ __postgres_volumes_raw.results | json_query('[].volume') | items2dict(key_name='Name', value_name='Mountpoint') }}"
|
||||||
|
|
||||||
- name: Deploy postgres env files
|
- name: Deploy postgres env files
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: "etc/containers/systemd/{{ item }}.j2"
|
src: "etc/containers/systemd/{{ item }}.j2"
|
||||||
dest: "/etc/containers/systemd/{{ item }}"
|
dest: "/etc/containers/systemd/{{ item }}"
|
||||||
owner: root
|
owner: root
|
||||||
@ -37,8 +36,8 @@
|
|||||||
- postgres.sys.env
|
- postgres.sys.env
|
||||||
notify: __postgres_restart
|
notify: __postgres_restart
|
||||||
|
|
||||||
- name: Create container specs
|
- name: Create container specs
|
||||||
template:
|
ansible.builtin.template:
|
||||||
src: etc/containers/systemd/postgres.container.j2
|
src: etc/containers/systemd/postgres.container.j2
|
||||||
dest: "/etc/containers/systemd/postgres.container"
|
dest: "/etc/containers/systemd/postgres.container"
|
||||||
owner: root
|
owner: root
|
||||||
@ -46,7 +45,7 @@
|
|||||||
mode: "0640"
|
mode: "0640"
|
||||||
notify: __postgres_restart
|
notify: __postgres_restart
|
||||||
|
|
||||||
- name: Deploy init-user-db
|
- name: Deploy init-user-db
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: init-user-db.sh
|
src: init-user-db.sh
|
||||||
dest: "{{ __postgres_volumes_map['postgres-initdb'] }}"
|
dest: "{{ __postgres_volumes_map['postgres-initdb'] }}"
|
||||||
@ -55,11 +54,9 @@
|
|||||||
mode: "0644"
|
mode: "0644"
|
||||||
when: "'postgres-initdb' in __postgres_volumes_map"
|
when: "'postgres-initdb' in __postgres_volumes_map"
|
||||||
|
|
||||||
- name: Ensure service state
|
- name: Ensure service state
|
||||||
systemd:
|
ansible.builtin.service:
|
||||||
name: "postgres.service"
|
name: "postgres.service"
|
||||||
state: started
|
state: started
|
||||||
daemon_reload: True
|
daemon_reload: True
|
||||||
enabled: True
|
enabled: True
|
||||||
become: True
|
|
||||||
become_user: root
|
|
||||||
|
Loading…
Reference in New Issue
Block a user