-
Notifications
You must be signed in to change notification settings - Fork 8
/
nginx.yml
40 lines (39 loc) · 959 Bytes
/
nginx.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
---
- hosts: webservers1
vars:
packagename: "nginx"
tasks:
- name: setup apt repo
apt_repository:
repo: ppa:ondrej/nginx
- name: install nginx package
apt:
name: "{{ packagename }}"
state: latest
- name: create a dir multi dir
file:
path: /var/www/abc/tutorial
state: directory
- name: create a dir tutorial
file:
path: /var/www/tutorial
state: directory
- name: copy index file to tutorial dir
copy:
src: index.html
dest: /var/www/tutorial/index.html
notify: restart nginx server
- name: copy tutorial file to /etc/nginx/sites-enabled dir
copy:
src: tutorial
dest: /etc/nginx/sites-enabled/tutorial
notify: restart nginx server
- name: start nginx server
service:
name: "{{ packagename }}"
state: started
handlers:
- name: restart nginx server
service:
name: "{{ packagename }}"
state: restarted