Use 'creates' and specify postgresql_version per environment
This commit is contained in:
parent
7885de776c
commit
f11126df9f
|
@ -1,5 +1,4 @@
|
||||||
# vim: ft=yaml.ansible
|
# vim: ft=yaml.ansible
|
||||||
# code: language=ansible
|
# code: language=ansible
|
||||||
---
|
---
|
||||||
postgresql_version: 14
|
|
||||||
postgresql_pgdata: "{{ encrypted_fs }}/pgsql/{{ postgresql_version }}/data"
|
postgresql_pgdata: "{{ encrypted_fs }}/pgsql/{{ postgresql_version }}/data"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# vim: ft=yaml.ansible
|
# vim: ft=yaml.ansible
|
||||||
# code: language=ansible
|
# code: language=ansible
|
||||||
---
|
---
|
||||||
|
postgresql_version: 14
|
||||||
|
|
||||||
db_passwords:
|
db_passwords:
|
||||||
nextcloud: "{{ vault_db_passwords.nextcloud }}"
|
nextcloud: "{{ vault_db_passwords.nextcloud }}"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# vim: ft=yaml.ansible
|
# vim: ft=yaml.ansible
|
||||||
# code: language=ansible
|
# code: language=ansible
|
||||||
---
|
---
|
||||||
|
postgresql_version: 14
|
||||||
|
|
||||||
db_passwords:
|
db_passwords:
|
||||||
nextcloud: "{{ vault_db_passwords.nextcloud }}"
|
nextcloud: "{{ vault_db_passwords.nextcloud }}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# vim: ft=yaml.ansible
|
# vim: ft=yaml.ansible
|
||||||
# code: language=ansible
|
# code: language=ansible
|
||||||
---
|
---
|
||||||
postgresql_version: 14
|
postgresql_version: 16
|
||||||
postgresql_pgdata_default: /var/lib/pgsql/{{ postgresql_version }}/data
|
postgresql_pgdata_default: /var/lib/pgsql/{{ postgresql_version }}/data
|
||||||
postgresql_pgdata: "{{ postgresql_pgdata_default }}"
|
postgresql_pgdata: "{{ postgresql_pgdata_default }}"
|
||||||
postgresql_service: postgresql-{{ postgresql_version }}
|
postgresql_service: postgresql-{{ postgresql_version }}
|
||||||
|
|
|
@ -42,16 +42,10 @@
|
||||||
- name: Flush handlers
|
- name: Flush handlers
|
||||||
ansible.builtin.meta: flush_handlers
|
ansible.builtin.meta: flush_handlers
|
||||||
|
|
||||||
- name: Check if pgdata directory is initialized
|
|
||||||
ansible.builtin.stat:
|
|
||||||
path: "{{ postgresql_pgdata }}/base"
|
|
||||||
register: pgdata_stat
|
|
||||||
failed_when: false
|
|
||||||
|
|
||||||
- name: Initialize database
|
- name: Initialize database
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: /usr/pgsql-{{ postgresql_version }}/bin/postgresql-{{ postgresql_version }}-setup initdb
|
cmd: /usr/pgsql-{{ postgresql_version }}/bin/postgresql-{{ postgresql_version }}-setup initdb
|
||||||
when: pgdata_stat.stat.isdir is not defined or not pgdata_stat.stat.isdir
|
creates: "{{ postgresql_pgdata }}/base"
|
||||||
|
|
||||||
- name: Ensure PostgreSQL is enabled and running
|
- name: Ensure PostgreSQL is enabled and running
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
|
|
Loading…
Reference in a new issue