-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
177 changed files
with
4,368 additions
and
3,178 deletions.
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
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,74 +1,118 @@ | ||
--- | ||
# postgres settings | ||
os: "" | ||
pg_type: PG | ||
pg_version: 12 | ||
pg_ssl: true | ||
|
||
force_initdb: false | ||
use_hostname: false | ||
|
||
pass_dir: "~/.edb" | ||
|
||
pg_wal: "" | ||
pg_data: "/var/lib/pgsql/{{ pg_version }}/data" | ||
pg_default_data: "/var/lib/pgsql/{{ pg_version }}/data" | ||
pg_encoding: "" | ||
|
||
# log directory and filename | ||
pg_log: "/var/log/postgres" | ||
pg_log_filename: "postgresql-%a.log" | ||
|
||
# postgres service | ||
pg_service: "postgresql-{{ pg_version }}" | ||
|
||
# required & optional directories | ||
pg_user_home: "/var/lib/pgsql" | ||
pg_bin_path: "/usr/pgsql-{{ pg_version }}/bin" | ||
pg_initdb: "{{ pg_bin_path }}/postgresql-{{ pg_version }}-setup initdb" | ||
pg_initdb_options: "--encoding=UTF-8 --locale=en_US.UTF-8 --auth=peer --auth-local=scram-sha-256 --auth-host=scram-sha-256 --data-checksums" | ||
|
||
# unix socket domain directories | ||
pg_unix_socket_directories: | ||
# Postgres Settings | ||
OS: "" | ||
PG_TYPE: "PG" | ||
PG_VERSION: "12" | ||
PG_SSL: True | ||
PG_SSL_DIR: "/etc/edb/certs" | ||
PG_SSL_GENERATE: True | ||
|
||
FORCE_INITIALIZE: false | ||
USE_HOSTNAME: False | ||
|
||
USER_HOMEDIR: "~/" | ||
|
||
PG_WAL: "" | ||
PG_DATA: "/var/lib/pgsql/{{ PG_VERSION }}/data" | ||
PG_DEFAULT_DATA: "/var/lib/pgsql/{{ PG_VERSION }}/data" | ||
PG_ENCODING: "UTF-8" | ||
# Encoding details | ||
PG_LOCALE: "en_US" | ||
PG_CTYPE: "{{ postgresql_ctype_parts | join('.') }}" | ||
|
||
# Log directory and Filename | ||
PG_LOG: "/var/log/postgres" | ||
PG_LOG_FILENAME: "postgresql-%a.log" | ||
|
||
# Databases | ||
PG_DATABASES: [] | ||
# List of Databases Example | ||
#PG_DATABASES: | ||
# - name: pgdatabase | ||
|
||
# Users | ||
PG_USERS: [] | ||
# List of Users Example | ||
#PG_USERS: | ||
#- name: pg1 | ||
# pass: pg1 | ||
# encrypted: yes | ||
|
||
# Postgres Service | ||
PG_SERVICE: "postgresql-{{ PG_VERSION }}" | ||
|
||
# Required & optional directories | ||
PG_USER_HOME: "/var/lib/pgsql" | ||
PG_BIN_PATH: "/usr/pgsql-{{ PG_VERSION }}/bin" | ||
PG_INITDB: "{{ PG_BIN_PATH }}/initdb --auth=peer --auth-host=scram-sha-256" | ||
PG_INITDB_OPTIONS: " --data-checksums " | ||
|
||
# Unix socket domain directories | ||
PG_UNIX_SOCKET_DIRECTORIES: | ||
- "/var/run/postgresql" | ||
|
||
# postgres port | ||
pg_port: 5432 | ||
|
||
# postgres database | ||
pg_database: "postgres" | ||
|
||
# postgres user | ||
pg_owner: "postgres" | ||
pg_group: "postgres" | ||
|
||
# postgres superuser | ||
pg_superuser: "postgres" | ||
pg_superuser_password: "" | ||
pg_random_password: true | ||
|
||
# Input variables | ||
input _user: "" | ||
input_password: "" | ||
|
||
etc_hosts_lists: [] | ||
|
||
supported_os: | ||
- CentOS7 | ||
- CentOS8 | ||
- RHEL7 | ||
- RHEL8 | ||
|
||
supported_pg_type: | ||
- EPAS | ||
- PG | ||
|
||
supported_pg_version: | ||
- 10 | ||
- 11 | ||
- 12 | ||
- 13 | ||
|
||
supported_node_type: | ||
- primary | ||
- pemserver | ||
# Postgres Port | ||
PG_PORT: 5432 | ||
|
||
# Postgres Database | ||
PG_DATABASE: "postgres" | ||
|
||
# Postgres User | ||
PG_OWNER: "postgres" | ||
PG_GROUP: "postgres" | ||
|
||
# Postgres SuperUser | ||
PG_SUPERUSER: "postgres" | ||
PG_SUPERUSER_PASSWORD: "" | ||
PG_RANDOM_PASSWORD: false | ||
|
||
# Global configuration options that will be set via ALTER SYSTEM in postgresql.auto.conf | ||
PG_POSTGRES_DEFAULT_CONF_PARAMS: | ||
- {name: "unix_socket_directories", value: "{{ PG_UNIX_SOCKET_DIRECTORIES | join(',') }}"} | ||
- {name: "listen_addresses", value: "*" } | ||
- { name: wal_level, value: replica } | ||
- { name: max_wal_senders, value: 10 } | ||
- { name: hot_standby, value: on } | ||
- { name: max_replication_slots, value: 10 } | ||
- { name: wal_compression, value: on } | ||
- { name: wal_log_hints, value: on } | ||
- { name: checkpoint_timeout, value: 15min } | ||
- { name: checkpoint_completion_target, value: 0.9 } | ||
- { name: archive_mode, value: on } | ||
- { name: archive_command, value: '/bin/true' } | ||
- { name: random_page_cost, value: 1.1 } | ||
- { name: cpu_tuple_cost, value: 0.03 } | ||
- { name: logging_collector, value: on } | ||
- { name: log_line_prefix, value: '%m [%p-%l] %u@%d app=%a ' } | ||
- { name: log_truncate_on_rotation, value: on } | ||
- { name: log_rotation_size, value: '1GB' } | ||
- { name: log_lock_waits, value: on } | ||
- { name: log_connections, value: on } | ||
- { name: log_disconnections, value: on } | ||
- { name: log_error_verbosity, value: default } | ||
- { name: log_statement, value: ddl } | ||
- { name: log_temp_files, value: 0 } | ||
- { name: log_autovacuum_min_duration, value: 0 } | ||
- { name: autovacuum_max_workers, value: 5 } | ||
- { name: autovacuum_vacuum_cost_limit, value: 3000 } | ||
- { name: idle_in_transaction_session_timeout, value: 10min } | ||
- { name: syslog_ident, value: postgres } | ||
|
||
PG_POSTGRES_CONF_PARAMS: "" | ||
PG_ALLOW_IP_ADDRESSES: "" | ||
PG_EXTENSIONS: "" | ||
PG_SHARED_LIBRARIES_LIST: "" | ||
|
||
PG_GRANT_PRIVILEGES: "" | ||
PG_GRANT_ROLES: "" | ||
#PG_GRANT_PRIVILEGES: | ||
# - { "type": "function", "grant": yes, "privileges": "EXECUTE", "schema": "pg_catalog", "objects": "pg_current_wal_lsn(),pg_last_wal_replay_lsn(),pg_wal_replay_resume(),pg_wal_replay_pause()", "roles": "rewinduser", "database": "edb" } | ||
#PG_GRANT_ROLES: | ||
# - { "role": "pg_monitor", "user": "efm", "grant": yes } | ||
PG_SQL_SCRIPTS: "" | ||
# - {"file_path": "/usr/edb/as12/share/edb-sample.sql", db: "dbname"} | ||
|
||
PG_COPY_SQL_SCRIPTS: "" | ||
# - {"file": "/tmp/sample.sql", "remote_file": "/usr/edb/as12/share", "owner": "owner", "group": "group", "mode": "mode" } | ||
# | ||
ETC_HOSTS_LISTS: "" |
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,28 @@ | ||
--- | ||
|
||
- name: Check if Cluster has been initialized | ||
shell: | | ||
#/bin/bash | ||
systemctl is-active --quiet {{ PG_SERVICE }} \ | ||
&& echo "service_running" || echo "service_not_running" | ||
args: | ||
executable: /bin/bash | ||
changed_when: "'service_not_running' in service_status.stdout" | ||
become: yes | ||
register: service_status | ||
|
||
- name: Check if Cluster has been initialized | ||
stat: | ||
path: "{{ PG_DATA }}/PG_VERSION" | ||
become: yes | ||
register: pgdata_file | ||
|
||
- name: Verify PGDATA and stop if exists | ||
fail: | ||
msg: "It looks like either {{ PG_DATA }} directory is not empty or Service is running | ||
without {{ PG_DATA }} as directory. Take he backup of existing {{ PG_DATA }} | ||
and stop the service to proceed for intialize. | ||
Or use force_initialize option" | ||
when: | ||
- ( pgdata_file.stat.exists and service_status.stdout != 'service_running' ) | ||
- ( not pgdata_file.stat.exists and service_status.stdout == 'service_running' ) |
Oops, something went wrong.