trainline-eu.ansible_postgresql_role
PostgreSQL Ansible角色 
Ansible角色,用于安装和配置PostgreSQL集群、数据库和用户。
安装
此角色已在Ansible 2.5.0及更高版本上测试过。
安装方法:
ansible-galaxy install trainline-eu.ansible_postgresql_role
依赖关系
没有依赖关系
推荐的依赖关系:
兼容性矩阵
此表列出了已测试的操作系统/PostgreSQL版本组合。
发行版 / PostgreSQL | 9.4 | 9.5 | 9.6 | 10 | 11 | 12 | 13 |
---|---|---|---|---|---|---|---|
Debian 9.x | :no_entry: :white_check_mark: | :no_entry: :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
Debian 10.x | :no_entry: :white_check_mark: | :no_entry: :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
- :white_check_mark: - 测试过,运行良好
- :grey_question: - 未来将会工作(如果可以,请提供帮助)
- :interrobang: - 可能有效,未测试
- :no_entry: - PostgreSQL已达到生命周期结束
变量
# 基本设置
postgres_listen_addresses: [ '127.0.0.1' ] # 可选
postgres_log_dir: '/home/postgres-logs' # 可选
postgres_data_dir: '/home/postgres' # 可选
postgres_clusters: # 必填
- version: 11 # 必填
name: 'main' # 必填
port: 5432 # 必填
checksums: True # 可选
fsync_enabled: False # 可选
archive_enabled: False # 可选
wal_level: 'logical' # 可选
max_replication_slots: 10 # 可选
barman_directory: None # 可选
# 定义集群为备用服务器
primary: # 可选
host: '127.0.1.1' # 必填
port: 5433 # 必填
replication_user: 'replicator' # 必填
replication_password: 'SuperSecret' # 必填
restore_command: None # 可选
restore_barman_directory: None # 可选
# 要创建的用户列表(可选)
users:
- username: 'replicator' # 必填
password: 'SuperSecret' # 必填
permissions: 'REPLICATION' # 必填
# 要创建的数据库列表(可选)
databases:
- dbname: my_database # 必填
owner: john # 必填
extensions: # 可选
- names: [ 'postgis', 'postgis_topology' ]
apt_deps: [ 'postgresql-11-postgis' ]
extra_config: # 可选
max_connections: 100 # 可选
shared_preload_libraries: '' # 可选
max_worker_processes: 8 # 可选
track_commit_timestamp: off # 可选
max_standby_archive_delay: 30s # 可选
max_standby_streaming_delay: 600s # 可选
# Postgres配置(可选)
postgres_log_line_prefix: '%m [%p] database: %d host: %h user: %u '
postgres_datestyle: 'iso, dmy'
postgres_locale_formats: fr_FR.UTF-8
postgres_text_search_config: pg_catalog.french
# Postgres pg_hba配置(可选)
postgres_allowed_hosts:
- user: all
range: 10.0.0.0/24
postgres_replication_hosts:
- user: replicator
range: 10.0.0.0/24
# Ansible相关配置
postgres_become_method: su # 可选
# Barman连接
postgres_barman_server: barman.example.com # 如果至少有一个服务器启用了archive_enabled,则必须
postgres_barman_rsync_enabled: False # 可选
postgres_barman_rsync_options: '' # 可选
postgres_barman_remote_user: barman # 可选
postgres_barman_path_prefix: '~' # 可选,如果使用rsync,则需要
测试
该项目附带一个test/main.yml
测试剧本。它使用Docker
本地配置容器,并设置一个包含barman服务器的3节点PostgreSQL集群。
这个剧本的覆盖率可能不完整,但至少存在。
如果您想贡献,请先在test/
目录中的docker容器中测试您的更改(使用目标发行版),如果可能,请确保您的更改在测试中得到覆盖。
许可证
根据MIT许可证发布。有关详细信息,请参见许可证文件。
感谢
创作者:
维护者:
反馈、错误报告、请求...
欢迎反馈!
关于项目
Install, configure and manage PostgreSQL clusters
安装
ansible-galaxy install trainline-eu.ansible_postgresql_role
许可证
mit
下载
3.8k
拥有者