forked from SantanderMetGroup/ansible-thredds-cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook.yml
executable file
·124 lines (116 loc) · 3.15 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
---
- name: deploy apache in all hosts
hosts: all
become: true
become_method: sudo
vars_files:
- "{{ansible_distribution}}-{{ansible_distribution_major_version}}.yml"
roles:
- role: apache
# - name: configure reverse_proxy
# hosts: centos6
# vars_file:
# - "{{ansible_distribution}}-{{ansible_distribution_major_version}}.yml"
# include_role:
# name: load-balancer
# tasks_from: reverse_proxy
# - name: configure load-balance mod jk
# hosts: centos6
# vars_file:
# - "{{ansible_distribution}}-{{ansible_distribution_major_version}}.yml"
# tasks:
# - name: mod jk file
# include_role:
# name: load-balancer
# tasks_from: jk_module
# tags: jkmod
- name: Deploy Java
hosts: workers
become: true
become_method: sudo
tasks:
- name: Install Java 1.7
yum:
name: java-1.7.0-openjdk
state: present
tags: java
- name: deploy 2 TDS instances in Workers
become: true
become_method: sudo
hosts: workers
vars:
tomcat_instances:
- name: foo
service_name: tomcat@foo
port_ajp: 18009
port_connector: 18080
port_redirect: 18443
port_shutdown: 18005
jvm_route: "{{ inventory_hostname }}1"
- name: bar
service_name: tomcat@bar
port_ajp: 28009
port_connector: 28080
port_redirect: 28443
port_shutdown: 28005
jvm_route: "{{ inventory_hostname }}2"
roles:
- ansible-tomcat
tags: deploy_tomcat
- name: jk workers
become: true
become_method: sudo
hosts: workers
vars_files:
- "{{ansible_distribution}}-{{ansible_distribution_major_version}}.yml"
roles:
- load-balancer
tags: jk_workers
- name: Deploy nginx in CentOS 6
become: true
become_method: sudo
hosts: centos6
vars:
nginx_http_params:
- sendfile "on"
- access_log "/var/log/nginx/access.log"
nginx_sites:
bar:
template: load-balancer.conf.j2
server_name: localhost
server_ip: "{{hostvars[inventory_hostname]['ip_address']}}"
server_port: 8080
backend_name: tomcat
backends:
- name: w11
backend: "{{hostvars['worker1']['ip_address']}}"
backend_port: 18080
- name: w12
backend: "{{hostvars['worker1']['ip_address']}}"
backend_port: 28080
- name: w21
backend: "{{hostvars['worker2']['ip_address']}}"
backend_port: 18080
- name: w22
backend: "{{hostvars['worker2']['ip_address']}}"
backend_port: 28080
roles:
- ansible-role-nginx
tags: nginx
- name: HAProxy in workers
hosts: worker2
vars:
haproxy_configs:
loadbalance:
haproxy_port: 8080
balance_directive: leastconn
servers:
- name: "{{hostvars['centos6']['inventory_hostname']}}-httpd"
ip: "{{hostvars['centos6']['ip_address']}}"
port: "{{hostvars['centos6']['httpd_port']}}"
- name: "{{hostvars['centos6']['inventory_hostname']}}-nginx"
ip: "{{hostvars['centos6']['ip_address']}}"
port: 8080
roles:
- HAproxy
tags: haproxy