14 KiB
14 KiB
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 mandatory |
|
| authentication_timeout | The maximum allowed time to complete client authentication. In seconds. |
60 | integer mandatory |
|
| autovacuum | Starts the autovacuum subprocess. | true | boolean 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 mandatory |
|
| work_mem_unit | Unit of work_mem. | MB | choice 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 mandatory |
|
| maintenance_work_mem_unit | Unit of maintenance_work_mem parameter. | MB | choice 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 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 mandatory |
|
| max_wal_size_unit | Unité de la limite douce du Write Ahead Log. | GB | choice mandatory |
Choices: • GB • MB • kB |
| shared_buffers | The number of shared memory buffers used by the server. | 128 | integer mandatory |
|
| shared_buffers_unit | Unit of shared_buffers. | MB | choice 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 mandatory |
|
| effective_cache_size_unit | Unit of effective_cache_size. | GB | choice mandatory |
Choices: • MB • kB • GB |
The group variable "accounts" - Accounts to the PostgreSQL server
| Variable | Description | Type | Validator |
|---|---|---|---|
| remotes | PostgreSQL client address. | domainname multiple mandatory |
uniqueType domainname. |
Account for example
Note
This family builds families dynamically.
Path: remote_example
Identifiers: the value of the variable "PostgreSQL client address".
| Variable | Description | Type |
|---|---|---|
| remote_example.database | PostgreSQL database name for example. | string mandatory |
| remote_example.username | PostgreSQL username for example. | UNIX user mandatory |
| remote_example.password | PostgreSQL password for example. | secret mandatory |
Usage
Example playbook with Rougail
Add to your structural file something like:
%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:
---
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:
---
- 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.
---
- 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