forked from warriorssjsu/Ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook_webserver_deploy.yml
56 lines (45 loc) · 1.29 KB
/
playbook_webserver_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
---
- hosts : webservers
vars:
http_port: 80
tasks:
- name: test on port 80
ping:
- name: ensure apache is installed
apt:
name: apache2
state: present
become: yes
become_method: sudo
- name: ensure php is installed
apt:
name: php
state: present
become: yes
become_method: sudo
- name: start the server
service:
name: apache2
state: started
enabled: yes
become: yes
become_method: sudo
- name: making directory
file:
state: directory
path: /var/www/html
mode: 0777
become: yes
become_method: sudo
- name: deploying web page
copy:
src: hello.html
dest: /var/www/html/hello.html
notify: restart apache2
handlers:
- name: restart apache2
service:
name: apache2
state: restarted
become: yes
become_method: sudo