Pinned a version so that watchdog does not upgrade versions. Made the host directory configurable
38 lines
1.0 KiB
YAML
Executable File
38 lines
1.0 KiB
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
|
|
force_source: yes
|
|
|
|
- name: Ensure Nextcloud Directory exists
|
|
file:
|
|
path: "/var/lib/{{ host_directory }}"
|
|
state: directory
|
|
mode: 0755
|
|
|
|
- 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: "{{ data_location }}/pgdata"
|
|
published_ports:
|
|
- 5432:5432
|
|
volumes:
|
|
- "/var/lib/{{ host_directory }}/data:{{ data_location }}"
|