-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathpreview_nginx_site_admin.yml
52 lines (45 loc) · 1.39 KB
/
preview_nginx_site_admin.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
---
- hosts: frontend
gather_facts: no
vars:
- nginx_site_file: "config/nginx/preview_admin_app_site.j2"
- nginx_admin_settings_directory: "/etc/nginx/admin-config"
- nginx_admin_settings_file: "/etc/nginx/admin-config/htpasswd"
tasks:
- name: Create the custom config directory
become: yes
file:
path: "{{ nginx_admin_settings_directory }}"
state: directory
# file generated with `htpasswd -n demo`, user = demo, pass = wiringbits
- name: Copy the site password
become: yes
copy:
src: "{{ nginx_admin_password_file }}"
dest: "{{ nginx_admin_settings_file }}"
- name: Create the sites-available directory
become: yes
file:
path: /etc/nginx/sites-available
state: directory
- name: Copy the site config
become: yes
template:
src: "{{ nginx_site_file }}"
dest: /etc/nginx/sites-available/{{ admin_app_domain }}
- name: Create the sites-enabled directory
become: yes
file:
path: /etc/nginx/sites-enabled
state: directory
- name: Enable the site
become: yes
file:
src: /etc/nginx/sites-available/{{ admin_app_domain }}
dest: /etc/nginx/sites-enabled/{{ admin_app_domain }}
state: link
- name: Reload nginx config
become: yes
service:
name: nginx
state: reloaded