Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sap_ha_*: ansible-lint 6.22 fixes #542

Merged
merged 6 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions roles/sap_ha_install_hana_hsr/tasks/configure_hsr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
loop: "{{ sap_ha_install_hana_hsr_cluster_nodes }}"
loop_control:
label: "{{ item.node_name }}"
changed_when: true

- name: "SAP HSR - Start HANA instance on secondary"
ansible.builtin.shell: |
Expand Down
3 changes: 3 additions & 0 deletions roles/sap_ha_install_hana_hsr/tasks/hdbuserstore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# ansible-lint:
# become_user string is deduced from a variable + suffix with no spaces
- name: "SAP HSR - Check if hdbuserstore exists"
become: true
become_user: "{{ sap_ha_install_hana_hsr_sid | lower }}adm"
ansible.builtin.command: |
/usr/sap/{{ sap_ha_install_hana_hsr_sid }}/SYS/exe/hdb/hdbuserstore \
Expand All @@ -15,10 +16,12 @@
# ansible-lint:
# become_user string is deduced from a variable + suffix with no spaces
- name: "SAP HSR - Create and Store Connection Info in hdbuserstore"
become: true
become_user: "{{ sap_ha_install_hana_hsr_sid | lower }}adm"
ansible.builtin.command: |
/usr/sap/{{ sap_ha_install_hana_hsr_sid }}/SYS/exe/hdb/hdbuserstore \
SET {{ sap_ha_install_hana_hsr_hdbuserstore_system_backup_user }} \
{{ ansible_hostname }}:3{{ sap_ha_install_hana_hsr_instance_number }}13 \
SYSTEM '{{ sap_ha_install_hana_hsr_db_system_password }}'
when: sap_ha_install_hana_hsr_hdbuserstore.rc != '0'
changed_when: true
1 change: 1 addition & 0 deletions roles/sap_ha_install_hana_hsr/tasks/log_mode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@
EOF
ignore_errors: true
when: sap_ha_install_hana_hsr_log_mode.rc != '0'
changed_when: true
5 changes: 2 additions & 3 deletions roles/sap_ha_install_hana_hsr/tasks/pki_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# control node.

- name: "SAP HSR - Direct connection handling to primary"
become: true
become_user: "{{ sap_ha_install_hana_hsr_sid | lower }}adm"
block:

- name: "SAP HSR - Create .ssh if missing"
Expand Down Expand Up @@ -123,6 +125,3 @@
- __sap_ha_install_hana_hsr_create_ssh_prim.changed is defined
- __sap_ha_install_hana_hsr_create_ssh_prim.changed
delegate_to: "{{ __sap_ha_install_hana_hsr_primary_node }}"

become: true
become_user: "{{ sap_ha_install_hana_hsr_sid | lower }}adm"
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
label: "{{ nwas_profile_item.0 }} -> {{ nwas_profile_item.1 }}"

- name: "SAP HA Pacemaker - (SAP HA Interface) Wait for ASCS to be up and running"
become: true
become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid | lower }}adm"
register: __sap_ha_pacemaker_cluster_register_where_ascs
ansible.builtin.shell: |
Expand All @@ -137,6 +138,7 @@
failed_when: false

- name: "SAP HA Pacemaker - (SAP HA Interface) Wait for ERS to be up and running"
become: true
become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid | lower }}adm"
register: __sap_ha_pacemaker_cluster_register_where_ers
ansible.builtin.shell: |
Expand All @@ -147,6 +149,7 @@
- name: "SAP HA Pacemaker - (SAP HA Interface) Restart the ASCS service"
when:
- __sap_ha_pacemaker_cluster_register_where_ascs.rc == 0
become: true
become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid | lower }}adm"
register: __sap_ha_pacemaker_cluster_register_restart_ascs
ansible.builtin.shell: |
Expand All @@ -156,6 +159,7 @@
- name: "SAP HA Pacemaker - (SAP HA Interface) Restart the ERS service"
when:
- __sap_ha_pacemaker_cluster_register_where_ers.rc == 0
become: true
become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid | lower }}adm"
register: __sap_ha_pacemaker_cluster_register_restart_ers
ansible.builtin.shell: |
Expand All @@ -172,6 +176,7 @@
- name: "SAP HA Pacemaker - (SAP HA Interface) Run HA check for ASCS"
when:
- __sap_ha_pacemaker_cluster_register_where_ascs.rc == 0
become: true
become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid | lower }}adm"
register: __sap_ha_pacemaker_cluster_register_ascs_ha
ansible.builtin.shell: |
Expand All @@ -181,6 +186,7 @@
- name: "SAP HA Pacemaker - (SAP HA Interface) Run HA check for ERS"
when:
- __sap_ha_pacemaker_cluster_register_where_ers.rc == 0
become: true
become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid | lower }}adm"
register: __sap_ha_pacemaker_cluster_register_ers_ha
ansible.builtin.shell: |
Expand Down
16 changes: 8 additions & 8 deletions roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@

- name: "SAP HA Prepare Pacemaker - Combine extra packages lists"
ansible.builtin.set_fact:
__sap_ha_pacemaker_cluster_extra_packages: "{{ (
sap_ha_pacemaker_cluster_extra_packages
__sap_ha_pacemaker_cluster_extra_packages: "{{
(sap_ha_pacemaker_cluster_extra_packages
+ __sap_ha_pacemaker_cluster_sap_extra_packages
+ __sap_ha_pacemaker_cluster_platform_extra_packages
) | unique | select() }}"
+ __sap_ha_pacemaker_cluster_platform_extra_packages)
| unique | select() }}"
# remove duplicates and empty elements

# sap_ha_pacemaker_cluster_fence_agent_minimal_packages -> global default
Expand All @@ -41,8 +41,8 @@

- name: "SAP HA Prepare Pacemaker - Combine fence agent packages lists"
ansible.builtin.set_fact:
__sap_ha_pacemaker_cluster_fence_agent_packages: "{{ (
sap_ha_pacemaker_cluster_fence_agent_minimal_packages
__sap_ha_pacemaker_cluster_fence_agent_packages: "{{
(sap_ha_pacemaker_cluster_fence_agent_minimal_packages
+ sap_ha_pacemaker_cluster_fence_agent_packages
+ __sap_ha_pacemaker_cluster_fence_agent_packages
) | unique }}"
+ __sap_ha_pacemaker_cluster_fence_agent_packages)
| unique }}"
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
- name: "SAP HA Prepare Pacemaker - (STONITH) Set to disabled when no fencing resource is defined"
ansible.builtin.set_fact:
sap_ha_pacemaker_cluster_cluster_properties:
"{{ sap_ha_pacemaker_cluster_cluster_properties | combine({ 'stonith-enabled': false }) }}"
"{{ sap_ha_pacemaker_cluster_cluster_properties | combine({'stonith-enabled': false}) }}"

- name: "SAP HA Prepare Pacemaker - Warn that there is no STONITH configured"
ansible.builtin.pause:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
---
# For the sake of readability and maintainability, suppress cosmetical ansible-lint warnings.
- name: "SAP HA Prepare Pacemaker - Make a list of potential VIP definitions"
ansible.builtin.set_fact:
__sap_ha_pacemaker_cluster_all_vip_fact:
__sap_ha_pacemaker_cluster_all_vip_fact: # noqa: jinja[spacing]
hana_scaleup_perf: "{{
{
sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: sap_ha_pacemaker_cluster_vip_hana_primary_ip_address | regex_replace('/.*', ''),
sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name: sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address | regex_replace('/.*', '')
sap_ha_pacemaker_cluster_vip_hana_primary_resource_name:
sap_ha_pacemaker_cluster_vip_hana_primary_ip_address | regex_replace('/.*', ''),
sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name:
sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address | regex_replace('/.*', '')
} }}"
nwas_abap_ascs_ers: "{{
{
sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_resource_name: sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_ip_address | regex_replace('/.*', ''),
sap_ha_pacemaker_cluster_vip_nwas_abap_ers_resource_name: sap_ha_pacemaker_cluster_vip_nwas_abap_ers_ip_address | regex_replace('/.*', '')
sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_resource_name:
sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_ip_address | regex_replace('/.*', ''),
sap_ha_pacemaker_cluster_vip_nwas_abap_ers_resource_name:
sap_ha_pacemaker_cluster_vip_nwas_abap_ers_ip_address | regex_replace('/.*', '')
} }}"
nwas_abap_pas_aas: "{{
{
sap_ha_pacemaker_cluster_vip_nwas_abap_pas_resource_name: sap_ha_pacemaker_cluster_vip_nwas_abap_pas_ip_address | regex_replace('/.*', ''),
sap_ha_pacemaker_cluster_vip_nwas_abap_aas_resource_name: sap_ha_pacemaker_cluster_vip_nwas_abap_aas_ip_address | regex_replace('/.*', '')
sap_ha_pacemaker_cluster_vip_nwas_abap_pas_resource_name:
sap_ha_pacemaker_cluster_vip_nwas_abap_pas_ip_address | regex_replace('/.*', ''),
sap_ha_pacemaker_cluster_vip_nwas_abap_aas_resource_name:
sap_ha_pacemaker_cluster_vip_nwas_abap_aas_ip_address | regex_replace('/.*', '')
} }}"

- name: "SAP HA Prepare Pacemaker - Combine VIP parameters"
Expand Down
1 change: 1 addition & 0 deletions roles/sap_ha_pacemaker_cluster/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
loop_control:
label: "{{ item.key }}={{ item.value }}"
run_once: true
changed_when: true

- name: "SAP HA Install Pacemaker - Include srHook configuration"
ansible.builtin.include_tasks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
ansible.builtin.shell: |
set -o pipefail && rpm -qa | grep -E -e "rsct.basic"
register: __sap_ha_pacemaker_cluster_power_rsct_check
changed_when: false
when: ansible_architecture == "ppc64le"

- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Power - RSCT binary check"
Expand All @@ -87,6 +88,7 @@
ansible.builtin.shell: |
/opt/rsct/bin/ctgethscid
register: __sap_ha_pacemaker_cluster_power_rsct_hscid
changed_when: false
when:
- ansible_architecture == "ppc64le"
- __sap_ha_pacemaker_cluster_power_rsct_check.stdout != ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
__sap_ha_pacemaker_cluster_pcmk_host_map: |-
{% for node in ansible_play_hosts_all -%}
{{ hostvars[node].ansible_hostname }}:{{ hostvars[node].ansible_board_asset_tag }}
{%- if not loop.last %};{% endif %}
{%- if not loop.last %};{% endif %}
{% endfor %}
when: __sap_ha_pacemaker_cluster_platform == "cloud_aws_ec2_vs"

- name: "SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - Set variable for fencing agent"
ansible.builtin.set_fact:
sap_ha_pacemaker_cluster_ibmcloud_powervs_host_guid: "{{ __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_host }}"
sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid: '{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn | replace("::","") | regex_replace(".*\:") }}'
sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid: '{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn | replace("::", "") | regex_replace(".*\:") }}'
when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_powervs"

# pcmk_host_map format: <hostname1>:<host1-id>;<hostname2>:<host2-id>...
Expand All @@ -32,7 +32,7 @@
__sap_ha_pacemaker_cluster_pcmk_host_map: |-
{% for node in ansible_play_hosts_all -%}
{{ hostvars[node].ansible_hostname }}:{{ hostvars[node].__sap_ha_pacemaker_cluster_register_ibmcloud_powervs_host.stdout }}
{%- if not loop.last %};{% endif %}
{%- if not loop.last %};{% endif %}
{% endfor %}
when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_powervs"

Expand All @@ -50,7 +50,7 @@
__sap_ha_pacemaker_cluster_pcmk_host_map: |-
{% for node in ansible_play_hosts_all -%}
{{ hostvars[node].ansible_hostname }}:{{ hostvars[node].sap_ha_pacemaker_cluster_ibmpower_vm_hmc_system_partition_name }}
{%- if not loop.last %};{% endif %}
{%- if not loop.last %};{% endif %}
{% endfor %}
when: __sap_ha_pacemaker_cluster_platform == "hyp_ibmpower_vm"

Expand All @@ -61,7 +61,7 @@
__sap_ha_pacemaker_cluster_pcmk_host_map: |-
{% for node in ansible_play_hosts_all -%}
{{ hostvars[node].ansible_hostname }}:{{ hostvars[node].__sap_ha_pacemaker_cluster_register_ibmcloud_vs_host.stdout }}
{%- if not loop.last %};{% endif %}
{%- if not loop.last %};{% endif %}
{% endfor %}
when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_vs"

Expand All @@ -72,6 +72,6 @@
__sap_ha_pacemaker_cluster_pcmk_host_map: |-
{% for node in ansible_play_hosts_all -%}
{{ hostvars[node].ansible_hostname }}:{{ hostvars[node].ansible_hostname }}
{%- if not loop.last %};{% endif %}
{%- if not loop.last %};{% endif %}
{% endfor %}
when: __sap_ha_pacemaker_cluster_platform == "cloud_msazure_vm"
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
ansible.builtin.file:
path: /var/log/haproxy
state: directory
mode: '0755'

- name: "SAP HA Prepare Pacemaker - IBM Cloud VS - Create haproxy config for rsyslog"
ansible.builtin.copy:
dest: /etc/rsyslog.d/haproxy.conf
mode: '0644'
content: |
# Additional socket in haproxy's chroot
# to allow logging via /dev/log to chroot'ed HAProxy processes
Expand Down