-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
14fe38c
commit 134951f
Showing
7 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
--- | ||
- name: Set installation facts | ||
ansible.builtin.include_tasks: vars.yml | ||
|
||
- name: Restart PostgreSQL | ||
ansible.builtin.service: | ||
name: "{{ _postgresql_service }}" | ||
state: "restarted" | ||
listen: postgresql_restart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
- name: Set configuration facts | ||
ansible.builtin.set_fact: | ||
_postgresql_datadir: "{{ _postgresql_config.data_directory }}" | ||
_postgresql_hba: "{{ _postgresql_config.hba_file }}" | ||
_postgresql_ident: "{{ _postgresql_config.ident_file }}" | ||
|
||
- name: Create PostgreSQL data directory | ||
ansible.builtin.file: | ||
path: "{{ _postgresql_datadir }}" | ||
owner: "{{ postgresql_user }}" | ||
group: "{{ postgresql_group }}" | ||
state: directory | ||
mode: "0700" | ||
|
||
- name: Check if PostgreSQL database is initialized | ||
ansible.builtin.stat: | ||
path: "{{ _postgresql_datadir }}/PG_VERSION" | ||
register: pgdatadir_stat | ||
|
||
- name: Ensure PostgreSQL database is initialized | ||
Check failure on line 21 in tasks/configure.yml GitHub Actions / lintno-changed-when
Check failure on line 21 in tasks/configure.yml GitHub Actions / molecule (install, ubuntu2204, /lib/systemd/systemd)no-changed-when
Check failure on line 21 in tasks/configure.yml GitHub Actions / molecule (install, ubuntu2004, /lib/systemd/systemd)no-changed-when
Check failure on line 21 in tasks/configure.yml GitHub Actions / molecule (install, debian12, /lib/systemd/systemd)no-changed-when
Check failure on line 21 in tasks/configure.yml GitHub Actions / molecule (install, debian11, /lib/systemd/systemd)no-changed-when
|
||
ansible.builtin.command: "/usr/bin/initdb -D {{ _postgresql_datadir }}" | ||
when: not pgdatadir_stat.stat.exists | ||
become: true | ||
become_user: "{{ postgresql_user }}" | ||
|
||
- name: Set PostgreSQL environment variables | ||
ansible.builtin.template: | ||
src: postgres.sh.j2 | ||
dest: /etc/profile.d/postgres.sh | ||
mode: "0644" | ||
notify: Restart postgresql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
- name: Check datadir configuration | ||
ansible.builtin.assert: | ||
that: | ||
- _hba_attr in _postgresql_config | ||
- _postgresql_config[_datadir_attr] == _postgresql_datadir | ||
fail_msg: postgresql_datadir attribute must match requested configuration | ||
vars: | ||
_hba_attr: hba_file | ||
_datadir_attr: data_directory | ||
_ident_attr: ident_file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export PGDATA={{ _postgresql_datadir }} |