|
12 | 12 | ansible.builtin.set_fact:
|
13 | 13 | __sap_hana_preconfigure_fact_thp: "{{ __sap_hana_preconfigure_boot_command_line_args['thp']['args'][0].split('=')[1] }}"
|
14 | 14 | when:
|
| 15 | + - __sap_hana_preconfigure_boot_command_line_args['thp']['arch'] is defined |
15 | 16 | - sap_hana_preconfigure_thp is undefined or sap_hana_preconfigure_thp | length == 0
|
16 | 17 |
|
17 |
| -- name: Add boot command line args for configuring THP |
18 |
| - ansible.builtin.set_fact: |
19 |
| - __sap_hana_preconfigure_boot_command_line_args_final: >- |
20 |
| - {{ __sap_hana_preconfigure_boot_command_line_args_final + ['transparent_hugepage=' + __sap_hana_preconfigure_fact_thp] }} |
| 18 | +- name: Add boot command line args for configuring THP if applicable |
| 19 | + when: |
| 20 | + - (sap_hana_preconfigure_thp is defined and sap_hana_preconfigure_thp | length > 0) |
| 21 | + or __sap_hana_preconfigure_boot_command_line_args['thp']['arch'] is defined |
| 22 | + block: |
21 | 23 |
|
22 |
| -- name: Configure - Get initial status of THP |
23 |
| - ansible.builtin.command: cat /sys/kernel/mm/transparent_hugepage/enabled |
24 |
| - register: __sap_hana_preconfigure_register_thp_status_before |
25 |
| - changed_when: false |
| 24 | + - name: Add boot command line args for configuring THP |
| 25 | + ansible.builtin.set_fact: |
| 26 | + __sap_hana_preconfigure_boot_command_line_args_final: >- |
| 27 | + {{ __sap_hana_preconfigure_boot_command_line_args_final |
| 28 | + + ['transparent_hugepage=' + __sap_hana_preconfigure_fact_thp] }} |
26 | 29 |
|
27 |
| -- name: Set THP to '{{ __sap_hana_preconfigure_fact_thp }}' on the running system |
28 |
| - ansible.builtin.shell: echo '{{ __sap_hana_preconfigure_fact_thp }}' > /sys/kernel/mm/transparent_hugepage/enabled |
29 |
| - changed_when: true |
30 |
| - when: |
31 |
| - - not ansible_check_mode |
32 |
| - - __sap_hana_preconfigure_register_thp_status_before.stdout.split('[')[1].split(']')[0] != __sap_hana_preconfigure_fact_thp |
33 |
| - |
34 |
| -- name: Configure - Get the status of THP |
35 |
| - ansible.builtin.command: cat /sys/kernel/mm/transparent_hugepage/enabled |
36 |
| - register: __sap_hana_preconfigure_register_thp_status |
37 |
| - ignore_errors: true |
38 |
| - changed_when: false |
39 |
| - |
40 |
| -- name: Display the status of THP |
41 |
| - ansible.builtin.debug: |
42 |
| - var: __sap_hana_preconfigure_register_thp_status.stdout_lines, __sap_hana_preconfigure_register_thp_status.stderr_lines |
| 30 | + - name: Configure - Get initial status of THP |
| 31 | + ansible.builtin.command: cat /sys/kernel/mm/transparent_hugepage/enabled |
| 32 | + register: __sap_hana_preconfigure_register_thp_status_before |
| 33 | + changed_when: false |
| 34 | + |
| 35 | + - name: Set THP to '{{ __sap_hana_preconfigure_fact_thp }}' on the running system |
| 36 | + ansible.builtin.shell: echo '{{ __sap_hana_preconfigure_fact_thp }}' > /sys/kernel/mm/transparent_hugepage/enabled |
| 37 | + changed_when: true |
| 38 | + when: |
| 39 | + - not ansible_check_mode |
| 40 | + - __sap_hana_preconfigure_register_thp_status_before.stdout.split('[')[1].split(']')[0] != __sap_hana_preconfigure_fact_thp |
| 41 | + |
| 42 | + - name: Configure - Get the status of THP |
| 43 | + ansible.builtin.command: cat /sys/kernel/mm/transparent_hugepage/enabled |
| 44 | + register: __sap_hana_preconfigure_register_thp_status |
| 45 | + ignore_errors: true |
| 46 | + changed_when: false |
| 47 | + |
| 48 | + - name: Display the status of THP |
| 49 | + ansible.builtin.debug: |
| 50 | + var: __sap_hana_preconfigure_register_thp_status.stdout_lines, __sap_hana_preconfigure_register_thp_status.stderr_lines |
0 commit comments