2018-10-14 20:47:12 +00:00
|
|
|
# xoxys.postgres
|
2019-10-18 11:22:07 +00:00
|
|
|
|
|
|
|
[![Build Status](https://drone.rknet.org/api/badges/ansible/xoxys.postgres/status.svg)](https://drone.rknet.org/ansible/xoxys.postgres)
|
2018-10-14 20:47:12 +00:00
|
|
|
|
2019-10-18 11:22:07 +00:00
|
|
|
|
|
|
|
Setup PostgreSQL database
|
|
|
|
|
|
|
|
## Table of content
|
|
|
|
|
|
|
|
* [Default Variables](#default-variables)
|
|
|
|
* [postgres_repository_enabled](#postgres_repository_enabled)
|
|
|
|
* [postgres_version](#postgres_version)
|
|
|
|
* [postgres_repository_filename](#postgres_repository_filename)
|
|
|
|
* [postgres_user](#postgres_user)
|
|
|
|
* [postgres_group](#postgres_group)
|
|
|
|
* [postgres_log_destination](#postgres_log_destination)
|
|
|
|
* [postgres_log_directory](#postgres_log_directory)
|
|
|
|
* [postgres_log_filename](#postgres_log_filename)
|
|
|
|
* [postgres_log_rotation_age](#postgres_log_rotation_age)
|
|
|
|
* [postgres_log_rotation_size](#postgres_log_rotation_size)
|
|
|
|
* [postgres_iptables_enabled](#postgres_iptables_enabled)
|
|
|
|
* [postgres_connection_port](#postgres_connection_port)
|
|
|
|
* [postgres_connection_addresses](#postgres_connection_addresses)
|
|
|
|
* [postgres_socket_directories](#postgres_socket_directories)
|
|
|
|
* [postgres_password_encryption](#postgres_password_encryption)
|
|
|
|
* [postgres_tls_enabled](#postgres_tls_enabled)
|
|
|
|
* [postgres_tls_cert_filename](#postgres_tls_cert_filename)
|
|
|
|
* [postgres_tls_key_filename](#postgres_tls_key_filename)
|
|
|
|
* [postgres_tls_cert_source](#postgres_tls_cert_source)
|
|
|
|
* [postgres_tls_key_source](#postgres_tls_key_source)
|
|
|
|
* [postgres_users](#postgres_users)
|
2019-10-26 10:14:12 +00:00
|
|
|
* [postgres_users_extra](#postgres_users_extra)
|
|
|
|
* [postgres_db](#postgres_db)
|
|
|
|
* [postgres_db_extra](#postgres_db_extra)
|
2019-10-18 11:22:07 +00:00
|
|
|
* [postgres_hba_entries](#postgres_hba_entries)
|
2019-10-23 08:05:37 +00:00
|
|
|
* [postgres_hba_entries_extra](#postgres_hba_entries_extra)
|
2019-10-18 11:22:07 +00:00
|
|
|
* [postgres_base_dir](#postgres_base_dir)
|
|
|
|
* [Dependencies](#dependencies)
|
|
|
|
* [License](#license)
|
|
|
|
* [Author](#author)
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
## Default Variables
|
|
|
|
|
|
|
|
### postgres_repository_enabled
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_repository_enabled: false
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_version
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_version: 10
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_repository_filename
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_repository_filename: Postgresql-{{ postgres_version | regex_replace('\.')
|
|
|
|
}}
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_user
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_user: postgres
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_group
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_group: postgres
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_log_destination
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_log_destination:
|
|
|
|
- stderr
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_log_directory
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_log_directory: log
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_log_filename
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_log_filename: postgresql.log
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_log_rotation_age
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_log_rotation_age: 1d
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_log_rotation_size
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_log_rotation_size: 0
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_iptables_enabled
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_iptables_enabled: false
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_connection_port
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_connection_port: 5432
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_connection_addresses
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_connection_addresses:
|
|
|
|
- localhost
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_socket_directories
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_socket_directories:
|
|
|
|
- /var/run/postgresql
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_password_encryption
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_password_encryption: md5
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_tls_enabled
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_tls_enabled: false
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_tls_cert_filename
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_tls_cert_filename: mycert.pem
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_tls_key_filename
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_tls_key_filename: mykey.pem
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_tls_cert_source
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_tls_cert_source: mycert.pem
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_tls_key_source
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_tls_key_source: mykey.pem
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_users
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_users: []
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Example usage
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_users:
|
|
|
|
- name: jdoe required; the rest are optional
|
|
|
|
password: defaults to not set
|
|
|
|
encrypted: defaults to 'yes'
|
|
|
|
priv: defaults to not set
|
|
|
|
role_attr_flags: defaults to not set
|
|
|
|
db: defaults to not set
|
|
|
|
login_host: defaults to 'localhost'
|
|
|
|
login_password: defaults to not set
|
|
|
|
login_user: defaults to '{{ postgres_user }}'
|
|
|
|
login_unix_socket: defaults to 1st of postgres_socket_directories
|
|
|
|
port: defaults to not set
|
|
|
|
state: defaults to 'present'
|
|
|
|
pam_user: defaults to not set
|
|
|
|
```
|
|
|
|
|
2019-10-26 10:14:12 +00:00
|
|
|
### postgres_users_extra
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_users_extra: []
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_db
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_db: []
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Example usage
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_db:
|
|
|
|
- name: "my_app"
|
|
|
|
lc_collate: "en_US.UTF-8"
|
|
|
|
lc_ctype: "en_US.UTF-8"
|
|
|
|
encoding: "UTF-8"
|
|
|
|
template: "template0"
|
|
|
|
login_host: "localhost"
|
|
|
|
login_password: "_omit_"
|
|
|
|
login_user: "{{ postgresql_user }}"
|
|
|
|
login_unix_socket: "_omit_"
|
|
|
|
port: "_omit_"
|
|
|
|
owner: "_omit_"
|
|
|
|
state: "present"
|
|
|
|
```
|
|
|
|
|
|
|
|
### postgres_db_extra
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_db_extra: []
|
|
|
|
```
|
|
|
|
|
2019-10-18 11:22:07 +00:00
|
|
|
### postgres_hba_entries
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_hba_entries:
|
2019-10-23 07:57:06 +00:00
|
|
|
- contype: local
|
|
|
|
databases:
|
|
|
|
- all
|
|
|
|
users:
|
|
|
|
- all
|
2019-10-18 11:22:07 +00:00
|
|
|
auth_method: peer
|
2019-10-23 07:57:06 +00:00
|
|
|
- contype: host
|
|
|
|
databases:
|
|
|
|
- all
|
|
|
|
users:
|
|
|
|
- all
|
2019-10-18 11:22:07 +00:00
|
|
|
address: 127.0.0.1/32
|
|
|
|
auth_method: md5
|
2019-10-23 07:57:06 +00:00
|
|
|
- contype: host
|
|
|
|
databases:
|
|
|
|
- all
|
|
|
|
users:
|
|
|
|
- all
|
2019-10-18 11:22:07 +00:00
|
|
|
address: ::1/128
|
|
|
|
auth_method: md5
|
|
|
|
```
|
|
|
|
|
2019-10-23 08:05:37 +00:00
|
|
|
### postgres_hba_entries_extra
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
|
|
|
postgres_hba_entries_extra: []
|
|
|
|
```
|
|
|
|
|
2019-10-18 11:22:07 +00:00
|
|
|
### postgres_base_dir
|
|
|
|
|
|
|
|
#### Default value
|
|
|
|
|
|
|
|
```YAML
|
2019-10-26 10:14:12 +00:00
|
|
|
postgres_base_dir: _osdefault_
|
2019-10-18 11:22:07 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Dependencies
|
|
|
|
|
|
|
|
None.
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
MIT
|
|
|
|
|
|
|
|
## Author
|
|
|
|
|
|
|
|
xoxys
|