{"id":15685539,"url":"https://github.com/levonet/ansible-docker-postgres","last_synced_at":"2025-04-28T16:44:53.551Z","repository":{"id":55438873,"uuid":"159377038","full_name":"levonet/ansible-docker-postgres","owner":"levonet","description":"Ansible role to manage and run the PostgreSQL docker container","archived":false,"fork":false,"pushed_at":"2020-12-31T12:22:02.000Z","size":9,"stargazers_count":10,"open_issues_count":0,"forks_count":8,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-30T11:24:34.531Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://galaxy.ansible.com/levonet/docker_postgres","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/levonet.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-27T17:55:03.000Z","updated_at":"2024-05-09T03:43:35.000Z","dependencies_parsed_at":"2022-08-15T00:20:25.931Z","dependency_job_id":null,"html_url":"https://github.com/levonet/ansible-docker-postgres","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levonet%2Fansible-docker-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levonet%2Fansible-docker-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levonet%2Fansible-docker-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levonet%2Fansible-docker-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/levonet","download_url":"https://codeload.github.com/levonet/ansible-docker-postgres/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251347952,"owners_count":21575184,"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":[],"created_at":"2024-10-03T17:26:20.706Z","updated_at":"2025-04-28T16:44:53.534Z","avatar_url":"https://github.com/levonet.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"PostgreSQL Role\n===============\n[![Build Status](https://travis-ci.org/levonet/ansible-docker-postgres.svg?branch=master)](https://travis-ci.org/levonet/ansible-docker-postgres)\n\nAnsible role to manage and run the PostgreSQL docker container.\n[More information](https://hub.docker.com/r/library/postgres/) about using docker image.\n\nRole Variables\n--------------\n\n- `docker_postgres__name` (default: postgres): This name used in name of home folder path and in name of container.\n- `docker_postgres__image` (default: postgres:latest)\n- `docker_postgres__port` (default: 5432)\n- `docker_postgres__superuser_name` (default: postgres): This variable will create the specified user with superuser power and a database with the same name.\n- `docker_postgres__superuser_password` (default: postgres): This environment variable sets the superuser password for PostgreSQL.\n- `docker_postgres__file_volumes` (optional): Mount files into docker.\n- `docker_postgres__env` (optional): Environment Variables.\n- `docker_postgres__network_mode` (default: host): Connect the container to a network.\n- `docker_postgres__networks` (default: []): List of networks the container belongs to.\n- `docker_postgres__purge_networks`(default: no): Enforce the removal of the default network (and all other networks not explicitly mentioned in networks).\n- `docker_postgres__log_driver` (default: json-file): Specify the logging driver.\n- `docker_postgres__log_options` (optional): Dictionary of options specific to the chosen log_driver. See [Configure logging drivers](https://docs.docker.com/engine/admin/logging/overview/) for details.\n- `docker_postgres__remove_existing_home_dir` (default: no): Remove home directory of instance with data and old configs before setup postgres. It's needed for CI.\n- `docker_postgres__remove_existing_container` (default: yes)\n- `docker_postgres__pull_image` (default: yes)\n- `docker_postgres__wait_for_start` (default: no): Waiting for startup postgres container.\n- `docker_postgres__pg_hba_conf`: This variable contains content of `pg_hba.conf`.\n- `docker_postgres__postgresql_conf`: This variable contains content of `postgresql.conf`.\n\nReplication settings:\n\n- `docker_postgres__slave` (default: no): Make a base backup from master and run postgres container as slave.\n- `docker_postgres__master_host` (default: localhost): Host of master database.\n- `docker_postgres__master_port` (default: 5432): Port of master database.\n- `docker_postgres__recovery_conf`: This variable contains content of `recovery.conf`.\n\nDependencies\n------------\n\n- `docker`\n\nExample Playbook\n----------------\n\n```yaml\n- hosts: all\n  become: yes\n  become_method: sudo\n  roles:\n  - role: levonet.docker_postgres\n    docker_postgres__name: postgres-11\n    docker_postgres__image: postgres:11.1-alpine\n    docker_postgres__port: 5678\n    docker_postgres__superuser_name: superuser\n    docker_postgres__superuser_password: supersecret\n    docker_postgres__env:\n      POSTGRES_DB: my_db\n    docker_postgres__log_driver: syslog\n    docker_postgres__log_options:\n      syslog-facility: local0\n      tag: \"{{ docker_postgres__name }}\"\n```\n\nAn example of running a PostgreSQL cluster on a single server\n------------------------------------------------------------\n\nChange the IP address `10.0.0.1` to a valid server address.\n\n```yaml\n- hosts: all\n  become: yes\n  become_method: sudo\n  vars:\n    docker_postgres__superuser_password: supersecret\n    docker_postgres__master_host: 10.0.0.1\n    docker_postgres__master_port: 5550\n  pre_tasks:\n  - set_fact:\n      docker_postgres__postgresql_conf: |\n        {{ docker_postgres__postgresql_conf }}\n        max_wal_senders = 10\n        wal_keep_segments = 64\n        hot_standby = on\n        synchronous_standby_names = 'ANY 1 (*)'\n  roles:\n  - role: levonet.docker_postgres\n    docker_postgres__name: postgres-master\n    docker_postgres__port: \"{{ docker_postgres__master_port }}\"\n  - role: levonet.docker_postgres\n    docker_postgres__name: postgres-salve-1\n    docker_postgres__port: 5551\n    docker_postgres__slave: yes\n  - role: levonet.docker_postgres\n    docker_postgres__name: postgres-salve-2\n    docker_postgres__port: 5552\n    docker_postgres__slave: yes\n```\n\nLicense\n-------\n\n[MIT](https://opensource.org/licenses/MIT)\n\nAuthor Information\n------------------\n\nThis role was created by [Pavlo Bashynskyi](https://github.com/levonet)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevonet%2Fansible-docker-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flevonet%2Fansible-docker-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevonet%2Fansible-docker-postgres/lists"}