-
Notifications
You must be signed in to change notification settings - Fork 12
/
webservers.yml
33 lines (28 loc) · 1002 Bytes
/
webservers.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
---
- hosts: webservers
become: true
tasks:
- name: Install apache server
apt: name='apache2' state='present'
when: ansible_distribution == "Ubuntu"
- name: Install apache server
yum: name='httpd' state='present'
when: ansible_distribution == "Amazon"
- name: Start apache2 server1
service: name='apache2' state='started'
when: ansible_distribution == "Ubuntu"
- name: Start httpd server1
service: name='httpd' state='started'
when: ansible_distribution == "Amazon"
- name: copy html files to apache2 server
copy: src='./project-code/index.html' dest='/var/www/html/index.html'
notify:
- Restart apache server
- Start httpd server1
handlers:
- name: Restart apache server
service: name='apache2' state='restarted'
when: ansible_distribution == "Ubuntu"
- name: Start httpd server1
service: name='httpd' state='restarted'
when: ansible_distribution == "Amazon"