-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdirect_server.yml
217 lines (182 loc) · 6.29 KB
/
direct_server.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
- name: Direct | Install required packages.
action: apt pkg={{item}} state=installed update_cache=yes
with_items: ["ant",
"unzip",
"expect",
"openjdk-7-jdk",
"nmap",
"python-pip",
"python-dev",
"netcat",
"openssl",
"libssl-dev"]
sudo: true
- name: Get EC2 Public IP if applicable
action: uri url=http://checkip.amazonaws.com
timeout=2
return_content=yes
ignore_errors: true
register: ec2_public_ip
sudo: true
- name: Register EC2 IP
action: set_fact public_ip="{{ec2_public_ip.content|default(ansible_default_ipv4.address)}}"
sudo: true
- name: Direct | PIP packagse
action: pip name={{item}}
with_items: ["suds", "pyopenssl", "dnspython"]
sudo: true
- name: Direct | Java policies
action: copy src=files/direct/java/{{item}} dest={{java_home}}/jre/lib/security/{{item}}
with_items:
- US_export_policy.jar
- local_policy.jar
sudo: true
- name: Direct | Get J-RI .tgz
action: get_url url={{jri_zip_file}} dest=/tmp/install/direct-stock.tgz
sudo: true
- name: Direct | Extract J-RI
action: command tar -xzvf /tmp/install/direct-stock.tgz
chdir=/opt
sudo: true
- name: Direct | Generate James SSL key
action: command keytool
-genkey
-alias james
-keyalg RSA
-keystore keystore
-storepass direct
-keypass direct
-dname 'CN=James Server SSL'
chdir=/opt/direct/james-2.3.2/apps/james/conf/
creates=/opt/direct/james-2.3.2/apps/james/conf/keystore
sudo: true
- name: Direct | James JCE
action: copy
src=files/direct/java/sunjce_provider.jar
dest=/opt/direct/james-2.3.2/lib/sunjce_provider.jar
sudo: true
- name: Direct | James config
action: template
src=templates/direct/james/{{item}}.j2
dest=/opt/direct/james-2.3.2/apps/james/SAR-INF/{{item}}
with_items:
- config.xml
- environment.xml
- assembly.xml
sudo: true
- name: Direct | Upstart DNS
action: template
src=templates/direct/upstart/direct-dns.conf.j2
dest=/etc/init/direct-dns.conf
sudo: true
- name: Direct | Upstart James
action: template
src=templates/direct/upstart/direct-james.conf.j2
dest=/etc/init/direct-james.conf
sudo: true
- name: Direct | Upstart Tomcat
action: template
src=templates/direct/upstart/direct-tomcat.conf.j2
dest=/etc/init/direct-tomcat.conf
sudo: true
- name: Direct | Start Tomcat
action: service name=direct-tomcat state=restarted
sudo: true
- name: Direct | Wait for Tomcat port
action: wait_for port=8081 delay=3 state=started timeout=600
sudo: true
- name: Direct | Wait for Tomcat config-service
action: get_url url=http://localhost:8081/config-service/ dest=/dev/null force=yes
sudo: true
- name: Direct | installer temp directory
action: file path=/tmp/install/direct/config_client_py state=directory
sudo: true
- name: Direct | copy python config client
action: copy src={{item}} dest=/tmp/install/direct/config_client_py/
with_fileglob: files/direct/config_client_py/*.py
sudo: true
- name: Direct | copy additional install scripts
action: copy src=files/direct/{{item}} dest=/tmp/install/direct/{{item}}
with_items:
- add_email_user.expect
- gencert.sh
sudo: true
- name: Direct | Python config client
action: command python add_domain.py {{direct_domain_name}} {{postmaster}}
chdir=/tmp/install/direct/config_client_py
sudo: true
- name: Direct | Start DNS
action: service name=direct-dns state=restarted
sudo: true
- name: Direct | Certificate generation templates
action: template
src=templates/direct/certificates/{{item}}.j2
dest=/tmp/install/direct/{{item}}
with_items:
- req-config
- sign-config
when: certificate_file is not defined
sudo: true
- name: Direct | Generate certificates
action: command sh gencert.sh
chdir=/tmp/install/direct
when: certificate_file is not defined
sudo: true
- name: Direct | Add certificate
action: command python add_certificate.py
/tmp/install/direct/cert-with-key-package.p12
chdir=/tmp/install/direct/config_client_py
when: certificate_file is not defined
sudo: true
- name: Direct | Create certs directory
action: file path=/opt/direct/certificates state=directory
when: certificate_file is not defined
sudo: true
- name: Direct | Copy certs out of tmp
action: command cp -r {{item}} .
chdir=/opt/direct/certificates
with_items:
- /tmp/install/direct/certificate.pem
- /tmp/install/direct/certificate.der
- /tmp/install/direct/cert-with-key-package.p12
- /tmp/install/direct/rsa-key.pem
when: certificate_file is not defined
sudo: true
- name: Direct | Add certificate
action: command python add_certificate.py {{certificate_file}}
chdir=/tmp/install/direct/config_client_py
when: certificate_file is defined
sudo: true
- name: Direct | Add DNS Host Records
action: command python add_dns.py {{item}} {{direct_domain_name}} {{public_ip}}
chdir=/tmp/install/direct/config_client_py
with_items: ["MX", "A"]
sudo: true
- name: Direct | Add DNS NS Record
action: command python add_dns.py NS {{direct_domain_name}} {{direct_name_server}}
chdir=/tmp/install/direct/config_client_py
sudo: true
- name: Direct | Add DNS NS A Record
action: command python add_dns.py A {{direct_name_server}} {{public_ip}}
chdir=/tmp/install/direct/config_client_py
sudo: true
- name: Direct | Config save incoming messages
action: command python add_setting.py IncomingMessageSaveFolder /opt/direct/incoming
chdir=/tmp/install/direct/config_client_py
sudo: true
- name: Direct | Add Trust Bundles
action: command python add_trust_bundle.py "{{item.name}}" "{{item.url}}"
chdir=/tmp/install/direct/config_client_py
with_items: trust_bundles
sudo: true
- name: Direct | Start James
action: service name=direct-james state=restarted
sudo: true
- name: Direct | Wait for James
action: wait_for port=4555 delay=3 state=started timeout=30
sudo: true
- name: Direct | Add Email Accounts
action: command expect add_email_user.expect {{item.username}} {{item.password}}
chdir=/tmp/install/direct
with_items: email_users
sudo: true