mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 11:55:04 +00:00
Fix AZP tests, add current_container_facts module (#48)
* Add new facts module for determining whether the module is running inside a container or not. * Add containers to main network. * Fix running tests locally with newer docker. * Simplify setup_openssl to only install cryptography. * Add alias in network. * Make sure to upgrade cryptography to something more sensible on Ubuntu 16.04. * Don't jump through hoops for bridge. * Try to use other IPv4 nets. * Improve module docs.
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