network/molecule/default/Dockerfile.j2
Rich Megginson 977f149f1e Fix centos6 repos; use standard centos images; add centos8
Use the new vault.centos.org repos.  Fix the yum repo configs in the
image if necessary to use these new repos.
Use the standard centos images from the centos registry rather than
custom lsr images from dockerhub.
Add support for centos8.  Note that using ansible 2.7 on centos8
requires setting /usr/bin/python3 to be the ansible python
interpreter.  Later versions of ansible have better auto-detection.
We can get rid of this once we drop support for ansible 2.7
Use tox-lsr 1.0.1 - which means we do not need
molecule_extra_requirements.txt

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2021-01-13 23:43:11 +08:00

28 lines
1.5 KiB
Django/Jinja

# SPDX-License-Identifier: MIT
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN set -euo pipefail; \
pkgs="python sudo yum-plugin-ovl bash"; \
if grep 'CentOS release 6' /etc/centos-release > /dev/null 2>&1; then \
for file in /etc/yum.repos.d/CentOS-*.repo; do \
if ! grep '^baseurl=.*vault[.]centos[.]org' "$file"; then \
sed -i -e 's,^mirrorlist,#mirrorlist,' \
-e 's,^#baseurl=,baseurl=,' \
-e 's,mirror.centos.org/centos/$releasever,vault.centos.org/6.10,' \
"$file"; \
fi; \
done; \
pkgs="$pkgs upstart chkconfig initscripts"; \
fi; \
if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python3 sudo python3-devel python3-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y $pkgs && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi