-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from sean-freeman/sap_rfc_overhaul
sap_rfc: overhaul
- Loading branch information
Showing
13 changed files
with
230 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,47 @@ | ||
--- | ||
- name: Initial install of Python altinstall for PyRFC | ||
ansible.builtin.include_tasks: python_pyrfc_init.yml | ||
when: pyrfc_first_run | bool | ||
|
||
- name: Discover Python altinstall for PyRFC | ||
ansible.builtin.include_tasks: python_pyrfc_discover.yml | ||
when: not pyrfc_first_run | bool | ||
- name: Identify SAP NW RFC Library home directory | ||
ansible.builtin.find: | ||
paths: /usr/local/sap | ||
recurse: true | ||
file_type: directory | ||
patterns: include | ||
register: __sap_rfc_nwrfc_home | ||
|
||
- name: Identify SAP NW RFC Library compiled shared library (libsapnwrfc.so) | ||
ansible.builtin.find: | ||
paths: /usr/local/sap/nwrfcsdk | ||
recurse: true | ||
file_type: file | ||
patterns: libsapnwrfc.so | ||
register: __sap_rfc_nwrfc_lib | ||
|
||
- name: Identify Python virtual environment for sap_rfc Ansible Role | ||
ansible.builtin.stat: | ||
path: ~/env/pyrfc_env | ||
register: __sap_rfc_python_virtual_env | ||
|
||
- name: Set fact based on identified SAP NW RFC Library | ||
ansible.builtin.set_fact: | ||
__sap_rfc_first_run: "{{ true if ((__sap_rfc_nwrfc_home.files | length) == 0 or (__sap_rfc_nwrfc_lib.files | length) == 0) else false }}" | ||
|
||
- name: Initial install of SAP NW RFC SDK Library | ||
ansible.builtin.include_tasks: setup/nwrfcsdk_init.yml | ||
when: __sap_rfc_first_run | bool | ||
|
||
- name: Initial install of Python virtual environment for PyRFC | ||
ansible.builtin.include_tasks: setup/python_init.yml | ||
when: (__sap_rfc_first_run | bool) or (not __sap_rfc_python_virtual_env.stat.exists) | ||
|
||
# Use Ansible Task block to call sap_pyrfc Ansible Module in the Ansible Collection for sap_libs | ||
# RFC call using variables set by the Ansible Playbook when calling this Ansible Role | ||
- name: Execute Ansible Module to call PyRFC using the virtualenv Python3 | ||
community.sap_libs.sap_pyrfc: | ||
function: "{{ target_function }}" | ||
parameters: "{{ target_parameters }}" | ||
connection: "{{ target_connection }}" | ||
environment: | ||
SAPNWRFC_HOME: "{{ __sap_rfc_nwrfc_home.files[0].path | dirname }}" | ||
LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:$SAPNWRFC_HOME/lib" | ||
vars: | ||
ansible_python_interpreter: ~/env/pyrfc_env/bin/python3 | ||
community.sap_libs.sap_pyrfc: | ||
function: "{{ sap_rfc_target_function }}" | ||
parameters: "{{ sap_rfc_target_parameters }}" | ||
connection: "{{ sap_rfc_target_connection }}" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
--- | ||
|
||
- name: Set fact x86_64 sap_rfc_first_run_download_nwrfc_sdk | ||
ansible.builtin.set_fact: | ||
sap_rfc_first_run_download_nwrfc_sdk: "nwrfc750P_12-70002752.zip" | ||
when: ansible_architecture == "x86_64" | ||
|
||
- name: Set fact x86_64 sap_rfc_first_run_download_nwrfc_sdk | ||
ansible.builtin.set_fact: | ||
sap_rfc_first_run_download_nwrfc_sdk: "nwrfc750P_12-70002761.zip" | ||
when: ansible_architecture == "ppc64le" | ||
|
||
- name: Create directories if does not exist | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: directory | ||
mode: "0755" | ||
loop: | ||
- "{{ sap_rfc_first_run_download_path }}" | ||
- "/usr/local/sap" | ||
- "/usr/local/sap/nwrfcsdk" | ||
# - "/tmp/nwrfcsdk_patch_extract" | ||
|
||
# Use task block to call Ansible Module in the Ansible Collection for sap_launchpad | ||
- name: Execute Ansible Module to download SAP software | ||
community.sap_launchpad.software_center_download: | ||
suser_id: "{{ sap_rfc_first_run_download_sap_user_id }}" | ||
suser_password: "{{ sap_rfc_first_run_download_sap_user_password }}" | ||
softwarecenter_search_query: "{{ item }}" | ||
dest: "{{ sap_rfc_first_run_download_path }}" | ||
loop: | ||
- "{{ sap_rfc_first_run_download_nwrfc_sdk }}" | ||
# - "{{ sap_rfc_first_run_download_sapcar }}" | ||
# - "{{ sap_rfc_first_run_download_nwrfc_sdk_patch }}" | ||
|
||
- name: Discover zip of the SAP NWRFC SDK (7.5x Original) on target host | ||
ansible.builtin.find: | ||
paths: "{{ sap_rfc_first_run_download_path }}" | ||
recurse: true | ||
patterns: "nwrfc*.zip" | ||
register: __sap_rfc_nwrfc_sdk_zip | ||
|
||
- name: Extract zip of the SAP NWRFC SDK (7.5x) on target host | ||
ansible.builtin.unarchive: | ||
remote_src: true | ||
src: "{{ __sap_rfc_nwrfc_sdk_zip.files[0].path }}" | ||
dest: /usr/local/sap # ZIP contains nwrfcsdk subdirectory | ||
when: __sap_rfc_nwrfc_sdk_zip.files | length > 0 | ||
|
||
# - name: Discover SAR of the SAP NWRFC SDK Patch on target host | ||
# ansible.builtin.find: | ||
# paths: "{{ sap_rfc_first_run_download_path }}" | ||
# recurse: true | ||
# patterns: "sapnwrfc_*.sar" | ||
# register: __sap_rfc_nwrfc_sdk_sar | ||
|
||
# - name: Discover SAPCAR on target host | ||
# ansible.builtin.find: | ||
# paths: "{{ sap_rfc_first_run_download_path }}" | ||
# recurse: true | ||
# patterns: "SAPCAR*" | ||
# register: __sap_rfc_sapcar_exe | ||
|
||
# - name: Extract SAR of the SAP NWRFC SDK Patch on target host | ||
# ansible.builtin.shell: | | ||
# {{ __sap_rfc_sapcar_exe.files[0].path }} \ | ||
# -R /tmp/nwrfcsdk_patch_extract \ | ||
# -xvf "{{ __sap_rfc_nwrfc_sdk_sar.files[0].path }}" | ||
# when: __sap_rfc_nwrfc_sdk_sar.files | length > 0 | ||
|
||
# - name: Find patched compiled shared library (libsapnwrfc.so) | ||
# ansible.builtin.find: | ||
# paths: /tmp/nwrfcsdk_patch_extract | ||
# recurse: true | ||
# patterns: libsapnwrfc.so | ||
# register: __sap_rfc_nwrfc_lib_patch | ||
|
||
- name: Find compiled shared library (libsapnwrfc.so) | ||
ansible.builtin.find: | ||
paths: /usr/local/sap/nwrfcsdk | ||
recurse: true | ||
patterns: libsapnwrfc.so | ||
register: __sap_rfc_nwrfc_lib | ||
|
||
# - name: Copy patched compiled shared library (libsapnwrfc.so) to replace original | ||
# ansible.builtin.copy: | ||
# backup: false # Otherwise ldconfig will identify multiple copies of libsapnwrfc.so | ||
# remote_src: true | ||
# mode: 755 | ||
# src: "{{ __sap_rfc_nwrfc_lib_patch.files[0].path }}" | ||
# dest: "{{ __sap_rfc_nwrfc_lib.files[0].path }}" | ||
|
||
# - name: Create ld.so.conf configuration file with path to compiled shared library (libsapnwrfc.so) | ||
# ansible.builtin.copy: | ||
# dest: /etc/ld.so.conf.d/nwrfcsdk.conf | ||
# mode: '0444' | ||
# content: | | ||
# # include nwrfcsdk | ||
# {{ __sap_rfc_nwrfc_lib.files[0].path | dirname }} | ||
# # include /usr/sap (e.g. libstdc++.so.6) | ||
# /usr/sap/lib | ||
|
||
- name: Reload system-wide library paths (ldconfig) | ||
ansible.builtin.shell: ldconfig | ||
|
||
- name: Ensure compiled shared library (libsapnwrfc.so) is registered as system-wide library | ||
ansible.builtin.shell: ldconfig -p | grep sapnwrfc | ||
register: __sap_rfc_nwrfc_lib_discover_path | ||
|
||
- name: Identify SAP NW RFC Library home directory | ||
ansible.builtin.find: | ||
paths: /usr/local/sap | ||
recurse: true | ||
file_type: directory | ||
patterns: include | ||
register: __sap_rfc_nwrfc_home |
Oops, something went wrong.