diff --git a/ansible/playbooks/additional_fence_agent_tasks.yaml b/ansible/playbooks/additional_fence_agent_tasks.yaml deleted file mode 100644 index 3abf866a..00000000 --- a/ansible/playbooks/additional_fence_agent_tasks.yaml +++ /dev/null @@ -1,28 +0,0 @@ ---- -- name: PTF Installation - hosts: hana - remote_user: cloudadmin - become: true - become_user: root - - tasks: - - name: Verify installation - command: "rpm -qf $(which fence_azure_arm)" - args: - _uses_shell: true - register: verify_installation - - - name: Display verification result - debug: - var: verify_installation.stdout_lines - - - name: Install additional Python packages - zypper: - name: - - python311-pexpect - - python311-pycurl - state: present - update_cache: true - - - name: Modify fence_azure_arm script to use Python 3.11 - command: "sed -i s/python3/python3.11/ /usr/sbin/fence_azure_arm" diff --git a/ansible/playbooks/ptf_installation.yaml b/ansible/playbooks/ptf_installation.yaml index 55f0f5b8..9adf98b4 100644 --- a/ansible/playbooks/ptf_installation.yaml +++ b/ansible/playbooks/ptf_installation.yaml @@ -11,15 +11,14 @@ ptf_dir: "/tmp/ptf_dir" tasks: - - name: Create directory for PTF installation - file: + ansible.builtin.file: path: "{{ ptf_dir }}" state: directory mode: '0755' - name: Convert comma-separated string to list - set_fact: + ansible.builtin.set_fact: az_blobs: "{{ ptf_files | split(',') }}" when: sas_token is defined @@ -38,10 +37,12 @@ with_items: "{{ az_blobs }}" when: sas_token is defined - - name: Download PTF files recursively with wget - command: "wget --no-directories --recursive --reject 'index.html*' --user={{ ptf_user }} --password={{ ptf_password }} --no-parent {{ ptf_url }}" + - name: Download PTF files recursively with wget # noqa: command-instead-of-module + ansible.builtin.command: "wget --no-directories --recursive --reject 'index.html*' --user={{ ptf_user }} --password={{ ptf_password }} --no-parent {{ ptf_url }}" args: chdir: "{{ ptf_dir }}" + register: wget_ret + changed_when: wget_ret.rc == 0 when: - sas_token is not defined - ptf_user is defined @@ -49,35 +50,36 @@ - ptf_url is defined - name: List downloaded files - command: "ls -la" + ansible.builtin.command: "ls -la" args: chdir: "{{ ptf_dir }}" + changed_when: false register: download_list - name: Display downloaded files - debug: + ansible.builtin.debug: var: download_list.stdout_lines - name: Find downloaded RPM files - find: + ansible.builtin.find: paths: "{{ ptf_dir }}" patterns: "*.rpm" register: rpm_files - name: Display found RPM files - debug: + ansible.builtin.debug: var: rpm_files.files - name: Filter out src.rpm files - set_fact: + ansible.builtin.set_fact: filtered_rpm_files: "{{ rpm_files.files | selectattr('path', 'search', '^(?!.*src\\.rpm$).*') | list }}" - name: Display filtered RPM files - debug: + ansible.builtin.debug: var: filtered_rpm_files - name: Install PTF RPM packages - zypper: + community.general.zypper: name: "{{ item.path }}" state: present disable_gpg_check: true diff --git a/ansible/playbooks/sap-hana-system-replication-hooks.yaml b/ansible/playbooks/sap-hana-system-replication-hooks.yaml index 0cabe68a..107a6b41 100644 --- a/ansible/playbooks/sap-hana-system-replication-hooks.yaml +++ b/ansible/playbooks/sap-hana-system-replication-hooks.yaml @@ -1,12 +1,13 @@ --- -- hosts: hana +- name: SAP Hana System Replication Hooks + hosts: hana remote_user: cloudadmin become: true become_user: root pre_tasks: - name: Source hana install variables - include_vars: ./vars/hana_vars.yaml + ansible.builtin.include_vars: ./vars/hana_vars.yaml vars: is_primary: "{{ ansible_play_hosts[0] == inventory_hostname }}" @@ -26,22 +27,17 @@ {{ __sapcontrol }} -nr {{ sap_hana_install_instance_number }} -function StopWait 600 10 + register: stopwait + changed_when: stopwait.rc == 0 # Sucessfull output is like "\n24.06.2025 23:38:21\nStop\nOK\n\n24.06.2025 23:38:41\nStopWait\nOK" - - name: Start HANA Primary + - name: Start HANA ansible.builtin.command: # StartWait will timeout after 600 seconds. cmd: >- {{ __sapcontrol }} -nr {{ sap_hana_install_instance_number }} -function StartWait 600 10 - when: is_primary - - - name: Start HANA Secondary - ansible.builtin.command: # StartWait will timeout after 600 seconds. - cmd: >- - {{ __sapcontrol }} - -nr {{ sap_hana_install_instance_number }} - -function StartWait 600 10 - when: not is_primary + register: startwait + changed_when: startwait.rc == 0 # Sucessfull output is like "\n24.06.2025 23:38:42\nStart\nOK\n\n24.06.2025 23:39:52\nStartWait\nOK" tasks: - name: Assert that required variables are defined diff --git a/ansible/playbooks/sap-hana-system-replication.yaml b/ansible/playbooks/sap-hana-system-replication.yaml index bad6683a..ea56672b 100644 --- a/ansible/playbooks/sap-hana-system-replication.yaml +++ b/ansible/playbooks/sap-hana-system-replication.yaml @@ -1,5 +1,6 @@ --- -- hosts: hana +- name: SAP Hana System Replication + hosts: hana remote_user: cloudadmin become: true become_user: root @@ -11,7 +12,7 @@ when: ansible_play_hosts | length != 2 - name: Load HANA vars - include_vars: ./vars/hana_vars.yaml + ansible.builtin.include_vars: ./vars/hana_vars.yaml vars: install_path: /var/lib/qedep @@ -52,7 +53,7 @@ - name: Execute hana system replication role ansible.builtin.include_role: - role: ../roles/sap_ha_install_hana_hsr + name: ../roles/sap_ha_install_hana_hsr when: hsr_configured == 'absent' - name: Write status file