mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-16 03:52:05 +00:00
* Move copying functionality to module_utils. * Add docker_container_copy_into module. * Use new module in other tests. * Fix copyright and attributes. * Improve idempotency, improve stat code. * Document and test when a stopped container works. * Improve owner/group detection error handling when container is stopped. * Fix formulation. Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com> * Improve file comparison. * Avoid reading whole file at once. * Stream when fetching files from daemon. * Fix comment. * Use read() instead of read1(). * Stream files when copying into container. * Linting. * Add force parameter. * Simplify library code. * Linting. * Add content and content_is_b64 options. * Make force=false work as for copy module: only copy if the destination does not exist. * Improve docs. * content should be no_log. * Implement diff mode. * Improve error handling. * Lint and improve. * Set owner/group ID to avoid ID lookup (which fails in paused containers). * Apply suggestions from code review Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com> Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>
46 lines
1.4 KiB
YAML
46 lines
1.4 KiB
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
|
|
|
|
####################################################################
|
|
# WARNING: These are designed specifically for Ansible tests #
|
|
# and should not be used as examples of how to write Ansible roles #
|
|
####################################################################
|
|
|
|
- name: Gather facts on controller
|
|
setup:
|
|
gather_subset: '!all'
|
|
delegate_to: localhost
|
|
delegate_facts: true
|
|
run_once: true
|
|
|
|
# Create random name prefix (for containers)
|
|
- name: Create random container name prefix
|
|
set_fact:
|
|
cname_prefix: "{{ 'ansible-docker-test-%0x' % ((2**32) | random) }}"
|
|
cnames: []
|
|
|
|
- debug:
|
|
msg: "Using container name prefix {{ cname_prefix }}"
|
|
|
|
# Run the tests
|
|
- block:
|
|
- include_tasks: run-test.yml
|
|
with_fileglob:
|
|
- "tests/*.yml"
|
|
|
|
always:
|
|
- name: "Make sure all containers are removed"
|
|
docker_container:
|
|
name: "{{ item }}"
|
|
state: absent
|
|
force_kill: true
|
|
with_items: "{{ cnames }}"
|
|
diff: false
|
|
|
|
when: docker_api_version is version('1.25', '>=')
|
|
|
|
- fail: msg="Too old Docker API version to run all docker_container_copy_into tests!"
|
|
when: not(docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|