mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-17 20:38:42 +00:00
* Use stdlib ipaddress, resp. install when needed.
* Make sure facts on controller are available.
(cherry picked from commit f4b1d34357)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
26d8aa1c80
commit
087392847d
@ -18,10 +18,10 @@
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.crypto.plugins.module_utils.compat import ipaddress
|
||||
|
||||
|
||||
def _normalize_ipaddr(ipaddr):
|
||||
# Import when needed, to allow installation of that module in the test setup
|
||||
import ipaddress
|
||||
return ipaddress.ip_address(ipaddr).compressed
|
||||
|
||||
|
||||
|
||||
@ -4,6 +4,19 @@
|
||||
# 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
|
||||
|
||||
- name: Make sure ipaddress is available on controller
|
||||
pip:
|
||||
name: ipaddress
|
||||
delegate_to: localhost
|
||||
when: hostvars['localhost'].ansible_facts.python.version.major < 3
|
||||
|
||||
# Create random name prefix (for containers, networks, ...)
|
||||
- name: Create random container name prefix
|
||||
set_fact:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user