{"id":19177221,"url":"https://github.com/mahdi22/ansible-postgresql","last_synced_at":"2026-05-05T13:35:34.464Z","repository":{"id":133216867,"uuid":"316303235","full_name":"mahdi22/ansible-postgresql","owner":"mahdi22","description":"Install and configure Postgresql server on Rhel/CentOS, Debian, Ubuntu and SUSE SLES ditributions","archived":false,"fork":false,"pushed_at":"2022-03-24T10:07:26.000Z","size":18,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-04T02:35:24.488Z","etag":null,"topics":["ansible","database","linux","postgresql"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mahdi22.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-26T17:58:26.000Z","updated_at":"2022-03-26T00:54:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"2b10a982-6dee-4675-bef1-636b61089088","html_url":"https://github.com/mahdi22/ansible-postgresql","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahdi22%2Fansible-postgresql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahdi22%2Fansible-postgresql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahdi22%2Fansible-postgresql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahdi22%2Fansible-postgresql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mahdi22","download_url":"https://codeload.github.com/mahdi22/ansible-postgresql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240254293,"owners_count":19772393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","database","linux","postgresql"],"created_at":"2024-11-09T10:32:33.318Z","updated_at":"2026-05-05T13:35:29.435Z","avatar_url":"https://github.com/mahdi22.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ansible role `postgresql`\n\n\nAn Ansible role for installing Postresql on Linux for RHEL/CentOS, Debian, Ubunut and SUSE SLES distributions. Specifically, the responsibilities of this role are to:\n\n- Install Postgresql\n- Configure Postgresql parameters and authentifications\n- Create users\n- Create databases\n\n## Installation\n``` bash\n$ ansible-galaxy install mahdi22.postgresql\n```\n\n## Role Variables\nvariable/main.yml\nSet postgresql configuration parameters or use default values\n```Yaml\npostgresql_config:\n  - option: port\n    value: 5432\n  - option: log_destination\n    value: syslog\n  - option: log_directory\n    value: /var/log/postgresql/\n```\nSet or modify postgresql authentification parameters or use default values\n```Yaml\npostgresql_authentication:\n  - {type: local, database: all, user: postgres, auth_method: peer}\n  - {type: local, database: all, user: all, auth_method: md5}\n  - {type: host, database: all, user: all, address: '127.0.0.1/32', auth_method: md5}\n  - {type: host, database: all, user: all, address: '::1/128', auth_method: md5}\n  - {type: local, database: replication, user: all, auth_method: peer}\n  - {type: host, database: replication, user: all, address: '127.0.0.1/32', auth_method: md5}\n  - {type: host, database: replication, user: all, address: '::1/128', auth_method: md5}\n```\nSet postgresql databases and users to create if not set create_users: no and create_databases: no in default/main.yml\n\nExample of creating multiple databases and users:  \n```Yaml\npostgresql_databases_users: []\n#postgresql_databases_users:\n#  - {database: test, user: user1, userpassword: user1pass, priv: ALL}  #add database 'user' and user 'user1' with password 'user1pass' with Privileges 'ALL'\n#  - {database: test1, user:'', userpassword: '', priv: ''}                  #add only database 'test1'\n#  - {database: '', user: user2, userpassword: user2pass, priv: ''}          #add only user 'user2' with password 'user2pass'\n```\n- To create only database without user set database: databasename, user:''\n- To create only user set database: '', user: username, userpassword: password\n- To create database with user PRIVILEGES set database: databasename, user: username, userpassword: password, priv: privileges\n### Basic configuration\n\n| Variable                       | Default                       | Comments                                                     |\n| :---                           | :---                          | :---                                                         |\n| `use_proxy      `              | 'False'                       | If managed hosts are behind web proxy set use_proxy: True   |\n| `http_proxy     `              | 'http://proxy.lab.local:8080/'| Set Proxy server and port replace proxy.lab.local:8080      |\n| `https_proxy`                  | 'http://proxy.lab.local:8080/'| Set Proxy server and port replace proxy.lab.local:8080      |\n| `postgresql_version`           |                               | Postgresql version that will be installed                   |\n| `listen_addresses_host_ip`     | yes                           | yes to active postgresql listen on network IP interface     |\n| `create_users`                 | yes                           | create postgresql users configured in variable files        |\n| `create_databases`             | yes                           | create postgresql databases configured in variable files    |\n\n#### Remarks\n\n(1) If managed hosts are behind web proxy set the folowing variables in defaults/main.yml file:\n```yaml\nuse_proxy: False\nproxy_env:\n  http_proxy: http://proxy.local:8080/\n  https_proxy: http://proxy.local:8080/\n```\n\n## Example Playbook\n\n```Yaml\n- hosts: dbservers\n  roles:\n    - role: mahdi22.postgresql\n      become: yes\n```\n\n## Testing\n\nThis role is tested on these Linux distributions:\n\n- RHEL/CentOS 8   postgresql version  (9.5, 9.4, 10, 11, 12, 13)\n- RHEL/CentOS 7   postgresql version  (9.5, 9.4, 10, 11, 12, 13)\n- Debian 10       postgresql version  (9.5, 9.4, 10, 11, 12, 13)\n- Debian 9        postgresql version  (9.5, 9.4, 10, 11, 12, 13)\n- Ubuntu 20.04    postgresql version  (9.5, 9.4, 10, 11, 12, 13)\n- Ubuntu 18.04    postgresql version  (9.5, 9.4, 10, 11, 12, 13)\n- Ubuntu 16.04    postgresql version  (9.5, 9.4, 10, 11, 12, 13)\n- Suse SLES 12    postgresql version  (9.5, 9.4, 10, 11, 12)\n- Suse SLES 15    postgresql version  (11, 12, 13)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahdi22%2Fansible-postgresql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahdi22%2Fansible-postgresql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahdi22%2Fansible-postgresql/lists"}