-
Notifications
You must be signed in to change notification settings - Fork 2
/
threetierapp.yml
160 lines (138 loc) · 5.1 KB
/
threetierapp.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
---
- name: Set up Groups for playbook
hosts: localhost
gather_facts: false
tasks:
- name: Create psql group
ansible.builtin.add_host:
hostname: "{{ psql_vm }}"
groups: pgsql
- name: Create jbcs group
ansible.builtin.add_host:
hostname: "{{ jbcs_vm }}"
groups: jbcs
- name: Create jboss group
ansible.builtin.add_host:
hostname: "{{ item }}"
groups: jboss
loop: "{{ jboss_vm.split(',') }}"
- name: Postgresql Setup
hosts: pgsql
become: true
roles:
- postgresql
- name: Installing prerequisites and Certs for JBCS
hosts: jbcs
become: true
gather_facts: False
roles:
- jcbs_prep
- name: Playbook for Loadbalancer Host
hosts: jbcs
become: true
vars:
rhn_username: "87ec2aa7-a357-4b3f-b2ca-a1f7ff92e062"
rhn_password: "{{ offline_token }}"
jbcs_bind_address: 0.0.0.0
jbcs_offline_install: false
jbcs_mod_cluster_enable: true
jbcs_zip_path: "{{ lookup('env', 'PWD') }}"
roles:
- redhat.jbcs.jbcs
- name: Deploy JBoss EAP
hosts: jboss
become: true
vars:
rhn_username: "87ec2aa7-a357-4b3f-b2ca-a1f7ff92e062"
rhn_password: "{{ offline_token }}"
eap_apply_cp: true
eap_version: 7.4.0
eap_offline_install: false
eap_install_workdir: '/opt/jboss_eap/'
eap_app_firewalld_enabled: true
eap_home: "{{ eap_install_workdir }}jboss-eap-7.4"
eap_service_config_file_location: "/etc"
eap_config_base: 'standalone-full-ha.xml'
eap_driver_module_name: 'org.postgresql'
eap_driver_version: 9.4.1212
eap_driver_jar_filename: "postgresql-{{ eap_driver_version }}.jar"
eap_driver_jar_url: "https://repo.maven.apache.org/maven2/org/postgresql/postgresql/{{ eap_driver_version }}/{{ eap_driver_jar_filename }}"
eap_enable_yml_config: True
eap_yml_configs:
- eap_configuration.yml.j2
roles:
- role: redhat.eap.eap_install
vars:
eap_firewalld_enabled: true
eap_install:
download_url: "{{ eap_install_download_url }}"
workdir: "{{ eap_install_workdir }}"
archive_dir: "/opt/jboss_eap"
archive_name: "{{ eap_archive_filename }}"
home: "{{ eap_home }}"
config: "{{ eap_config_custom_file | basename if eap_config_custom_file | length > 0 else eap_config_base }}"
config_custom: "{{ eap_config_custom_file }}"
user: "{{ eap_user }}"
group: "{{ eap_group }}"
java:
package_name: "{{ eap_java_package_name }}"
- role: redhat.eap.eap_systemd
vars:
eap_systemd:
user: "{{ eap_user }}"
group: "{{ eap_group }}"
home: "{{ eap_home }}"
config: "{{ eap_config_custom_file | basename if eap_config_custom_file | length > 0 else eap_config_base }}"
config_custom: "{{ eap_config_custom_file }}"
enabled: "{{ eap_systemd_unit_enabled }}"
yml_config:
base_path: '/modules/system/layers/base'
eap_path: '/modules/system/layers/base/.overlays/layer-base-jboss-eap-'
path: /org/jboss/as/controller/main/dir/META-INF/services
file: org.jboss.as.controller.persistence.ConfigurationExtension
selinux:
pid_path: "{{ eap_pidfile_homedir }}"
jvm_version_command:
RedHat: "rpm -ql {{ eap_java_package_name }} | grep -Po '/usr/lib/jvm/.*(?=/bin/java$)'"
Debian: "update-alternatives --query java | grep 'Value: ' | grep -o '/.*/jre'"
- redhat.eap.eap_driver
tasks:
- name: Ensure webapp has been retrieved
ansible.builtin.get_url:
url: "{{ app.url }}"
dest: "/opt/jboss_eap/jboss-eap-7.4/{{ app.name }}"
- name: Force all notified handlers to run at this point
ansible.builtin.meta: flush_handlers
- name: Ensure server's management interface is reachable with longer timeout
when: jboss_cli_connect | default(true)
ansible.builtin.wait_for:
host: localhost
port: 9990
timeout: 300
delay: 1
sleep: 2
- name: Deploy webapp
ansible.builtin.include_role:
name: redhat.eap.eap_utils
tasks_from: jboss_cli.yml
vars:
jboss_cli_query: "'deploy --force /opt/jboss_eap/jboss-eap-7.4/{{ app.name }}'"
post_tasks:
- name: Perform post deploy validation
ansible.builtin.include_role:
name: eap_app_validate
- name: Display jbcs link
ansible.builtin.debug:
msg: "https://{{ jbcs_vm }}/{{ app.name.split('.')[0] }}"
- name: Set stats for the e-mail body and ServiceNow
ansible.builtin.set_stats:
data:
email_body: "{{ jbcs_vm }}: https://{{ jbcs_vm }}/{{ app.name.split('.')[0] }} "
work_notes: "[code]<a href='https://{{ jbcs_vm }}/{{ app.name.split('.')[0] }}'>{{ jbcs_vm }}</a>[/code] "
expose_to_cloud_redhat_com_results: "{{ jbcs_vm }}: https://{{ jbcs_vm }}/{{ app.name.split('.')[0] }}"
run_once: true
- name: Set stats for the e-mail subject # noqa run-once[task]
ansible.builtin.set_stats:
data:
email_subject: Ansible App Link
run_once: true