-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapache.yml
34 lines (34 loc) · 941 Bytes
/
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
---
- hosts: 192.168.56.11
become: yes
vars:
- newport: 80
handlers:
- name: restart Apache
service: name=apache2 state=restarted
tasks:
- name: Update the ubuntu machine
apt: update_cache=yes force_apt_get=yes cache_valid_time=3600
- name: Install Apache
apt:
name: apache2
state: present
- name: Start and enable Apache
service:
name: apache2
state: started
enabled: yes
- name: Change the default port for Apache
lineinfile:
path: /etc/apache2/ports.conf
regexp: '^Listen \d+'
line: 'Listen {{ newport }}'
notify:
- restart Apache
- name: Change the default port in the defaults.conf file
lineinfile:
path: /etc/apache2/sites-enabled/000-default.conf
regexp: '^\<VirtualHost \*\:\d+\>'
line: '<VirtualHost *:{{ newport }}>'
notify:
- restart Apache