-
Notifications
You must be signed in to change notification settings - Fork 1
/
ngrinx.yml
48 lines (43 loc) · 1.11 KB
/
ngrinx.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
---
- hosts: apps
tasks:
- name: Install Nginx
apt:
name: nginx
become: yes
- name: Create static-site folder
file:
dest: /home/vagrant/static-site
mode: u+rwrx
state: directory
- name: Copy configuration files
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: u+rwrx
with_items:
- src: static_site.cfg
dest: /etc/nginx/sites-available/static_site.cfg
- src: ansible-logo.jpeg
dest: /home/vagrant/static-site/ansible-logo.jpeg
- src: index.html
dest: /home/vagrant/static-site/index.html
become: yes
notify:
- Restart nginx
- name: Create symlink for the static site and the default site
file:
src: /etc/nginx/sites-available/static_site.cfg
dest: /etc/nginx/sites-enabled/default
state: link
force: yes
become: yes
handlers:
- name: Restart nginx
systemd:
name: nginx
state: reloaded
enabled: yes
become: yes