-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.yml
82 lines (76 loc) · 2.34 KB
/
main.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
76
77
78
79
80
81
82
# Install required packages
- hosts: all
roles:
- dependencies
tags:
- dependencies
# Optional: configure additional user access - default username is user
# - hosts: "group1"
# vars:
# ssh_key_paths:
# - files/group1/paul.key.pub
# - files/group1/paul.key.pub
# roles:
# - users
# Install the sample app
- hosts: all
name: Deploy reverse-proxy services with docker compose
tags:
- app
tasks:
- name: Deploy sample app
community.docker.docker_compose:
project_name: sample-app
definition:
version: "3"
services:
# Reverse proxy
nginx-proxy:
container_name: nginx-reverse-proxy
image: nginxproxy/nginx-proxy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- certs:/etc/nginx/certs
- vhosts:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
networks:
- internal
- external
nginx-proxy-acme:
container_name: nginx-proxy-acme
image: nginxproxy/acme-companion
restart: unless-stopped
environment:
NGINX_PROXY_CONTAINER: nginx-reverse-proxy
ACME_CA_URI: https://acme-staging-v02.api.letsencrypt.org/directory # comment this out to disable testing server
volumes:
- certs:/etc/nginx/certs
- vhosts:/etc/nginx/vhost.d
- acme:/etc/acme.sh
- html:/usr/share/nginx/html
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- internal
# Web app
whoami:
image: nginx
restart: unless-stopped
environment:
LETSENCRYPT_RESTART_CONTAINER: "true"
LETSENCRYPT_HOST: "{{ domain_name }}"
VIRTUAL_HOST: "{{ domain_name }}"
VIRTUAL_PATH: /
networks:
- internal
networks:
external:
internal:
volumes:
acme: {}
certs: {}
vhosts: {}
html: {}