Add ansible docker execution environment (Dockerfile, requirements, runner script)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
FROM debian:trixie-slim
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Europe/Berlin
|
||||
ENV ANSIBLE_VERSION=2.20.6
|
||||
ENV PIP_BREAK_SYSTEM_PACKAGES=1
|
||||
|
||||
RUN apt update && apt install -y --no-install-recommends \
|
||||
nano \
|
||||
git \
|
||||
wget \
|
||||
unzip \
|
||||
curl \
|
||||
python3-pip \
|
||||
tzdata \
|
||||
openssh-client \
|
||||
iputils-ping \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN mkdir -p /etc/ssh/ssh_config.d \
|
||||
&& printf 'Host *\n StrictHostKeyChecking no\n UserKnownHostsFile /dev/null\n' > /etc/ssh/ssh_config.d/99-no-hostkey-check.conf
|
||||
|
||||
RUN pip3 install --no-cache-dir --upgrade \
|
||||
ansible-core~=${ANSIBLE_VERSION}
|
||||
|
||||
RUN mkdir -p /root/.bashrc.d
|
||||
COPY ansible-functs.sh /root/.bashrc.d/ansible-functs.sh
|
||||
RUN chmod +x /root/.bashrc.d/ansible-functs.sh \
|
||||
&& printf '\n[ -f /root/.bashrc.d/ansible-functs.sh ] && . /root/.bashrc.d/ansible-functs.sh\n' >> /root/.bashrc
|
||||
|
||||
COPY requirements.yml /ansible/requirements.yml
|
||||
RUN ansible-galaxy collection install -r /ansible/requirements.yml
|
||||
|
||||
WORKDIR /ansible
|
||||
|
||||
CMD ["ansible-playbook", "--version"]
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# Useful bashrc functions for ansible in docker
|
||||
|
||||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
|
||||
alias ap='ansible-playbook'
|
||||
alias ag='ansible-galaxy'
|
||||
alias av='ansible-vault'
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
collections:
|
||||
- name: ansible.posix
|
||||
version: 2.2.0
|
||||
- name: community.general
|
||||
version: 13.0.1
|
||||
- name: community.docker
|
||||
version: 5.2.0
|
||||
Reference in New Issue
Block a user