|
202 | 202 | - hugepage |
203 | 203 | - converttohugepage |
204 | 204 |
|
| 205 | +# Fixes #3 |
| 206 | +- name: Check if there are already Oracle instances |
| 207 | + become: true |
| 208 | + shell: "cat /etc/oratab 2> /dev/null | grep -v '#' | grep -v -e '^$' | wc -l" |
| 209 | + changed_when: false |
| 210 | + register: instance_count |
| 211 | + when: sysctl_stable | default(false) | bool |
| 212 | + tags: |
| 213 | + - db |
| 214 | + - rdbms |
| 215 | + - prepare |
| 216 | + - hugepage |
| 217 | + - converttohugepage |
| 218 | + |
| 219 | +- debug: |
| 220 | + var: instance_count |
| 221 | + tags: |
| 222 | + - db |
| 223 | + - rdbms |
| 224 | + - prepare |
| 225 | + - hugepage |
| 226 | + - converttohugepage |
| 227 | + |
205 | 228 | - name: Check if Transparent Hugepages are configured |
206 | 229 | shell: grep -w transparent_hugepage=never /etc/default/grub |
207 | 230 | changed_when: false |
|
216 | 239 | become: true |
217 | 240 | shell: "sysctl -a | grep -w vm.nr_hugepages | grep -o [0-9]*" |
218 | 241 | register: current_hugepages |
219 | | - when: (sysctl_stable | bool) |
| 242 | + when: (sysctl_stable | bool) and (instance_count.stdout | int > 0) |
220 | 243 | tags: |
221 | 244 | - hugepage |
222 | 245 |
|
223 | 246 | - name: Getting current shmall Value |
224 | 247 | become: true |
225 | 248 | shell: "cat /etc/sysctl.d/97-oracle-db-sysctl.conf | grep shmall | awk -F \"=\" {'print$2'}" |
226 | 249 | register: current_shmall |
227 | | - when: (sysctl_stable | bool) |
| 250 | + when: (sysctl_stable | bool) and (instance_count.stdout | int > 0) |
228 | 251 | tags: |
229 | 252 | - db |
230 | 253 | - prepare |
|
233 | 256 | become: true |
234 | 257 | shell: "cat /etc/sysctl.d/97-oracle-db-sysctl.conf | grep shmmax | awk -F \"=\" {'print$2'}" |
235 | 258 | register: current_shmmax |
236 | | - when: (sysctl_stable | bool) |
| 259 | + when: (sysctl_stable | bool) and (instance_count.stdout | int > 0) |
237 | 260 | tags: |
238 | 261 | - db |
239 | 262 | - prepare |
|
251 | 274 | # Only when sysctl is stable |
252 | 275 | - name: Calculating OS Kernel Parameter Settings shmall |
253 | 276 | set_fact: |
254 | | - shmall: "{{ (((sga_max_size|int * 1024 * 1024 * 1024 / 4096) * 1.01) + current_shmall.stdout|int)|int }}" |
255 | | - when: ((sysctl_stable | bool) and (shmall|int < ((sga_max_size|int * 1024 * 1024 * 1024 / 4096) * 1.01) + current_shmall.stdout|int)) |
| 277 | + shmall: "{{ (((sga_max_size|int * 1024 * 1024 * 1024 / 4096) * 1.01) + current_shmall.stdout|default(0)|int)|int }}" |
| 278 | + when: ((sysctl_stable | bool) and (shmall|int < ((sga_max_size|int * 1024 * 1024 * 1024 / 4096) * 1.01) + current_shmall.stdout|default(0)|int)) |
256 | 279 | tags: |
257 | 280 | - db |
258 | 281 | - prepare |
|
266 | 289 |
|
267 | 290 | - name: Calculating OS Kernel Parameter Settings shmmax |
268 | 291 | set_fact: |
269 | | - shmmax: "{{ (((sga_max_size|int * 1024 * 1024 * 1024) * 1.01) + current_shmmax.stdout|int)|int }}" |
270 | | - when: ((sysctl_stable | bool) and (shmmax|int < ((sga_max_size|int * 1024 * 1024 * 1024) * 1.01) + current_shmmax.stdout|int)) |
| 292 | + shmmax: "{{ (((sga_max_size|int * 1024 * 1024 * 1024) * 1.01) + current_shmmax.stdout|default(0)|int)|int }}" |
| 293 | + when: ((sysctl_stable | bool) and (shmmax|int < ((sga_max_size|int * 1024 * 1024 * 1024) * 1.01) + current_shmmax.stdout|default(0)|int)) |
271 | 294 | tags: |
272 | 295 | - db |
273 | 296 | - prepare |
|
281 | 304 |
|
282 | 305 | - name: Calculating Number of Hugepages |
283 | 306 | set_fact: |
284 | | - hugepages: "{{ (((sga_max_size|int * 1024 / 2) * 1.01) + current_hugepages.stdout|int)|int }}" |
| 307 | + hugepages: "{{ (((sga_max_size|int * 1024 / 2) * 1.01) + current_hugepages.stdout|default(0)|int)|int }}" |
285 | 308 | reboot_required: true |
286 | 309 | when: (sysctl_stable | bool) |
287 | 310 | tags: |
|
459 | 482 | changed_when: false |
460 | 483 | register: check_selinux_configuration |
461 | 484 | become: true |
462 | | - when: (not molecule_run | bool | default(false)) |
| 485 | + when: (not molecule_run | default(false) | bool) |
463 | 486 | tags: |
464 | 487 | - autostart |
465 | 488 | - db |
|
488 | 511 | state: "{{ selinux_desired_state }}" |
489 | 512 | register: selinux_configuration_change |
490 | 513 | become: true |
491 | | - when: '((not molecule_run | bool | default(false)) and ("SELinux state changed" in check_selinux_configuration.msg))' |
| 514 | + when: '((not molecule_run | default(false) | bool) and ("SELinux state changed" in check_selinux_configuration.msg))' |
492 | 515 | tags: |
493 | 516 | - autostart |
494 | 517 | - db |
|
0 commit comments