mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-16 11:58:43 +00:00
35 lines
832 B
YAML
35 lines
832 B
YAML
---
|
|
# Copyright (c) Ansible Project
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
- name: Retrieve information on current container
|
|
community.docker.current_container_facts:
|
|
register: result
|
|
|
|
# The following two tasks are useful if we ever have to debug why this fails.
|
|
|
|
- name: Print all Ansible facts
|
|
debug:
|
|
var: ansible_facts
|
|
|
|
- name: Read some files
|
|
slurp:
|
|
src: "{{ path }}"
|
|
loop:
|
|
- /proc/self/cpuset
|
|
- /proc/1/cgroup
|
|
- /proc/1/environ
|
|
loop_control:
|
|
loop_var: path
|
|
|
|
- name: Print facts returned by module
|
|
debug:
|
|
var: result.ansible_facts
|
|
|
|
- name: Validate results
|
|
assert:
|
|
that:
|
|
- ansible_module_running_in_container
|
|
- ansible_module_container_type != ''
|