From f13d989a7c389c13cd0d162ba7f6ddcfeb2d8f9dedd0d318c7a8caf22cc3a27c Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 14 Apr 2026 07:40:42 +0200 Subject: [PATCH] feat: first commit --- .rougail_doc.yml | 11 + README.md | 118 +++ roles/postgresql/defaults/main.yml | 16 + roles/postgresql/files/pg_ident.conf | 46 + roles/postgresql/files/postgresql_init | 22 + .../postgresql/files/sysuser-postgresql.conf | 3 + .../postgresql/files/tmpfiles.postgresql.conf | 2 + roles/postgresql/tasks/main.yml | 45 + roles/postgresql/templates/pg_hba.conf.j2 | 108 +++ roles/postgresql/templates/postgresql.conf.j2 | 870 ++++++++++++++++++ .../templates/postgresql.service.j2 | 38 + roles/postgresql/templates/postgresql.sql.j2 | 15 + roles/postgresql/templates/risotto_backup.j2 | 12 + roles/postgresql/vars/main.yml | 8 + rougail/risotto/accounts.yml | 27 + rougail/risotto/postgresql.yml | 42 + rougail/types/10_postgresql.yml | 98 ++ rougail/types/50_accounts.yml | 24 + 18 files changed, 1505 insertions(+) create mode 100644 .rougail_doc.yml create mode 100644 README.md create mode 100644 roles/postgresql/defaults/main.yml create mode 100644 roles/postgresql/files/pg_ident.conf create mode 100644 roles/postgresql/files/postgresql_init create mode 100644 roles/postgresql/files/sysuser-postgresql.conf create mode 100644 roles/postgresql/files/tmpfiles.postgresql.conf create mode 100644 roles/postgresql/tasks/main.yml create mode 100644 roles/postgresql/templates/pg_hba.conf.j2 create mode 100644 roles/postgresql/templates/postgresql.conf.j2 create mode 100644 roles/postgresql/templates/postgresql.service.j2 create mode 100644 roles/postgresql/templates/postgresql.sql.j2 create mode 100644 roles/postgresql/templates/risotto_backup.j2 create mode 100644 roles/postgresql/vars/main.yml create mode 100644 rougail/risotto/accounts.yml create mode 100644 rougail/risotto/postgresql.yml create mode 100644 rougail/types/10_postgresql.yml create mode 100644 rougail/types/50_accounts.yml diff --git a/.rougail_doc.yml b/.rougail_doc.yml new file mode 100644 index 0000000..01921a6 --- /dev/null +++ b/.rougail_doc.yml @@ -0,0 +1,11 @@ +--- +main_structural_directories: + - rougail/types/ +step: + output: ansible +ansible: + output: doc + doc: + project_name: postgresql + author: risotto + output_format: github diff --git a/README.md b/README.md new file mode 100644 index 0000000..dd18691 --- /dev/null +++ b/README.md @@ -0,0 +1,118 @@ +# risotto.postgresql - Configure the PostgreSQL server + +This repository contains the `risotto.postgresql` Ansible Collection. + +PostgreSQL is the World's Most Advanced Open Source Relational Database. + +This collection allows you to configure a PostgreSQL server and create user +accounts. + +## Variables + +### The group variable "postgresql" - Configure the PostgreSQL server + +| Variable | Description | Default value | Type | Validator | +|----------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|-------------------------------------------------------------------------------------------------|---------------------------------------------------------| +| **max_connections** | The maximum number of concurrent connections. | 100 | [`integer`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | | +| **authentication_timeout** | The maximum allowed time to complete client authentication.
In seconds. | 60 | [`integer`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | | +| **autovacuum** | Starts the autovacuum subprocess. | true | [`boolean`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | | +| **work_mem** | The maximum memory to be used for query workspaces.
Sets the base maximum amount of memory to be used by a query operation (such as a sort or hash table) before writing to temporary disk files. | 4 | [`integer`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | | +| **work_mem_unit** | Unit of work_mem. | MB | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | **Choices**:
• kB
• MB | +| **maintenance_work_mem** | The maximum memory to be used for maintenance operations.
Specifies the maximum amount of memory to be used by maintenance operations, such as VACUUM, CREATE INDEX, and ALTER TABLE ADD FOREIGN KEY. | 64 | [`integer`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | | +| **maintenance_work_mem_unit** | Unit of maintenance_work_mem parameter. | MB | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | **Choices**:
• kB
• MB | +| **wal_buffers** | The number of disk-page buffers in shared memory for WAL.
The amount of shared memory used for WAL data that has not yet been written to disk (The default setting of -1 selects a size equal to 1/32nd of shared_buffers, but not less than 64kB nor more than the size of one WAL segment). | -1 | [`integer`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | | +| **max_wal_size** | The WAL size that triggers a checkpoint.
Maximum (soft limit) size to let the WAL grow during automatic checkpoints. | 2 | [`integer`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | | +| **max_wal_size_unit** | Unité de la limite douce du Write Ahead Log. | GB | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | **Choices**:
• GB
• MB
• kB | +| **shared_buffers** | The number of shared memory buffers used by the server. | 128 | [`integer`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | | +| **shared_buffers_unit** | Unit of shared_buffers. | MB | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | **Choices**:
• MB
• kB | +| **effective_cache_size** | Sets the planner's assumption about the total size of the data caches.
Sets the planner's assumption about the effective size of the disk cache that is available to a single query. | 4 | [`integer`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | | +| **effective_cache_size_unit** | Unit of effective_cache_size. | GB | [`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | **Choices**:
• MB
• kB
• GB | + +### The group variable "accounts" - Accounts to the PostgreSQL server + +| Variable | Description | Type | Validator | +|------------------------------------------------------------------|----------------------------|---------------------------------------------------------------------------------------------------------------|-------------------------------| +| **remotes** | PostgreSQL client address. | [`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `multiple` `mandatory` | `unique`
Type domainname. | + +#### Account for *example* + +> [!NOTE] +> +> This family builds families dynamically.\ +> **Path**: remote_*example*\ +> **Identifiers**: the value of the variable "[PostgreSQL client address](#accounts.remotes)". + +| Variable | Description | Type | +|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------|---------------------------------------------------------------------------------------------------| +| **remote_*example*.database** | PostgreSQL database name for *example*. | [`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | +| **remote_*example*.username** | PostgreSQL username for *example*. | [`UNIX user`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | +| **remote_*example*.password** | PostgreSQL password for *example*. | [`secret`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | + +## Usage + +### Example playbook with Rougail + +Add to your structural file something like: + +```yaml +%YAML 1.2 +--- +version: 1.1 +my_postgresql: + type: postgresql +my_accounts: + type: accounts +... +``` + +> [!NOTE] +> +> Do not forget to add Rougail structural file as Rougail types. + +For example you can add an YAML user data with something like: + +```yaml +--- +my_accounts: + remotes: # PostgreSQL client address + - example.net + remote_example_net: # Account for example.net + database: example # PostgreSQL database name for example.net + username: username # PostgreSQL username for example.net + password: secrets # PostgreSQL password for example.net +``` + +Add to your playbook: + +```yaml +--- +- name: Configure the PostgreSQL server + hosts: servers + vars: + postgresql: '{{ my_postgresql }}' + accounts: '{{ my_accounts }}' + roles: + - role: risotto.postgresql +``` + +### Example playbook without Rougail + +> [!NOTE] +> +> The variables will not be properly validated without Rougail. + +```yaml +--- +- name: Configure the PostgreSQL server + hosts: servers + vars: + accounts: + remotes: # PostgreSQL client address + - example.net + remote_example_net: # Account for example.net + database: example # PostgreSQL database name for example.net + username: username # PostgreSQL username for example.net + password: secrets # PostgreSQL password for example.net + roles: + - role: risotto.postgresql +``` diff --git a/roles/postgresql/defaults/main.yml b/roles/postgresql/defaults/main.yml new file mode 100644 index 0000000..9c3171c --- /dev/null +++ b/roles/postgresql/defaults/main.yml @@ -0,0 +1,16 @@ +--- +postgresql: # Configure the PostgreSQL server + max_connections: 100 # The maximum number of concurrent connections + authentication_timeout: 60 # The maximum allowed time to complete client authentication + autovacuum: true # Starts the autovacuum subprocess + work_mem: 4 # The maximum memory to be used for query workspaces + work_mem_unit: MB # Unit of work_mem + maintenance_work_mem: 64 # The maximum memory to be used for maintenance operations + maintenance_work_mem_unit: MB # Unit of maintenance_work_mem parameter + wal_buffers: -1 # The number of disk-page buffers in shared memory for WAL + max_wal_size: 2 # The WAL size that triggers a checkpoint + max_wal_size_unit: GB # Unité de la limite douce du Write Ahead Log + shared_buffers: 128 # The number of shared memory buffers used by the server + shared_buffers_unit: MB # Unit of shared_buffers + effective_cache_size: 4 # Sets the planner's assumption about the total size of the data caches + effective_cache_size_unit: GB # Unit of effective_cache_size diff --git a/roles/postgresql/files/pg_ident.conf b/roles/postgresql/files/pg_ident.conf new file mode 100644 index 0000000..88a4f39 --- /dev/null +++ b/roles/postgresql/files/pg_ident.conf @@ -0,0 +1,46 @@ +#RISOTTO: file://usr/share/pgsql/pg_ident.conf.sample +# PostgreSQL User Name Maps +# ========================= +# +# Refer to the PostgreSQL documentation, chapter "Client +# Authentication" for a complete description. A short synopsis +# follows. +# +# This file controls PostgreSQL user name mapping. It maps external +# user names to their corresponding PostgreSQL user names. Records +# are of the form: +# +# MAPNAME SYSTEM-USERNAME PG-USERNAME +# +# (The uppercase quantities must be replaced by actual values.) +# +# MAPNAME is the (otherwise freely chosen) map name that was used in +# pg_hba.conf. SYSTEM-USERNAME is the detected user name of the +# client. PG-USERNAME is the requested PostgreSQL user name. The +# existence of a record specifies that SYSTEM-USERNAME may connect as +# PG-USERNAME. +# +# If SYSTEM-USERNAME starts with a slash (/), it will be treated as a +# regular expression. Optionally this can contain a capture (a +# parenthesized subexpression). The substring matching the capture +# will be substituted for \1 (backslash-one) if present in +# PG-USERNAME. +# +# Multiple maps may be specified in this file and used by pg_hba.conf. +# +# No map names are defined in the default configuration. If all +# system user names and PostgreSQL user names are the same, you don't +# need anything in this file. +# +# This file is read on server startup and when the postmaster receives +# a SIGHUP signal. If you edit the file on a running system, you have +# to SIGHUP the postmaster for the changes to take effect. You can +# use "pg_ctl reload" to do that. + +# Put your actual configuration here +# ---------------------------------- + +# MAPNAME SYSTEM-USERNAME PG-USERNAME +#>GNUNUX +pg_map postgres postgres +#GNUNUX +#@remove-line-for-nolocal@# "local" is for Unix domain socket connections only +#@remove-line-for-nolocal@local all all @authmethodlocal@ +local all postgres ident map=pg_map +#GNUNUX +#host all all 127.0.0.1/32 @authmethodhost@ +{%- for server in accounts.remotes -%} + {%- set name = server | normalize_family -%} + {%- set database = accounts["remote_" + name].database -%} + {%- set username = accounts["remote_" + name].username %} +hostssl {{ database }} {{ username }} {{ server }} scram-sha-256 +{%- endfor %} +#GNUNUX +#@remove-line-for-nolocal@local replication all @authmethodlocal@ +#host replication all 127.0.0.1/32 @authmethodhost@ +#host replication all ::1/128 @authmethodhost@ +#GNUNUX +hba_file = '/etc/postgresql/pg_hba.conf' +#GNUNUX +ident_file = '/etc/postgresql/pg_ident.conf' +#GNUNUX +listen_addresses = '*' +#GNUNUX +max_connections = {{ postgresql.max_connections }} +#GNUNUX +unix_socket_directories = '/var/run/postgresql' +#GNUNUX +authentication_timeout = {{ postgresql.authentication_timeout }}s +#GNUNUX +ssl = true # (change requires restart) +ssl_cert_file = '{{ tls.cert_directory }}/postgresql.crt' # (change requires restart) +ssl_key_file = '{{ tls.key_directory }}/postgresql.key' # (change requires restart) +ssl_ca_file = '{{ tls.ca_directory }}/PostgreSQL.crt' +#GNUNUX +shared_buffers = {{ postgresql.shared_buffers }}{{ postgresql.shared_buffers_unit }} +#GNUNUX +work_mem = {{ postgresql.work_mem }}{{ postgresql.work_mem_unit }} # min 64kB +maintenance_work_mem = {{ postgresql.maintenance_work_mem }}{{ postgresql.maintenance_work_mem_unit }} # min 1MB +#GNUNUX +wal_buffers = {{ postgresql.wal_buffers }} +#GNUNUX +max_wal_size = {{ postgresql.max_wal_size }}{{ postgresql.max_wal_size_unit }} +min_wal_size = 80MB +#GNUNUX +effective_cache_size = {{ postgresql.effective_cache_size }}{{ postgresql.effective_cache_size_unit }} +#GNUNUX +log_destination = 'syslog' +# 0 logs only + # statements running at least this number + # of milliseconds + +#log_min_duration_sample = -1 # -1 is disabled, 0 logs a sample of statements + # and their durations, > 0 logs only a sample of + # statements running at least this number + # of milliseconds; + # sample fraction is determined by log_statement_sample_rate + +#log_statement_sample_rate = 1.0 # fraction of logged statements exceeding + # log_min_duration_sample to be logged; + # 1.0 logs all such statements, 0.0 never logs + + +#log_transaction_sample_rate = 0.0 # fraction of transactions whose statements + # are logged regardless of their duration; 1.0 logs all + # statements from all transactions, 0.0 never logs + +# - What to Log - + +#debug_print_parse = off +#debug_print_rewritten = off +#debug_print_plan = off +#debug_pretty_print = on +#log_autovacuum_min_duration = -1 # log autovacuum activity; + # -1 disables, 0 logs all actions and + # their durations, > 0 logs only + # actions running at least this number + # of milliseconds. +#log_checkpoints = off +#log_connections = off +#log_disconnections = off +#log_duration = off +#log_error_verbosity = default # terse, default, or verbose messages +#log_hostname = off +#log_line_prefix = '%m [%p] ' # special values: + # %a = application name + # %u = user name + # %d = database name + # %r = remote host and port + # %h = remote host + # %b = backend type + # %p = process ID + # %P = process ID of parallel group leader + # %t = timestamp without milliseconds + # %m = timestamp with milliseconds + # %n = timestamp with milliseconds (as a Unix epoch) + # %Q = query ID (0 if none or not computed) + # %i = command tag + # %e = SQL state + # %c = session ID + # %l = session line number + # %s = session start timestamp + # %v = virtual transaction ID + # %x = transaction ID (0 if none) + # %q = stop here in non-session + # processes + # %% = '%' + # e.g. '<%u%%%d> ' +#log_lock_waits = off # log lock waits >= deadlock_timeout +#log_recovery_conflict_waits = off # log standby recovery conflict waits + # >= deadlock_timeout +#log_parameter_max_length = -1 # when logging statements, limit logged + # bind-parameter values to N bytes; + # -1 means print in full, 0 disables +#log_parameter_max_length_on_error = 0 # when logging an error, limit logged + # bind-parameter values to N bytes; + # -1 means print in full, 0 disables +#log_statement = 'none' # none, ddl, mod, all +#log_replication_commands = off +#log_temp_files = -1 # log temporary files equal or larger + # than the specified size in kilobytes; + # -1 disables, 0 logs all temp files +#FIXME en dure ? +#>GNUNUX +#log_timezone = 'GMT' +log_timezone = '{{ time_zone }}' +#GNUNUX +{% if postgresql.autovacuum %} +autovacuum = on +{% else %} +autovacuum = off +{% endif %} +#GNUNUX +datestyle = 'iso, dmy' +#GNUNUX +timezone = '{{ time_zone }}' +#0 actually + # selects precise output mode +#client_encoding = sql_ascii # actually, defaults to database + # encoding + +# These settings are initialized by initdb, but they can be changed. +#lc_messages = 'C' # locale for system error message + # strings +#lc_monetary = 'C' # locale for monetary formatting +#lc_numeric = 'C' # locale for number formatting +#lc_time = 'C' # locale for time formatting +#>GNUNUX +#FIXME en dure ? +lc_messages = 'fr_FR.UTF-8' +lc_monetary = 'fr_FR.UTF-8' +lc_numeric = 'fr_FR.UTF-8' +lc_time = 'fr_FR.UTF-8' +#GNUNUX +#default_text_search_config = 'pg_catalog.french' +default_text_search_config = 'pg_catalog.french' +# /tmp/postgresql.conf &&{% if True -%}{% endif -%} + mv -f /tmp/postgresql.conf ${PGDATA}/postgresql.conf &&{% if True -%}{% endif -%} +{# pg_upgrade modify pg_hba.conf so copy it #} + /bin/rm ${PGDATA}/pg_hba.conf &&{% if True -%}{% endif -%} + /bin/cp -af ${PG_HBA} ${PGDATA} &&{% if True -%}{% endif -%} +{# do upgrade #} + /usr/bin/postgresql-setup --upgrade &&{% if True -%}{% endif -%} +{# re do link #} + ln -sf ${PG_HBA} ${PGDATA}/ &&{% if True -%}{% endif -%} + ln -sf ${PG_CONF} ${PGDATA}/ &&{% if True -%}{% endif -%} +{# remove old cluster #} + /srv/postgresql/postgresql/delete_old_cluster.sh &&{% if True -%}{% endif -%} + rm -f /srv/postgresql/postgresql/delete_old_cluster.sh &&{% if True -%}{% endif -%} +{# force index (see later) #} + touch /srv/postgresql/risotto_upgrade.lock{% if True -%}{% endif -%} +)' +{# recheck db #} +ExecStartPre=/usr/libexec/postgresql-check-db-dir %N +ExecStart= +ExecStart=/usr/bin/postmaster -D ${PGDATA} -c config_file=${PG_CONF} -c hba_file=${PG_HBA} -c ident_file=${PG_IDENT} +ExecStartPost=-/usr/bin/psql -f /etc/postgresql/postgresql.sql +{# if lock do reindex #} +ExecStartPost=/bin/bash -c 'if [ -f /srv/postgresql/risotto_upgrade.lock ];then echo REINDEX; /usr/bin/reindexdb && rm -f /srv/postgresql/risotto_upgrade.lock; fi' diff --git a/roles/postgresql/templates/postgresql.sql.j2 b/roles/postgresql/templates/postgresql.sql.j2 new file mode 100644 index 0000000..c94d15e --- /dev/null +++ b/roles/postgresql/templates/postgresql.sql.j2 @@ -0,0 +1,15 @@ +#RISOTTO: do not compare +{%- set new_accounts = [] -%} +{%- for server in accounts.remotes -%} + {%- set name = server|normalize_family -%} + {%- set database = accounts["remote_" + name].database -%} + {%- set username = accounts["remote_" + name].username -%} + {%- set password = accounts["remote_" + name].password -%} + {%- set x=new_accounts.append((database, username, password)) -%} +{%- endfor -%} +{%- for database, name, password in new_accounts %} +CREATE DATABASE "{{ name }}"; +CREATE ROLE "{{ name }}" WITH LOGIN ENCRYPTED PASSWORD '{{ password }}'; +ALTER USER "{{ name }}" PASSWORD '{{ password }}'; +GRANT ALL PRIVILEGES ON DATABASE "{{ name }}" TO "{{ database }}"; +{%- endfor -%} diff --git a/roles/postgresql/templates/risotto_backup.j2 b/roles/postgresql/templates/risotto_backup.j2 new file mode 100644 index 0000000..8a665fb --- /dev/null +++ b/roles/postgresql/templates/risotto_backup.j2 @@ -0,0 +1,12 @@ +#!/bin/bash -e + +rm -rf {{ backup_dir }} +mkdir -p {{ backup_dir }} +chown postgres: {{ backup_dir }} +{%- for server in accounts.remotes -%} + {%- set name = server|normalize_family -%} + {%- set database = accounts["remote_" + name].database %} +su -c "pg_dump -F c -b -v -f {{ backup_dir }}/{{ database }}.dump {{ database }}" postgres +{%- endfor %} + +exit 0 diff --git a/roles/postgresql/vars/main.yml b/roles/postgresql/vars/main.yml new file mode 100644 index 0000000..1988733 --- /dev/null +++ b/roles/postgresql/vars/main.yml @@ -0,0 +1,8 @@ +--- +accounts: # Accounts to the PostgreSQL server + remotes: # PostgreSQL client address + - example.net + remote_example_net: # Account for example.net + database: example # PostgreSQL database name for example.net + username: username # PostgreSQL username for example.net + password: secrets # PostgreSQL password for example.net diff --git a/rougail/risotto/accounts.yml b/rougail/risotto/accounts.yml new file mode 100644 index 0000000..e9cc319 --- /dev/null +++ b/rougail/risotto/accounts.yml @@ -0,0 +1,27 @@ +%YAML 1.2 +--- +version: 1.1 + +accounts: + + remotes: + redefine: true + provider: Postgresql + hidden: true + + "remote_{{ identifier }}": + redefine: true + hidden: true + + database: + redefine: true + provider: Postgresql:database + + username: + redefine: true + provider: Postgresql:username + + password: + redefine: true + provider: Postgresql:password +... diff --git a/rougail/risotto/postgresql.yml b/rougail/risotto/postgresql.yml new file mode 100644 index 0000000..eee2479 --- /dev/null +++ b/rougail/risotto/postgresql.yml @@ -0,0 +1,42 @@ +%YAML 1.2 +--- +version: 1.1 + +tls: + + certificates: + + postgresql: + leadership: true + + authority: + type: unix_filename + default: + jinja: '{{ ___.ca_directory }}.PostgreSQL.crt' + provider: TLS-certificate:authority + + domain: + type: domainname + default: + jinja: >- + {%- if ____.network.interfaces.domain_name -%} + {{- ____.network.interfaces.domain_name[0] -}} + {%- endif -%} + provider: TLS-certificate:domain + + certificate: + type: unix_filename + default: + jinja: '{{ ___.cert_directory }}.postgresql.crt' + provider: TLS-certificate:certificate + + private: + type: unix_filename + default: + jinja: '{{ ___.key_directory }}.postgresql.key' + provider: TLS-certificate:private_key + + owner: + type: unix_user + default: postgres +... diff --git a/rougail/types/10_postgresql.yml b/rougail/types/10_postgresql.yml new file mode 100644 index 0000000..abd7a74 --- /dev/null +++ b/rougail/types/10_postgresql.yml @@ -0,0 +1,98 @@ +%YAML 1.2 +--- +version: 1.1 + +postgresql: + description: configure the PostgreSQL server + help: |- + PostgreSQL is the World's Most Advanced Open Source Relational Database. + + This collection allows you to configure a PostgreSQL server and create user + accounts. + + max_connections: + description: the maximum number of concurrent connections + default: 100 + + authentication_timeout: + description: the maximum allowed time to complete client authentication + help: in seconds + default: 60 + + autovacuum: + type: boolean + description: Starts the autovacuum subprocess + + work_mem: + description: the maximum memory to be used for query workspaces + help: >- + Sets the base maximum amount of memory to be used by a query operation (such as a sort or hash table) before writing to temporary disk files + default: 4 + + work_mem_unit: + description: unit of work_mem + default: MB + choices: + - kB + - MB + + maintenance_work_mem: + description: the maximum memory to be used for maintenance operations + help: >- + Specifies the maximum amount of memory to be used by maintenance operations, + such as VACUUM, CREATE INDEX, and ALTER TABLE ADD FOREIGN KEY. + default: 64 + + maintenance_work_mem_unit: + description: unit of maintenance_work_mem parameter + default: MB + choices: + - kB + - MB + + wal_buffers: + description: the number of disk-page buffers in shared memory for WAL + help: >- + The amount of shared memory used for WAL data that has not yet been written to disk + (The default setting of -1 selects a size equal to 1/32nd of shared_buffers, + but not less than 64kB nor more than the size of one WAL segment) + default: -1 + + max_wal_size: + description: the WAL size that triggers a checkpoint + help: Maximum (soft limit) size to let the WAL grow during automatic checkpoints. + default: 2 + + max_wal_size_unit: + description: Unité de la limite douce du Write Ahead Log + default: GB + choices: + - GB + - MB + - kB + + shared_buffers: + description: the number of shared memory buffers used by the server + default: 128 + + shared_buffers_unit: + description: unit of shared_buffers + default: MB + choices: + - MB + - kB + + effective_cache_size: + description: Sets the planner's assumption about the total size of the data caches + help: >- + Sets the planner's assumption about the effective size of the disk cache that is available to a single query. + default: 4 + + effective_cache_size_unit: + description: unit of effective_cache_size + default: GB + choices: + - MB + - kB + - GB +... diff --git a/rougail/types/50_accounts.yml b/rougail/types/50_accounts.yml new file mode 100644 index 0000000..8344a17 --- /dev/null +++ b/rougail/types/50_accounts.yml @@ -0,0 +1,24 @@ +--- +version: 1.1 + +accounts: # accounts to the PostgreSQL server + + remotes: + description: PostgreSQL client address + type: domainname + multi: true + + "remote_{{ identifier }}": + description: 'Account for {{ identifier }}' + dynamic: + variable: _.remotes + + database: # PostgreSQL database name for {{ identifier }} + + username: + description: 'PostgreSQL username for {{ identifier }}' + type: unix_user + + password: + description: 'PostgreSQL password for {{ identifier }}' + type: secret