Fix CI (docker_container tests fail because of missing ipaddress) (#218)

* Use stdlib ipaddress, resp. install when needed.

* Make sure facts on controller are available.
This commit is contained in:
Felix Fontein 2021-10-07 13:15:51 +02:00 committed by GitHub
parent 4070dab9a8
commit f4b1d34357
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -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

View File

@ -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: