mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Prepare docker tests for AZP. (#1482)
Backport of important parts of https://github.com/ansible-collections/community.docker/pull/48 to stable-1.
This commit is contained in:
@@ -42,4 +42,4 @@
|
||||
service:
|
||||
name: docker
|
||||
state: started
|
||||
ignore_errors: "{{ ansible_virtualization_type == 'docker' }}"
|
||||
ignore_errors: "{{ ansible_virtualization_type in ['docker', 'container', 'containerd'] }}"
|
||||
|
||||
@@ -31,4 +31,4 @@
|
||||
service:
|
||||
name: docker
|
||||
state: started
|
||||
ignore_errors: "{{ ansible_virtualization_type == 'docker' }}"
|
||||
ignore_errors: "{{ ansible_virtualization_type in ['docker', 'container', 'containerd'] }}"
|
||||
|
||||
@@ -135,3 +135,16 @@
|
||||
images: "{{ docker_images.stdout_lines | default([]) }}"
|
||||
|
||||
when: docker_cli_version is version('0.0', '>')
|
||||
|
||||
- name: Detect whether we are running inside a container
|
||||
current_container_facts:
|
||||
|
||||
- name: Inspect current container
|
||||
docker_container_info:
|
||||
name: "{{ ansible_module_container_id }}"
|
||||
register: current_container_info
|
||||
when: ansible_module_running_in_container
|
||||
|
||||
- name: Determine network name
|
||||
set_fact:
|
||||
current_container_network_ip: "{{ (current_container_info.container.NetworkSettings.Networks | dictsort)[0].0 | default('') if ansible_module_running_in_container else '' }}"
|
||||
|
||||
Reference in New Issue
Block a user