-
Notifications
You must be signed in to change notification settings - Fork 6
/
pre-deploy.yml
59 lines (54 loc) · 1.52 KB
/
pre-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
---
- name: Nginx Static HTML and Reverse Proxy
hosts: localhost
connection: local
become: true
tasks:
- name: Creating configuration directory
file:
path: /opt/docker/nginx/conf.d
state: directory
mode: '0755'
owner: pi
group: docker
# Create a default.conf file, but only if none exists.
- name: Creating basic configuration file
copy:
dest: /opt/docker/nginx/conf.d/default.conf
force: no
content: |
# This avoids an error message 'could not build server_names_hash'.
server_names_hash_bucket_size 64;
# Serve static files
server {
listen 80;
listen 443 ssl;
server_name {{ ansible_hostname }}.{{ ansible_domain }};
ssl_certificate /etc/ssl/certs/{{ ansible_hostname }}.{{ ansible_domain }}.crt;
ssl_certificate_key /etc/ssl/private/{{ ansible_hostname }}.{{ ansible_domain }}.key;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
- name: Creating a directory for static content
file:
path: /srv/www
state: directory
mode: '0755'
owner: pi
group: pi
- name: Creating a simple index.html
copy:
dest: /srv/www/index.html
force: no
content: |
<!DOCTYPE html>
<html>
<head>
<title>Not Dead</title>
</head>
<body>
<p>I'm not dead yet.</p>
</body>
</html>