forked from adolfodepazvela/AEM-UP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook.yml
141 lines (118 loc) · 5.22 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
---
- hosts: all
vars:
# CONFIGURE THIS:
aem_jar_name: "cq-quickstart-6.5.0.jar" # The AEM JAR file name in /user-provided
# The dispatcher module file name in /user-provided.
# Make sure you have the uncompressed `.so` file in /user-provided (not the zipped `.gz` file)
dispatcher_module_name: "dispatcher-apache2.4-4.2.3.so"
aem_publish_runmodes: publish,samplecontent
aem_author_runmodes: author,samplecontent
# Ports on VM
# NOTE: To change ports on your localhost, change them in Vagrantfile
aem_author_port: 4502
aem_publish_port: 4503
aem_dispatcher_port: 4604
# Configurations that may or may not need to be modified somewhere else :)
# Absolute paths to AEM folders on the VM
author_folder: /home/vagrant/aem-author
publish_folder: /home/vagrant/aem-publish
user_provided_folder: /home/vagrant/user-provided
service_path: /usr/lib/systemd/system
# Handlers
handlers:
# Restart apache, needed for when we make changes to apache files
- name: restart apache
service: name=httpd state=restarted
# Ansible tasks
tasks:
# CAUTION: ONLY FOR LOCAL DEV BOX, ***DO NOT*** USE THIS FOR PRODUCTION :)
# Solves for the issue of "Permission denied" when running dispatcher, even as root.
# for adobe's solution, see section "Apache Web Server - Configure SELinux Properties"
# of https://helpx.adobe.com/experience-manager/dispatcher/using/dispatcher-install.html
# Note: this runs the first time you setup your VM, subsequesnt provesions do not run this task.
- name: Disable SELinux
selinux: state=disabled
register: disable_selinux_result
# Reboot ONLY if Disable SELinux task was changed (only first time)
- name: Restarting VM (only runs when SELinux task is changed)
shell: "sleep 5 && reboot"
async: 1
poll: 0
when: disable_selinux_result is changed
- name: Wait for the reboot to complete if there was a change.
wait_for_connection: connect_timeout=20 sleep=5 delay=5 timeout=300
when: disable_selinux_result is changed
- name: Install dependencies [nano, java, httpd, git]
yum: name="nano, java, httpd, git" state=latest
# Some OS's have smaller limit of number of concurrent open files.
# AEM opens a lot of files, so we max that limit here
- name: Set open file limit for all users
pam_limits: domain=* limit_type=hard limit_item=nofile value=64000
- name: Unpack AEM JAR to Author and Publish directories
command: java -jar {{aem_jar_name}} -unpack -b "{{item.folder}}" -quickstart.server.port {{aem_publish_port}} -r {{item.runmode}}
args:
chdir: "{{user_provided_folder}}"
creates: "{{item.folder}}/crx-quickstart"
with_items:
- { folder: "{{publish_folder}}", runmode: "{{aem_publish_runmodes}}" }
- { folder: "{{author_folder}}", runmode: "{{aem_author_runmodes}}" }
- name: Create crx-quickstart/install folder
tags: copy_packages
file:
path: "{{author_folder}}/crx-quickstart/install"
state: directory
- name: Link the author install dir to the publish install dir
tags: copy_packages
file:
path="{{publish_folder}}/crx-quickstart/install"
src="{{author_folder}}/crx-quickstart/install"
state=link
force=yes
- name: Add installable packages to the author
tags: copy_packages
copy:
src="{{item}}"
dest="{{author_folder}}/crx-quickstart/install"
with_fileglob:
- packages/*.zip
- name: Copy license file to author and publish locations
command: cp {{user_provided_folder}}/license.properties {{item}}
args:
chdir: "{{user_provided_folder}}"
creates: "{{item}}/license.properties"
with_items: ["{{publish_folder}}", "{{author_folder}}"]
- name: Install systemd service for Author and Publish
template:
src: services/{{item}}.service
dest: /usr/lib/systemd/system/{{item}}.service
mode: u=rwx,g=rwx,o=rwx # dev box, remember :)
with_items: [aem-publish, aem-author]
- name: Start the systemd AEM deamon for author and publish
systemd: name="{{item}}.service" state=started enabled=yes daemon_reload=yes no_block=yes
async: 400
poll: 10
with_items: [aem-publish, aem-author]
- name: Copy dispatcher module to apache
tags: aem_dispatcher
copy: src="user-provided/{{dispatcher_module_name}}" dest="/etc/httpd/modules/mod_dispatcher.so"
notify:
- restart apache
# here, we copy
- name: Configure Dispatcher
tags: aem_dispatcher
template:
src: dispatcher/{{item.name}}
dest: /etc/httpd/{{item.rePath}}
# mode: u=rwx,g=rwx,o=rwx # dev box, remember :)
notify:
- restart apache
with_items:
- { name: 00-dispatcher.conf, rePath: conf.modules.d/00-dispatcher.conf }
- { name: dispatcher.conf, rePath: conf.d/dispatcher.conf }
- { name: dispatcher.any, rePath: conf/dispatcher.any }
- name: Waiting for AEM author to bind to port
tags: aem_author
wait_for: port={{aem_author_port}}
- name: Waiting for AEM publish to bind to port
wait_for: port={{aem_publish_port}}