mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-05 21:54:22 -07: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:
parent
3960153f70
commit
a16164cb72
7 changed files with 144 additions and 9 deletions
|
@ -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 '' }}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue