sap.sap_operations.is_container module – Determine if the current host is a container

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.is_container.

New in sap.sap_operations 2.4.0

Synopsis

  • Determine if the current host is a container

  • Two methods are used to determine if the current host is a container

  • The systemd-detect-virt command is used to detect if the host is a container

  • The /.dockerenv and /run/.containerenv files are checked to see if they exist

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: Are we running in a container?
  sap.sap_operations.is_container:

Return Values

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

Key

Description

is_container

boolean

Whether the current host is a container

Returned: success

Authors

  • Kirill Satarin (@kksat)