-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple_deploy.yml
48 lines (33 loc) · 1.2 KB
/
simple_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
---
- name: install Apache and upload simple web page
hosts: all
become: yes
vars:
source_file: ./for_deploy/index.html
destin_file: /var/www/html
tasks:
- name: Print linux distribution family
debug: var=ansible_os_family
- block: # RedHat block
- name: Install Apache package on RedHat
yum: name=httpd state=latest
- name: Upload web page
copy: src={{ source_file }} dest={{ destin_file }} mode=055
notify: Restart Apache service RedHat
- name: Start and enable Apache service on RedHat
service: name=httpd state=started enabled=yes
when: ansible_os_family == "RedHat"
- block: # Debian block
- name: Install Apache package on Debian
apt: name=apache2 state=latest
- name: Upload web page
copy: src={{ source_file }} dest={{ destin_file }} mode=055
notify: Restart Apache service Debian
- name: Start and enable Apache service on Debian
service: name=apache2 state=started enabled=yes
when: ansible_os_family == "Debian"
handlers:
- name: Restart Apache service RedHat
service: name=httpd state=restarted
- name: Restart Apache service Debian
service: name=apache2 state=restarted