sap.sap_operations.proc_info module – Reads content from files in the /proc directory

Note

This module is part of the sap.sap_operations collection.

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 sap.sap_operations.

To use it in a playbook, specify: sap.sap_operations.proc_info.

New in sap.sap_operations 1.18.0

Synopsis

  • This module is designed to read the contents of files located within the /proc directory.

  • It prevents directory traversal attacks by ensuring that the requested path is within the /proc directory.

Parameters

Parameter

Comments

proc

path / required

The path to the file within the /proc directory to read.

This path might be relative to the /proc directory or absolute; absolute paths are adjusted accordingly.

To read /proc/cpuinfo from the root directory, one should set this parameter to “/proc/cpuinfo” or “cpuinfo”

Notes

Note

  • This module is community supported

  • Module interface (parameters, output) expected to be stable but not guaranteed

  • Module planned to be released on Ansible Automation Hub after collecting some feedback

  • There is no guarantee that this module will be officially supported by Red Hat

Examples

- name: Read cpuinfo
  sap.sap_operations.proc_info:
    proc: "cpuinfo"
- name: Try to read outside /proc
  sap.sap_operations.proc_info:
    proc: "/etc/passwd"

Return Values

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

Key

Description

proc_path

string

The absolute path to the file that was read.

Returned: always

rc

integer

Return code from the ‘cat’ command.

Returned: always

stderr

string

The standard error from the ‘cat’ command if it fails.

Returned: failure

stdout

string

The content of the file read from /proc.

Returned: success

Authors

  • Kirill Satarin (@kksat)