---

# loop block for sapnote/assert-2055470.yml

- name: 2055470 - Get {{ line_item.name }} from /etc/sysctl.d/ibm_largesend.conf
  command: awk 'BEGIN{FS="="}/{{ line_item.name }}/{print $NF}' /etc/sysctl.d/ibm_largesend.conf
  register: __sap_hana_preconfigure_register_sysctl_ibm_largesend_conf_parameter_assert
  changed_when: no
  ignore_errors: yes
  when: __sap_hana_preconfigure_register_stat_sysctl_ibm_largesend_conf_assert.stat.exists

- name: 2055470 - Assert that {{ line_item.name }} is set correctly in /etc/sysctl.d/ibm_largesend.conf
  assert:
    that: "__sap_hana_preconfigure_register_sysctl_ibm_largesend_conf_parameter_assert.stdout == '{{ line_item.value }}'"
    fail_msg: "FAIL: The value of '{{ line_item.name }}' in /etc/sysctl.d/ibm_largesend.conf is
               '{{ __sap_hana_preconfigure_register_sysctl_ibm_largesend_conf_parameter_assert.stdout }}' but the expected value is 'line_item.value'!"
    success_msg: "PASS: The value of '{{ line_item.name }}' in /etc/sysctl.d/ibm_largesend.conf is
                  '{{ __sap_hana_preconfigure_register_sysctl_ibm_largesend_conf_parameter_assert.stdout }}'."
  ignore_errors: "{{ sap_hana_preconfigure_assert_ignore_errors|d(false) }}"
  when: __sap_hana_preconfigure_register_stat_sysctl_ibm_largesend_conf_assert.stat.exists

- name: 2055470 - Get {{ line_item.name }} from sysctl
  shell: sysctl -n {{ line_item.name }} | awk '{gsub ("\t", " "); print}'
  register: __sap_hana_preconfigure_register_sysctl_ibm_parameter_assert
  changed_when: no
  ignore_errors: yes

- name: 2055470 - Assert that {{ line_item.name }} is set correctly as per sysctl
  assert:
    that: "__sap_hana_preconfigure_register_sysctl_ibm_parameter_assert.stdout == '{{ line_item.value }}'"
    fail_msg: "FAIL: The current value of '{{ line_item.name }}' as per sysctl is
               '{{ __sap_hana_preconfigure_register_sysctl_ibm_parameter_assert.stdout }}' but the expected value is '{{ line_item.value }}'!"
    success_msg: "PASS: The current value of '{{ line_item.name }}' as per sysctl is
                  '{{ __sap_hana_preconfigure_register_sysctl_ibm_parameter_assert.stdout }}'."
  ignore_errors: "{{ sap_hana_preconfigure_assert_ignore_errors|d(false) }}"
