skoneka.anxs-postgresql
ANXS - PostgreSQL 
需要帮助!如果你有能力并愿意维护这个 Ansible 角色,请打开一个 GitHub 问题。很多人似乎在使用这个角色,而我们(显然)需要帮助! 💖
这是一个用于安装和配置 PostgreSQL、扩展、数据库和用户的 Ansible 角色。
安装
该角色已在 Ansible 2.4.0 和更高版本上测试通过。
安装方法:
ansible-galaxy install ANXS.postgresql
依赖
兼容性矩阵
发行版 / PostgreSQL | <= 9.2 | 9.3 | 9.4 | 9.5 | 9.6 | 10 | 11 |
---|---|---|---|---|---|---|---|
Ubuntu 14.04 | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :grey_question: |
Ubuntu 16.04 | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :grey_question: |
Debian 8.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :grey_question: |
Debian 9.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :grey_question: |
CentOS 6.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :grey_question: |
CentOS 7.x | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :grey_question: |
Fedora 最新版本 | :no_entry: | :no_entry: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :grey_question: |
- :white_check_mark: - 已测试,运行良好
- :grey_question: - 将来可能会运行(如果能帮忙请支持)
- :interrobang: - 可能有效,未测试
- :no_entry: - PostgreSQL 已达到生命周期结束
变量
# 基本设置
postgresql_version: 9.6
postgresql_encoding: "UTF-8"
postgresql_locale: "en_US.UTF-8"
postgresql_ctype: "en_US.UTF-8"
postgresql_admin_user: "postgres"
postgresql_default_auth_method: "trust"
postgresql_service_enabled: false # 服务是否启用,默认是 true
postgresql_cluster_name: "main"
postgresql_cluster_reset: false
# 要创建的数据库列表(可选)
# 注意:要获得更灵活的扩展,请使用 postgresql_database_extensions 设置。
postgresql_databases:
- name: foobar
owner: baz # 可选;指定数据库的所有者
hstore: yes # 在此数据库中安装 hstore 扩展的标志(yes/no)
uuid_ossp: yes # 在此数据库中安装 uuid-ossp 扩展的标志(yes/no)
citext: yes # 在此数据库中安装 citext 扩展的标志(yes/no)
encoding: "UTF-8" # 每个数据库覆盖全局 {{ postgresql_encoding }} 变量
lc_collate: "en_GB.UTF-8" # 每个数据库覆盖全局 {{ postgresql_locale }} 变量
lc_ctype: "en_GB.UTF-8" # 每个数据库覆盖全局 {{ postgresql_ctype }} 变量
# 要创建的数据库扩展列表(可选)
postgresql_database_extensions:
- db: foobar
extensions:
- hstore
- citext
# 要创建的用户列表(可选)
postgresql_users:
- name: baz
pass: pass
encrypted: no # 表明密码是否已加密。
# 要创建的模式列表(可选)
postgresql_schemas:
- database: foobar # 数据库名称
schema: acme # 模式名称
state: present
- database: foobar # 数据库名称
schema: acme_baz # 模式名称
owner: baz # 所有者名称
state: present
# 要应用的用户权限列表(可选)
postgresql_user_privileges:
- name: baz # 用户名称
db: foobar # 数据库
priv: "ALL" # 权限字符串格式:例如:INSERT,UPDATE/table:SELECT/anothertable:ALL
role_attr_flags: "CREATEDB" # 角色属性标志
还有很多其他的设置,可以在 defaults/main.yml 中找到
测试
这个项目附带一个 Vagrantfile,这是一个快速简单的方式来测试角色的更改,可以使用 vagrant up
启动它
查看 vagrant 文档 以了解如何设置 Vagrant
一旦你的虚拟机启动,可以用 vagrant provision
或 ansible-playbook tests/playbook.yml -i vagrant-inventory
重新配置它
如果你想玩一下测试剧本,查看 tests/playbook.yml,并在 tests/vars.yml 中更改变量
如果你要贡献,请先在 Vagrant 环境中测试你的更改(使用目标发行版),如果可能的话,确保你的更改在 .travis.yml 中被测试覆盖
许可证
根据 MIT 许可证发布。有关详细信息,请参见 LICENSE 文件。
感谢
创建者:
维护者:
主要贡献者:
反馈、错误报告、请求等...
欢迎提出!