test: add support debian 12
This commit is contained in:
parent
521d372dd8
commit
003f104851
7 changed files with 31 additions and 24 deletions
|
@ -8,18 +8,24 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- break: new system for user and privileges
|
- break: new system for user and privileges
|
||||||
|
- break: default postgresql version is 15
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- add database owner
|
- add database owner
|
||||||
- add variable postrgresql_primary
|
- add variable postrgresql_primary
|
||||||
- add user attributes
|
- add user attributes
|
||||||
|
- test: add support debian 12
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- fix replication database in pg_hba
|
- fix replication database in pg_hba
|
||||||
- fix pg_hba when multiple users or multiple databases
|
- fix pg_hba when multiple users or multiple databases
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- test: remove support debian 10
|
||||||
|
|
||||||
## v1.0.0 - 2021-09-10
|
## v1.0.0 - 2021-09-10
|
||||||
|
|
||||||
- first version
|
- first version
|
||||||
|
|
|
@ -7,16 +7,16 @@ Install and configure Postgresql
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
* Ansible >= 2.9
|
* Ansible >= 2.10
|
||||||
* Debian
|
* Debian
|
||||||
* Buster
|
|
||||||
* Bullseye
|
* Bullseye
|
||||||
|
* Bookworm
|
||||||
|
|
||||||
## Role variables
|
## Role variables
|
||||||
|
|
||||||
| Name | Type | Required |Default | Comment |
|
| Name | Type | Required |Default | Comment |
|
||||||
|------------------------------------|-------|----------|--------|-----------------------------------------------------|
|
|------------------------------------|-------|----------|--------|-----------------------------------------------------|
|
||||||
| postgresql_version | str | no | 13 | the major version to use |
|
| postgresql_version | str | no | 15 | the major version to use |
|
||||||
| postgresql_use_official_repository | bool | no | false | set true if you want official postgresql repository |
|
| postgresql_use_official_repository | bool | no | false | set true if you want official postgresql repository |
|
||||||
| postgresql_primary | bool | no | false | set true to create user and database on this server |
|
| postgresql_primary | bool | no | false | set true to create user and database on this server |
|
||||||
| postgresql_config | dict | no | | add option config file |
|
| postgresql_config | dict | no | | add option config file |
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
postgresql_version: 13
|
postgresql_version: 15
|
||||||
postgresql_use_official_repository: false
|
postgresql_use_official_repository: false
|
||||||
postgresql_primary: false
|
postgresql_primary: false
|
||||||
postgresql_databases: []
|
postgresql_databases: []
|
||||||
|
@ -25,7 +25,6 @@ postgresql_config_default:
|
||||||
log_line_prefix: '%m [%p] %q%u@%d'
|
log_line_prefix: '%m [%p] %q%u@%d'
|
||||||
log_timezone: Etc/UTC
|
log_timezone: Etc/UTC
|
||||||
cluster_name: '{{ postgresql_version }}/main'
|
cluster_name: '{{ postgresql_version }}/main'
|
||||||
stats_temp_directory: '/var/run/postgresql/{{ postgresql_version }}-main.pg_stat_tmp'
|
|
||||||
datestyle: iso, mdy
|
datestyle: iso, mdy
|
||||||
timezone: Etc/UTC
|
timezone: Etc/UTC
|
||||||
lc_messages: C.UTF-8
|
lc_messages: C.UTF-8
|
||||||
|
|
|
@ -6,13 +6,13 @@ galaxy_info:
|
||||||
company: Adrien Waksberg
|
company: Adrien Waksberg
|
||||||
description: Install and configure postgresql
|
description: Install and configure postgresql
|
||||||
license: Apache2
|
license: Apache2
|
||||||
min_ansible_version: 2.9
|
min_ansible_version: "2.10"
|
||||||
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: Debian
|
- name: Debian
|
||||||
versions:
|
versions:
|
||||||
- buster
|
|
||||||
- bullseye
|
- bullseye
|
||||||
|
- bookworm
|
||||||
|
|
||||||
galaxy_tags:
|
galaxy_tags:
|
||||||
- database
|
- database
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
postgresql_use_official_repository: true
|
postgresql_use_official_repository: true
|
||||||
postgresql_primary: true
|
postgresql_primary: true
|
||||||
postgresql_config:
|
postgresql_config:
|
||||||
listen_addresses: '*'
|
listen_addresses: "*"
|
||||||
postgresql_hba:
|
postgresql_hba:
|
||||||
- type: local
|
- type: local
|
||||||
databases:
|
databases:
|
||||||
|
@ -30,14 +30,14 @@
|
||||||
- INHERIT
|
- INHERIT
|
||||||
postgresql_privileges:
|
postgresql_privileges:
|
||||||
- role: myuser
|
- role: myuser
|
||||||
type: database
|
type: schema
|
||||||
database: myappli
|
database: myappli
|
||||||
objets:
|
objets:
|
||||||
- myappli
|
- public
|
||||||
privileges:
|
privileges:
|
||||||
- ALL
|
- ALL
|
||||||
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: update apt cache
|
- name: Update apt cache
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
|
@ -2,19 +2,21 @@
|
||||||
driver:
|
driver:
|
||||||
name: docker
|
name: docker
|
||||||
platforms:
|
platforms:
|
||||||
|
- name: debian12
|
||||||
|
image: nishiki/debian12:molecule
|
||||||
|
privileged: true
|
||||||
|
volumes:
|
||||||
|
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
||||||
|
cgroupns_mode: host
|
||||||
|
command: /bin/systemd
|
||||||
|
capabilities:
|
||||||
|
- SYS_ADMIN
|
||||||
- name: debian11
|
- name: debian11
|
||||||
image: nishiki/debian11:molecule
|
image: nishiki/debian11:molecule
|
||||||
privileged: true
|
privileged: true
|
||||||
volumes:
|
volumes:
|
||||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
||||||
command: /bin/systemd
|
cgroupns_mode: host
|
||||||
capabilities:
|
|
||||||
- SYS_ADMIN
|
|
||||||
- name: debian10
|
|
||||||
image: nishiki/debian10:molecule
|
|
||||||
privileged: true
|
|
||||||
volumes:
|
|
||||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
|
||||||
command: /bin/systemd
|
command: /bin/systemd
|
||||||
capabilities:
|
capabilities:
|
||||||
- SYS_ADMIN
|
- SYS_ADMIN
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import testinfra.utils.ansible_runner
|
import testinfra.utils.ansible_runner
|
||||||
|
|
||||||
def test_packages(host):
|
def test_packages(host):
|
||||||
for package_name in ['postgresql-13', 'python3-psycopg2']:
|
for package_name in ['postgresql-15', 'python3-psycopg2']:
|
||||||
package = host.package(package_name)
|
package = host.package(package_name)
|
||||||
assert package.is_installed
|
assert package.is_installed
|
||||||
|
|
||||||
def test_config_file(host):
|
def test_config_file(host):
|
||||||
path = host.file('/etc/postgresql/13/main/postgresql.conf')
|
path = host.file('/etc/postgresql/15/main/postgresql.conf')
|
||||||
assert path.exists
|
assert path.exists
|
||||||
assert path.is_file
|
assert path.is_file
|
||||||
assert path.user == 'root'
|
assert path.user == 'root'
|
||||||
|
@ -15,7 +15,7 @@ def test_config_file(host):
|
||||||
assert path.contains("listen_addresses = '*'")
|
assert path.contains("listen_addresses = '*'")
|
||||||
|
|
||||||
def test_hba_file(host):
|
def test_hba_file(host):
|
||||||
path = host.file('/etc/postgresql/13/main/pg_hba.conf')
|
path = host.file('/etc/postgresql/15/main/pg_hba.conf')
|
||||||
assert path.exists
|
assert path.exists
|
||||||
assert path.is_file
|
assert path.is_file
|
||||||
assert path.user == 'root'
|
assert path.user == 'root'
|
||||||
|
@ -24,7 +24,7 @@ def test_hba_file(host):
|
||||||
assert path.contains('local "myappli","myappli2" all md5')
|
assert path.contains('local "myappli","myappli2" all md5')
|
||||||
|
|
||||||
def test_service(host):
|
def test_service(host):
|
||||||
service = host.service('postgresql@13-main')
|
service = host.service('postgresql@15-main')
|
||||||
assert service.is_running
|
assert service.is_running
|
||||||
assert service.is_enabled
|
assert service.is_enabled
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue