additional course material RH294
Student User
2019-12-04 97d9af6275244e31f05c2916fc72a8daa9ea9fa0
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
- hosts: eenfachdj
  remote_user: localadm
  become: yes
  tasks:
    # items2dict(key='mount', value='device')
    - name: "getting rootfs device"
      shell: "/usr/sbin/zfs list -H -o name | egrep \"ROOT$\""
      register: rootfs_device
    - debug:
        msg: "the root-device is: {{rootfs_device.stdout}}"
    - name: "create /opt/ds dataset"
      zfs:
        name: "{{ rootfs_device.stdout }}/opt/ds"
        state: present
        extra_zfs_properties:
          mountpoint: /opt/ds
    - name: "install gnu-tar"
      pkg5:
        name: pkg:/archiver/gnu-tar
        state: present
    - name: "create dsadm group"
      group:
        name: dsadm
        gid: 1636
        state: present
    - name: "create dsadm user"
      user:
        name: dsadm
        uid: 1636
        group: 1636
        comment: "Directory Server Admin"
        home: /opt/ds
        shell: /bin/ksh
        state: present
    - file:
        dest: /opt/ds/.ssh
        state: directory
        owner: dsadm
        group: dsadm
        mode: 700
    - file:
        dest: "{{ item }}"
        state: directory
        owner: dsadm
        group: dsadm
        mode: 755
      loop:
        - /opt/ds
        - /opt/ds/install
        - /opt/ds/etc
        - /opt/ds/etc/ssl
        - /opt/ds/jks
        - /opt/ds/jdk
        - /opt/ds/monitoring
        - /opt/ds/bin
    - name: "copy ssh key to dsadm"
      copy:
        src: /export/home/olbohlen/.ssh/id_rsa.pub
        dest: /opt/ds/.ssh/authorized_keys
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy .profile"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/dot_profile
        dest: /opt/ds/.profile
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy JDK8..."
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/install/jdk-8u191-solaris-sparcv9.tar.gz
        dest: /opt/ds/install/jdk-8u191-solaris-sparcv9.tar.gz
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy OpenDJ"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/install/opendj-4.2.5.zip
        dest: /opt/ds/install/opendj-4.2.5.zip
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config
        dest: /opt/ds/config/config
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/00_myskel.ldif"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/00_myskel.ldif
        dest: /opt/ds/config/00_myskel.ldif
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/02_enable-replication.ksh"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/02_enable-replication.ksh
        dest: /opt/ds/config/02_enable-replication.ksh
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/03_init-replication.ksh"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/03_init-replication.ksh
        dest: /opt/ds/config/03_init-replication.ksh
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/04_enable_pre-enc_passwords.sh"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/04_enable_pre-enc_passwords.sh
        dest: /opt/ds/config/04_enable_pre-enc_passwords.sh
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/05_mygroups.ldif"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/05_mygroups.ldif
        dest: /opt/ds/config/05_mygroups.ldif
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/06_mypeople.ldif"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/06_mypeople.ldif
        dest: /opt/ds/config/06_mypeople.ldif
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/07_hosts.ldif"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/07_hosts.ldif
        dest: /opt/ds/config/07_hosts.ldif
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/08_myproxy.ldif"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/08_myproxy.ldif
        dest: /opt/ds/config/08_myproxy.ldif
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/09_netgroup.ldif"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/09_netgroup.ldif
        dest: /opt/ds/config/09_netgroup.ldif
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/10_addaci.ksh"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/10_addaci.ksh
        dest: /opt/ds/config/10_addaci.ksh
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/12_automount.ldif"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/12_automount.ldif
        dest: /opt/ds/config/12_automount.ldif
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/13_authattr.ldif"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/13_authattr.ldif
        dest: /opt/ds/config/13_authattr.ldif
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/14_profattr.ldif"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/14_profattr.ldif
        dest: /opt/ds/config/14_profattr.ldif
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/15_user_attr.ldif"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/15_user_attr.ldif
        dest: /opt/ds/config/15_user_attr.ldif
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/16_primadmin_prof.ldif"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/16_primadmin_prof.ldif
        dest: /opt/ds/config/16_primadmin_prof.ldif
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/ds-man.pass"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/ds-man.pass
        dest: /opt/ds/config/ds-man.pass
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/eenfach.de-dump3.ldif"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/config/eenfach.de-dump3.ldif
        dest: /opt/ds/config/eenfach.de-dump3.ldif
        mode: 644
        owner: dsadm
        group: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/jks/keystore.jks"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/jks/keystore.jks
        dest: /opt/ds/jks/keystore.jks
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/jks/keystore.pin"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/jks/keystore.pin
        dest: /opt/ds/jks/keystore.pin
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy service manifest"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/opendj.xml
        dest: /opt/ds/opendj.xml
        mode: 644
        owner: dsadm
        group: dsadm
    - name: "copy service method"
      copy:
        src: /export/home/olbohlen/git/ansible-playbooks/toy/files/ds/opends/svc-opendj
        dest: /lib/svc/method/svc-opendj
        mode: 555
        owner: root
        group: bin 
    - name: "extract JDK8..."
      unarchive:
        src: /opt/ds/install/jdk-8u191-solaris-sparcv9.tar.gz
        dest: /opt/ds/jdk
        remote_src: yes
        owner: dsadm
        group: dsadm
    - name: "creating jdk/latest symlink..."
      file:
        src: /opt/ds/jdk/jdk1.8.0_191
        dest: /opt/ds/jdk/latest
        owner: dsadm
        group: dsadm
        state: link
    - name: "unzip OpenDJ install archive"
      unarchive:
        src: /opt/ds/install/opendj-4.2.5.zip
        dest: /opt/ds
        remote_src: yes
        owner: dsadm
        group: dsadm
    # - name: Generate a Self Signed OpenSSL certificate
    #   openssl_certificate:
    #     path: /opt/ds/etc/ssl/dj-eenfach.crt
    #     privatekey_path: /opt/ds/etc/ssl/dj-eenfach.key
    #     csr_path: /opt/ds/etc/ssl/dj-eenfach.csr
    #     provider: selfsigned
    #     valid_in: 31536000
    #     subject_alt_name:
    #       - opendj.eenfach.de
    #       - "{{ inventory_hostname_short }}.eenfach.de"
    # - name: "import cert and key into keystore..."
    #   java_keystore:
    #     name: eenfachdj
    #     certificate: "{{lookup('file', '/opt/ds/etc/ssl/dj-eenfach.crt') }}"
    #     private_key: "{{lookup('file', '/opt/ds/etc/ssl/dj-eenfach.key') }}"
    #     password: '2)Pxqd*V>V/='
    #     dest: /opt/ds/jks/keystore.jks
    - name: "copy keystore..."
      copy:
        src: "files/ds/opends/etc/certs/keystore-{{ inventory_hostname_short }}.eenfach.de.jks"
        dest: /opt/ds/jks/keystore.jks
        mode: 600
        owner: dsadm
        group: dsadm
    - name: "creating pinfile..."
      copy:
        content: '123456'
        dest: /opt/ds/jks/keystore.pin
        mode: 600
        owner: dsadm
        group: dsadm
    - name: "installing OpenDJ..."
      shell: "./setup -n -i --acceptLicense --baseDN dc=eenfach,dc=de --useJavaKeystore /opt/ds/jks/keystore.jks --keyStorePasswordFile /opt/ds/jks/keystore.pin --cli -j /opt/ds/config/ds-man.pass -q"
      register: rootfs_device
      remote_user: dsadm
      become: no
      args:
        creates: /opt/ds/opendj/config
        chdir: /opt/ds/opendj