-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathplaybook.yml
149 lines (125 loc) · 5.75 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
141
142
143
144
145
146
147
148
149
---
- hosts: all
vars:
# CONFIGURE THIS:
aem_jar_name: "cq-quickstart-6.4.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: 4602
aem_publish_port: 4603
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
# https://go-repo.io/
- name: Install Go (for tailon server)
shell: |
rpm --import https://mirror.go-repo.io/centos/RPM-GPG-KEY-GO-REPO
curl -s https://mirror.go-repo.io/centos/go-repo.repo | tee /etc/yum.repos.d/go-repo.repo
exit 0
args:
executable: /bin/bash
warn: false # Ansible prints a warning about using yum, blah blah blah... not interested =)
- name: Install dependencies [nano, java, httpd, golang, git]
yum: name="nano, java, httpd, golang, 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: 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, tailon]
- 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}}
- name: Install tailon
tags: tailon
copy: src="binaries/tailon/tailon" dest="/usr/bin/tailon"
- name: Install systemd service for Tailon
tags: tailon
template:
src: services/tailon.service
dest: /usr/lib/systemd/system/tailon.service
mode: u=rwx,g=rwx,o=rwx # dev box, remember :)
- name: Changing perm of "/usr/bin/tailon", adding "+x"
tags: tailon
file: dest=/usr/bin/tailon mode=01777 # dev box, remember :)
# for now, this service only starts tailon serever
- name: Start the systemd AEM deamon for tailon 4605
tags: tailon
systemd: name="tailon.service" state=restarted enabled=yes daemon_reload=yes no_block=yes
async: 0