-
Notifications
You must be signed in to change notification settings - Fork 2
/
deploy.yaml
47 lines (44 loc) · 1.09 KB
/
deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
- hosts: pi
become: yes
vars:
project_base_path: /opt/py-agent/
tasks:
- name: create base path
file:
path: "{{ project_base_path }}"
state: directory
- name: create base data path
file:
path: "{{ project_base_path }}/data/"
state: directory
- name: copy src to host
copy:
src: src/
dest: "{{ project_base_path }}"
# The ansible module seems to be real slow. It seems to not use the cache correctly
# - name: build images
# docker_image:
# build:
# path: "{{ project_base_path }}"
# pull: no
# name: py_agent
# source: build
# # force_source: yes
# register: out
- name: build images
shell:
cmd: "docker build -t py_agent {{ project_base_path }}"
register: out
- debug: var=out.stdout_lines
- name: start service
docker_container:
name: py_agent
image: py_agent
state: started
restart: yes
restart_policy: always
volumes:
- "{{ project_base_path }}/data:/opt/data/"
env:
PY_AGENT_DB_PATH: /opt/data/db.sqlite