forked from CleverCloud/expressjs-mongodb-statsd-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.yml
75 lines (70 loc) · 1.48 KB
/
deploy.yml
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
- hosts:
- localhost
tasks:
- name: Install python-docker on Debian
apt:
name: "python-docker"
state: present
update_cache: yes
when: ansible_pkg_mgr == "apt"
ignore_errors: yes
tags: initial
- name: Install python-docker on Redhat-based
yum:
name: "python-docker-py"
state: present
when: ansible_os_family == "RedHat"
tags: initial
- name: Build webapp image
docker_image:
dockerfile: Dockerfile
name: webapp
state: present
force: yes
push: no
pull: no
path: "{{ playbook_dir }}"
tags:
- build
- webapp
- name: Create private network
docker_network:
name: db_net
state: present
tags: network
- name: Start MongoDB container
docker_container:
name: mongod
debug: yes
detach: yes
hostname: mongod
image: mongo
networks:
- name: db_net
purge_networks: yes
exposed_ports: "27017/tcp"
pull: no
state: started
tags:
- db
- start
- name: Start webapp container
docker_container:
name: webapp
debug: yes
detach: yes
hostname: webapp
image: "webapp"
networks:
- name: db_net
published_ports: "8080:8080"
exposed_ports: "8080/tcp"
pull: no
state: started
env:
MONGODB_ADDON_URI: "mongodb://mongod:27017/test"
PORT: "8080"
tags:
- webapp
- start