Dockerfile
FROM centos:centos7
COPY requirements-azure /tmp
RUN yum check-update; \
yum install -y gcc libffi-devel python3 epel-release; \
yum install -y openssh-clients; \
curl https://packages.microsoft.com/config/rhel/7/prod.repo | tee /etc/yum.repos.d/microsoft.repo; \
yum install -y powershell; \
pwsh -c "Set-PackageSource -Name PSGallery -Trusted"; \
pwsh -c "Install-Module AZ -Scope AllUsers"; \
pip3 --no-cache-dir install --upgrade pip; \
pip3 --no-cache-dir install ansible; \
pip3 --no-cache-dir install -r /tmp/requirements-azure; \
ansible-galaxy collection install azure.azcollection --force; \
yum clean all; \
rm /tmp/requirements-azure
the file "requirements-azure" should be in the Dockerfile path, see below.
Resources
Announcing azcollection, the Ansible collection for Azure
courtesy of @adiltouati