39 lines
938 B
YAML
Executable File
39 lines
938 B
YAML
Executable File
#################################################
|
|
# DO Community Playbooks: Docker
|
|
#################################################
|
|
---
|
|
- hosts: all
|
|
become: true
|
|
vars_files:
|
|
- vars/frank.yml
|
|
|
|
tasks:
|
|
- name: Copy dockerfile
|
|
synchronize: src=app dest=/tmp
|
|
|
|
- name: Build frank image
|
|
docker_image:
|
|
name: frank:latest
|
|
build:
|
|
path: /tmp/app/
|
|
dockerfile: /tmp/app/frank.Dockerfile
|
|
pull: yes
|
|
state: present
|
|
source: build
|
|
|
|
- name: Upload the worker .env file
|
|
template:
|
|
src: "files/frank.env"
|
|
dest: "/home/pi/frank.env"
|
|
|
|
- name: Create frank worker container
|
|
docker_container:
|
|
name: "frank"
|
|
image: frank:latest
|
|
state: started
|
|
restart_policy: "unless-stopped"
|
|
env_file: "/home/pi/frank.env"
|
|
network_mode: "host"
|
|
devices:
|
|
- "{{ printer_port }}:/printer"
|