barker/docker/roles/docker/tasks/main.yaml

27 lines
662 B
YAML

---
# Tasks for docker role
- name: Build barker image
docker_image:
name: barker:latest
build:
path: "/tmp/{{ host_directory }}/"
dockerfile: "/tmp/{{ host_directory }}/Dockerfile"
pull: yes
state: present
source: build
- name: Create barker container
docker_container:
name: "{{ host_directory }}"
image: barker:latest
state: started
restart_policy: "unless-stopped"
env_file: "/var/lib/{{ host_directory }}/.env"
links:
- "postgres:db"
- "redis:redis"
published_ports:
- "127.0.0.1:{{ host_port }}:80"
volumes:
- "/var/lib/{{ host_directory }}/frontend:/frontend"