-
Notifications
You must be signed in to change notification settings - Fork 1
/
webserver001.yml
43 lines (37 loc) · 871 Bytes
/
webserver001.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
---
- name: Webserver installation
hosts: webserver001
become: true
tasks:
- name: Update and upgrade apt packages
apt:
update_cache: yes
upgrade: "yes"
- name: Install UFW
apt:
name: ufw
state: present
- name: Setup rules
command: "{{ item }}"
with_items:
- ufw default deny incoming
- ufw allow ssh
- ufw allow http
- ufw allow https
- ufw --force enable
- name: nginx
apt:
name: nginx
state: present
- name: Delete content & directory
file:
state: absent
path: "/var/www/html/index.nginx-debian.html"
- name: "copying the web pages"
template:
src: "index.html"
dest: "/var/www/html/index.html"
- name: "start nginx"
service:
name: "nginx"
state: started