playbooks/postgres/playbook.yml
tanshu 426bd8e82a Fix:
Postgres as supplying wrong env variable
2020-10-17 12:28:18 +05:30

32 lines
958 B
YAML
Executable File

#################################################
# DO Community Playbooks: Docker
#################################################
---
- hosts: all
become: true
vars_files:
- vars/default.yml
tasks:
- name: Pull default Postgresql image
docker_image:
name: "{{ postgres_image }}"
source: pull
# Creates the number of containers defined by the variable create_containers, using values from vars file
- name: Create postgres container
docker_container:
name: "{{ postgres_name }}"
image: "{{ postgres_image }}"
state: started
restart_policy: "unless-stopped"
env:
POSTGRES_USER: "{{ pg_user }}"
POSTGRES_PASSWORD: "{{ pg_password }}"
POSTGRES_DB: 'postgres'
PGDATA: '/var/lib/postgresql/data/pgdata'
published_ports:
- 5432:5432
volumes:
- /var/lib/postgresql/data:/var/lib/postgresql/data