-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdirect_server.yml
207 lines (166 loc) · 6.63 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
- include: tasks/nodejs.yml
- 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"]
- 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
- name: Register EC2 IP
action: set_fact public_ip="{{ec2_public_ip.content|default(ansible_default_ipv4.address)}}"
- name: Direct | PIP packagse
action: pip name={{item}}
with_items: ["suds", "pyopenssl", "dnspython"]
- name: Direct | Firewall allow ssh
action: command ufw allow {{item}}
with_items: ["22", "53", "25", "995", "465"]
- 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
- name: Direct | Get J-RI .tgz
action: get_url url={{jri_zip_file}} dest=/tmp/install/direct-stock.tgz
- name: Direct | Extract J-RI
action: command tar -xzvf /tmp/install/direct-stock.tgz
chdir=/opt
- 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
- name: Direct | James JCE
action: copy
src=files/direct/java/sunjce_provider.jar
dest=/opt/direct/james-2.3.2/lib/sunjce_provider.jar
- 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
- name: Direct | Upstart DNS
action: template
src=templates/direct/upstart/direct-dns.conf.j2
dest=/etc/init/direct-dns.conf
- name: Direct | Upstart James
action: template
src=templates/direct/upstart/direct-james.conf.j2
dest=/etc/init/direct-james.conf
- name: Direct | Upstart Tomcat
action: template
src=templates/direct/upstart/direct-tomcat.conf.j2
dest=/etc/init/direct-tomcat.conf
- name: Direct | Start Tomcat
action: service name=direct-tomcat state=restarted
- name: Direct | Wait for Tomcat port
action: wait_for port=8081 delay=3 state=started timeout=600
- name: Direct | Wait for Tomcat config-service
action: get_url url=http://localhost:8081/config-service/ dest=/dev/null force=yes
- name: Direct | installer temp directory
action: file path=/tmp/install/direct/config_client_py state=directory
- 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
- 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
- name: Direct | Python config client
action: command python add_domain.py {{direct_domain_name}} {{postmaster}}
chdir=/tmp/install/direct/config_client_py
- name: Direct | Start DNS
action: service name=direct-dns state=restarted
- 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
- name: Direct | Generate certificates
action: command sh gencert.sh
chdir=/tmp/install/direct
when: certificate_file is not defined
- 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
- name: Direct | Create certs directory
action: file path=/opt/direct/certificates state=directory
when: certificate_file is not defined
- 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
- name: Direct | Add certificate
action: command python add_certificate.py {{certificate_file}}
chdir=/tmp/install/direct/config_client_py
when: certificate_file is defined
- 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"]
- 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
- 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
- name: Direct | Config save incoming messages
action: command python add_setting.py IncomingMessageSaveFolder /opt/direct/incoming
chdir=/tmp/install/direct/config_client_py
- 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
- name: Direct | Start James
action: service name=direct-james state=restarted
- name: Direct | Wait for James
action: wait_for port=4555 delay=3 state=started timeout=30
- name: Direct | Add Email Accounts
action: command expect add_email_user.expect {{item.username}} {{item.password}}
chdir=/tmp/install/direct
with_items: email_users
- name: CCDA reDirect | Create progress directory
action: file path=/opt/ccda-reDirect/progress state=directory
- name: CCDA reDirect | Clone repo
action: git repo=https://github.com/jmandel/ccda-reDirect
dest=/opt/ccda-reDirect/bin
version=HEAD
- name: CCDA reDirect | npm dependencies
action: command npm install
chdir=/opt/ccda-reDirect/bin
- name: CCDA reDirect | Upstart
action: template
src=templates/direct/upstart/ccda-reDirect.conf.j2
dest=/etc/init/ccda-reDirect.conf
- name: CCDA reDirect | start service
action: service name=ccda-reDirect state=restarted