-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook.yml
54 lines (44 loc) · 1.01 KB
/
playbook.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
49
50
51
52
53
---
- hosts: proxy
vars:
- s_port: 80
tasks:
- name: installing HaProxy...
package:
name: haproxy
state: present
- name: copying the configuration file...
template:
src: haproxy.j2
dest: /etc/haproxy/haproxy.cfg
notify: restarting haproxy...
- name: starting the service...
service:
name: haproxy
state: started
enabled: yes
register: started
- name: setting up facts...
set_fact:
condition_restart: "{{ started.changed==False }}"
handlers:
- name: restarting haproxy...
service:
name: haproxy
state: restarted
when: condition_restart
- hosts: server
tasks:
- name: installing httpd...
package:
name: httpd
state: present
- name: starting service...
service:
name: httpd
state: started
enabled: yes
- name: copying content...
template:
src: index.j2
dest: /var/www/html/index.html