-
Notifications
You must be signed in to change notification settings - Fork 87
/
apache.yml
48 lines (46 loc) · 1.02 KB
/
apache.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
---
- hosts: webservers
become: True
vars:
- http_port: 80
tasks:
- name: Install packages
yum:
name: "{{item.name}}"
state: "{{item.state}}"
loop:
- { name: 'httpd', state: 'present' }
- { name: 'git', state: 'present' }
tags:
- install
when:
- ansible_os_family=="RedHat"
- ansible_architecture=="x86_64"
- name: Start Apache server
service:
name: httpd
state: started
enabled: True
tags:
- start
- name: Deploy static website from Git
git:
repo: https://github.com/javahometech/javahome-app
dest: /var/www/html/
tags:
- deploy
- name: Change port number
lineinfile:
path: /etc/httpd/conf/httpd.conf
regexp: '^Listen '
line: "Listen {{http_port}}"
notify:
- Restart Apache
tags:
- port
handlers:
- name: Restart Apache
service:
name: httpd
state: restarted
...