-
Notifications
You must be signed in to change notification settings - Fork 1
/
apache.yml
41 lines (32 loc) · 821 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
35
36
37
38
39
40
41
---
- hosts: all
vars:
who: "World"
tasks:
# Setup
- name: ensure apache is at the latest version
apt:
name=apache2
state=latest
sudo: yes
- name: deploy sample HTML page
template:
src=index.html
dest=/var/www/html/
notify:
- restart apache
sudo: yes
- name: ensure apache is running (and enable it at boot)
service: name=apache2 state=started enabled=yes
# Tests
- name: test apache is responding
wait_for: host=localhost port=80
- name: test apache returns content
uri: url=http://localhost/ return_content=yes
register: webpage
- fail: msg='apache does not return content'
when: "'Hello World' not in webpage.content"
handlers:
- name: restart apache
service: name=apache2 state=restarted
sudo: yes