community.sap_libs.sapcar_extract module – Manages SAP SAPCAR archives

Note

This module is part of the community.sap_libs collection (version 1.7.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.sap_libs.

To use it in a playbook, specify: community.sap_libs.sapcar_extract.

New in community.sap_libs 1.0.0

Synopsis

  • Provides support for unpacking sar/car files with the SAPCAR binary from SAP and pulling information back into Ansible.

Parameters

Parameter

Comments

binary_path

path

The path to the SAPCAR binary, for example, /home/dummy/sapcar or https://myserver/SAPCAR. If this parameter is not provided, the module will look in PATH.

dest

path

The destination where SAPCAR extracts the SAR file. Missing folders will be created. If this parameter is not provided, it will unpack in the same folder as the SAR file.

manifest

string

The name of the manifest.

Default: "SIGNATURE.SMF"

overwrite

boolean

If true, existing files will be overwritten during extraction. This should be used with caution!

If false, the module checks if the expected file names are already present in the destination folder and only extracts if they are not found.

It does not remove files, but overwrites them if they are already present in the destination folder.

Choices:

  • false ← (default)

  • true

path

path / required

The path to the SAR/CAR file.

remove

boolean

If true, the SAR/CAR file will be removed. This should be used with caution!

Choices:

  • false ← (default)

  • true

security_library

path

The path to the security library, for example, /usr/sap/hostctrl/exe/libsapcrytp.so, for signature operations.

signature

boolean

If true, the signature will be extracted.

Choices:

  • false ← (default)

  • true

Notes

Note

  • Always returns changed=true in check_mode.

Examples

- name: Extract SAR file
  community.sap_libs.sapcar_extract:
    path: "~/source/hana.sar"

- name: Extract SAR file with destination
  community.sap_libs.sapcar_extract:
    path: "~/source/hana.sar"
    dest: "~/test/"

- name: Extract SAR file with destination and download from webserver can be a fileshare as well
  community.sap_libs.sapcar_extract:
    path: "~/source/hana.sar"
    dest: "~/dest/"
    binary_path: "https://myserver/SAPCAR"

- name: Extract SAR file and delete SAR after extract
  community.sap_libs.sapcar_extract:
    path: "~/source/hana.sar"
    remove: true

- name: Extract SAR file with manifest
  community.sap_libs.sapcar_extract:
    path: "~/source/hana.sar"
    signature: true

- name: Extract SAR file with manifest and rename it
  community.sap_libs.sapcar_extract:
    path: "~/source/hana.sar"
    manifest: "MyNewSignature.SMF"
    signature: true

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

changed

boolean

Whether the module made changes.

Returned: always

Sample: true

command

string

The full SAPCAR command that was executed.

Returned: always

Sample: "/tmp/sapcar -xvf /tmp/hana.sar -R /tmp/test2"

msg

string

Status message about the extraction operation.

Returned: always

Sample: "Files extracted to /tmp/test2 (overwrite mode enabled)"

stderr

string

Standard error from the SAPCAR command.

Returned: always

Sample: ""

stdout

string

Standard output from the SAPCAR command.

Returned: always

Sample: "SAPCAR: processing archive /tmp/hana.sar (version 2.01)\\nfile1\\nfile2"

Authors

  • Rainer Leber (@RainerLeber)