community.docker.current_container_facts – Return facts about whether the module runs in a Docker container¶
Note
This plugin is part of the community.docker collection (version 1.5.0).
To install it use: ansible-galaxy collection install community.docker
.
To use it in a playbook, specify: community.docker.current_container_facts
.
New in version 1.1.0: of community.docker
Examples¶
- name: Get facts on current container
community.docker.current_container_facts:
- name: Print information on current container when running in a container
ansible.builtin.debug:
msg: "Container ID is {{ ansible_module_container_id }}"
when: ansible_module_running_in_container
Returned Facts¶
Facts returned by this module are added/updated in the hostvars
host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them.
Authors¶
Felix Fontein (@felixfontein)