-
Notifications
You must be signed in to change notification settings - Fork 19
/
playbook.yml
83 lines (81 loc) · 2.3 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
- name: Example Playbook
hosts: all
vars:
etc_hosts_add_all_hosts: true
tasks:
- name: Include ansible-etc-hosts
include_role:
name: ansible-etc-hosts
- name: Configuring Load Balancers
hosts: load_balancers
vars:
keepalived_config: true
keepalived_router_info:
- name: vrrp_1
check_script:
- name: chk_nginx
script: pidof nginx
interval: 2
weight: 2
master_node: "{{ groups['load_balancers'][0] }}"
router_id: 51
router_pri_backup: 100
router_pri_master: 150
vip_int: enp0s8
vip_addresses:
- 192.168.250.200
nginx_load_balancer_configs:
- name: web_app
frontend_listen_port: 80
location: /
method: round_robin
options:
- proxy_buffering off
- proxy_http_version 1.1
- "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for"
- "proxy_set_header Upgrade $http_upgrade"
- "proxy_set_header Connection $http_connection"
- access_log off
- proxy_pass http://127.0.0.1:8080
protocol: http
server_name:
- test.vagrant.local
# ssl: true
upstream:
- servers: "{{ groups['web_servers'] }}"
backend_listen_port: 80
options:
- fail_timeout=10s
- max_conns=0
- max_fails=1
- weight=1
nginx_load_balancer_headers:
- "Host $host"
- "X-Real-IP $remote_addr"
- "X-Forwarded-For $remote_addr"
- "X-Forwarded-Host $remote_addr"
pri_domain_name: test.vagrant.local
tasks:
- name: Include ansible-bootstrap-python
include_role:
name: ansible-bootstrap-python
- name: Include ansible-keepalived
include_role:
name: ansible-keepalived
- name: Include ansible-nginx-load-balancer
include_role:
name: ansible-nginx-load-balancer
- name: Configuring Web Servers
hosts: web_servers
vars:
config_nginx: true
nginx_headers:
- "set_real_ip_from 192.168.250.0/24"
- "real_ip_header X-Real-IP"
- "real_ip_recursive on"
pri_domain_name: test.vagrant.local
tasks:
- name: Include ansible-nginx
include_role:
name: ansible-nginx