Добавлены образы Ubuntu 22.04 и Debian для тестирования
- Созданы Dockerfile'ы для Ubuntu 22.04 и Debian: - dockerfiles/ubuntu/Dockerfile - Ubuntu 22.04 с systemd - dockerfiles/debian/Dockerfile - Debian bookworm с systemd - Обновлен Makefile: - Добавлены ubuntu и debian в DOCKER_IMAGES - Добавлена поддержка в docker-get-base-tag - Обновлена справка с новыми образами - Обновлены все пресеты для поддержки новых образов: - ubuntu: inecs/ansible-lab:ubuntu-latest - debian: inecs/ansible-lab:debian-latest - Обновлен molecule.yml для поддержки новых образов - Обновлен скрипт test-custom-images.sh для проверки новых образов - Теперь поддерживается 10 собственных образов AnsibleTemplate Автор: Сергей Антропов Сайт: https://devops.org.ru
This commit is contained in:
16
Makefile
16
Makefile
@@ -31,7 +31,7 @@ CONTAINER_NAME ?= ansible-controller
|
||||
# Переменные для Docker Hub
|
||||
DOCKER_REGISTRY ?= inecs/ansible-lab
|
||||
DOCKER_VERSION ?= latest
|
||||
DOCKER_IMAGES := ansible-controller alt-linux astra-linux redos rhel centos alma rocky
|
||||
DOCKER_IMAGES := ansible-controller alt-linux astra-linux redos rhel centos alma rocky ubuntu debian
|
||||
|
||||
# Multi-arch поддержка
|
||||
DOCKER_PLATFORMS ?= linux/amd64,linux/arm64
|
||||
@@ -760,6 +760,16 @@ docker-get-base-tag:
|
||||
echo "📦 Загрузка базового образа $$BASE_IMAGE..." >&2; \
|
||||
docker pull $$BASE_IMAGE >/dev/null 2>&1 || echo "⚠️ Не удалось загрузить $$BASE_IMAGE" >&2; \
|
||||
TAG=$$(docker inspect --format='{{.RepoTags}}' $$BASE_IMAGE 2>/dev/null | tr -d '[]' | cut -d',' -f1 | cut -d':' -f2 | tr -d ' ' || echo "latest");; \
|
||||
ubuntu) \
|
||||
BASE_IMAGE="ubuntu:22.04"; \
|
||||
echo "📦 Загрузка базового образа $$BASE_IMAGE..." >&2; \
|
||||
docker pull $$BASE_IMAGE >/dev/null 2>&1 || echo "⚠️ Не удалось загрузить $$BASE_IMAGE" >&2; \
|
||||
TAG=$$(docker inspect --format='{{.RepoTags}}' $$BASE_IMAGE 2>/dev/null | tr -d '[]' | cut -d',' -f1 | cut -d':' -f2 | tr -d ' ' || echo "latest");; \
|
||||
debian) \
|
||||
BASE_IMAGE="debian:bookworm"; \
|
||||
echo "📦 Загрузка базового образа $$BASE_IMAGE..." >&2; \
|
||||
docker pull $$BASE_IMAGE >/dev/null 2>&1 || echo "⚠️ Не удалось загрузить $$BASE_IMAGE" >&2; \
|
||||
TAG=$$(docker inspect --format='{{.RepoTags}}' $$BASE_IMAGE 2>/dev/null | tr -d '[]' | cut -d',' -f1 | cut -d':' -f2 | tr -d ' ' || echo "latest");; \
|
||||
ansible-controller) \
|
||||
TAG="latest";; \
|
||||
*) \
|
||||
@@ -975,7 +985,9 @@ custom-images:
|
||||
echo " - inecs/ansible-lab:rhel-latest"; \
|
||||
echo " - inecs/ansible-lab:centos-latest"; \
|
||||
echo " - inecs/ansible-lab:alma-latest"; \
|
||||
echo " - inecs/ansible-lab:rocky-latest";; \
|
||||
echo " - inecs/ansible-lab:rocky-latest"; \
|
||||
echo " - inecs/ansible-lab:ubuntu-latest"; \
|
||||
echo " - inecs/ansible-lab:debian-latest";; \
|
||||
esac
|
||||
|
||||
# Пустые цели для совместимости
|
||||
|
||||
81
dockerfiles/debian/Dockerfile
Normal file
81
dockerfiles/debian/Dockerfile
Normal file
@@ -0,0 +1,81 @@
|
||||
# Debian с systemd
|
||||
# Автор: Сергей Антропов
|
||||
# Сайт: https://devops.org.ru
|
||||
# https://hub.docker.com/_/debian
|
||||
|
||||
FROM debian:bookworm
|
||||
|
||||
# Обновляем систему
|
||||
RUN apt-get update && apt-get upgrade -y
|
||||
|
||||
# Устанавливаем systemd и необходимые пакеты
|
||||
RUN apt-get install -y \
|
||||
systemd \
|
||||
dbus \
|
||||
curl \
|
||||
wget \
|
||||
git \
|
||||
vim \
|
||||
nano \
|
||||
htop \
|
||||
tree \
|
||||
jq \
|
||||
python3 \
|
||||
python3-pip \
|
||||
python3-venv \
|
||||
python3-dev \
|
||||
build-essential \
|
||||
&& apt-get clean
|
||||
|
||||
# Устанавливаем pip
|
||||
RUN curl -sS https://bootstrap.pypa.io/pip/3.11/get-pip.py | python3
|
||||
|
||||
# Устанавливаем yq
|
||||
RUN wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \
|
||||
&& chmod +x /usr/local/bin/yq
|
||||
|
||||
# Устанавливаем Docker Compose
|
||||
RUN curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
|
||||
&& chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
# Устанавливаем kubectl
|
||||
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \
|
||||
&& chmod +x kubectl \
|
||||
&& mv kubectl /usr/local/bin/
|
||||
|
||||
# Устанавливаем kind
|
||||
RUN curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64 \
|
||||
&& chmod +x ./kind \
|
||||
&& mv ./kind /usr/local/bin/
|
||||
|
||||
# Устанавливаем Helm
|
||||
RUN curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
||||
|
||||
# Устанавливаем Docker
|
||||
RUN apt-get install -y docker.io docker-compose
|
||||
|
||||
# Создаем пользователя ansible
|
||||
RUN useradd -m -s /bin/bash ansible \
|
||||
&& echo "ansible ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
||||
|
||||
# Устанавливаем Ansible
|
||||
RUN pip3 install ansible ansible-core
|
||||
|
||||
# Устанавливаем Ansible Galaxy коллекции
|
||||
RUN ansible-galaxy install geerlingguy.docker \
|
||||
&& ansible-galaxy install geerlingguy.kubernetes
|
||||
|
||||
# Копируем requirements.yml
|
||||
COPY requirements.yml /tmp/requirements.yml
|
||||
|
||||
# Устанавливаем коллекции из requirements.yml
|
||||
RUN ansible-galaxy collection install -r /tmp/requirements.yml
|
||||
|
||||
# Устанавливаем systemd по умолчанию
|
||||
RUN systemctl set-default multi-user.target
|
||||
|
||||
# Устанавливаем права на директорию ansible
|
||||
RUN chown -R ansible:ansible /ansible
|
||||
|
||||
# Рабочая директория
|
||||
WORKDIR /ansible
|
||||
77
dockerfiles/ubuntu/Dockerfile
Normal file
77
dockerfiles/ubuntu/Dockerfile
Normal file
@@ -0,0 +1,77 @@
|
||||
# Ubuntu 22.04 с systemd
|
||||
# Автор: Сергей Антропов
|
||||
# Сайт: https://devops.org.ru
|
||||
# https://hub.docker.com/_/ubuntu
|
||||
|
||||
FROM ubuntu:22.04
|
||||
|
||||
# Обновляем систему
|
||||
RUN apt-get update && apt-get upgrade -y
|
||||
|
||||
# Устанавливаем systemd и необходимые пакеты
|
||||
RUN apt-get install -y \
|
||||
systemd \
|
||||
dbus \
|
||||
curl \
|
||||
wget \
|
||||
git \
|
||||
vim \
|
||||
nano \
|
||||
htop \
|
||||
tree \
|
||||
jq \
|
||||
python3 \
|
||||
&& apt-get clean
|
||||
|
||||
# Устанавливаем pip
|
||||
RUN curl -sS https://bootstrap.pypa.io/pip/3.10/get-pip.py | python3
|
||||
|
||||
# Устанавливаем yq
|
||||
RUN wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \
|
||||
&& chmod +x /usr/local/bin/yq
|
||||
|
||||
# Устанавливаем Docker Compose
|
||||
RUN curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
|
||||
&& chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
# Устанавливаем kubectl
|
||||
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \
|
||||
&& chmod +x kubectl \
|
||||
&& mv kubectl /usr/local/bin/
|
||||
|
||||
# Устанавливаем kind
|
||||
RUN curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64 \
|
||||
&& chmod +x ./kind \
|
||||
&& mv ./kind /usr/local/bin/
|
||||
|
||||
# Устанавливаем Helm
|
||||
RUN curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
||||
|
||||
# Устанавливаем Docker
|
||||
RUN apt-get install -y docker.io docker-compose
|
||||
|
||||
# Создаем пользователя ansible
|
||||
RUN useradd -m -s /bin/bash ansible \
|
||||
&& echo "ansible ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
||||
|
||||
# Устанавливаем Ansible
|
||||
RUN pip3 install ansible ansible-core
|
||||
|
||||
# Устанавливаем Ansible Galaxy коллекции
|
||||
RUN ansible-galaxy install geerlingguy.docker \
|
||||
&& ansible-galaxy install geerlingguy.kubernetes
|
||||
|
||||
# Копируем requirements.yml
|
||||
COPY requirements.yml /tmp/requirements.yml
|
||||
|
||||
# Устанавливаем коллекции из requirements.yml
|
||||
RUN ansible-galaxy collection install -r /tmp/requirements.yml
|
||||
|
||||
# Устанавливаем systemd по умолчанию
|
||||
RUN systemctl set-default multi-user.target
|
||||
|
||||
# Устанавливаем права на директорию ansible
|
||||
RUN chown -R ansible:ansible /ansible
|
||||
|
||||
# Рабочая директория
|
||||
WORKDIR /ansible
|
||||
@@ -37,6 +37,12 @@ platforms:
|
||||
- name: rocky
|
||||
image: inecs/ansible-lab:rocky-latest
|
||||
pre_build_image: true
|
||||
- name: ubuntu
|
||||
image: inecs/ansible-lab:ubuntu-latest
|
||||
pre_build_image: true
|
||||
- name: debian
|
||||
image: inecs/ansible-lab:debian-latest
|
||||
pre_build_image: true
|
||||
|
||||
provisioner:
|
||||
name: ansible
|
||||
|
||||
@@ -17,6 +17,9 @@ images:
|
||||
alma: "inecs/ansible-lab:alma-latest"
|
||||
rocky: "inecs/ansible-lab:rocky-latest"
|
||||
redos: "inecs/ansible-lab:redos-latest"
|
||||
ubuntu: "inecs/ansible-lab:ubuntu-latest"
|
||||
debian: "inecs/ansible-lab:debian-latest" ubuntu: "inecs/ansible-lab:ubuntu-latest"
|
||||
debian: "inecs/ansible-lab:debian-latest"
|
||||
|
||||
systemd_defaults:
|
||||
privileged: true
|
||||
|
||||
@@ -17,7 +17,8 @@ images:
|
||||
alma: "inecs/ansible-lab:alma-latest"
|
||||
rocky: "inecs/ansible-lab:rocky-latest"
|
||||
redos: "inecs/ansible-lab:redos-latest"
|
||||
|
||||
ubuntu: "inecs/ansible-lab:ubuntu-latest"
|
||||
debian: "inecs/ansible-lab:debian-latest"
|
||||
systemd_defaults:
|
||||
privileged: true
|
||||
command: "/sbin/init"
|
||||
|
||||
@@ -17,7 +17,8 @@ images:
|
||||
alma: "inecs/ansible-lab:alma-latest"
|
||||
rocky: "inecs/ansible-lab:rocky-latest"
|
||||
redos: "inecs/ansible-lab:redos-latest"
|
||||
|
||||
ubuntu: "inecs/ansible-lab:ubuntu-latest"
|
||||
debian: "inecs/ansible-lab:debian-latest"
|
||||
systemd_defaults:
|
||||
privileged: true
|
||||
command: "/sbin/init"
|
||||
|
||||
@@ -17,7 +17,8 @@ images:
|
||||
alma: "inecs/ansible-lab:alma-latest"
|
||||
rocky: "inecs/ansible-lab:rocky-latest"
|
||||
redos: "inecs/ansible-lab:redos-latest"
|
||||
|
||||
ubuntu: "inecs/ansible-lab:ubuntu-latest"
|
||||
debian: "inecs/ansible-lab:debian-latest"
|
||||
systemd_defaults:
|
||||
privileged: true
|
||||
command: "/sbin/init"
|
||||
|
||||
@@ -17,7 +17,8 @@ images:
|
||||
alma: "inecs/ansible-lab:alma-latest"
|
||||
rocky: "inecs/ansible-lab:rocky-latest"
|
||||
redos: "inecs/ansible-lab:redos-latest"
|
||||
|
||||
ubuntu: "inecs/ansible-lab:ubuntu-latest"
|
||||
debian: "inecs/ansible-lab:debian-latest"
|
||||
systemd_defaults:
|
||||
privileged: true
|
||||
command: "/sbin/init"
|
||||
|
||||
@@ -17,7 +17,8 @@ images:
|
||||
alma: "inecs/ansible-lab:alma-latest"
|
||||
rocky: "inecs/ansible-lab:rocky-latest"
|
||||
redos: "inecs/ansible-lab:redos-latest"
|
||||
|
||||
ubuntu: "inecs/ansible-lab:ubuntu-latest"
|
||||
debian: "inecs/ansible-lab:debian-latest"
|
||||
systemd_defaults:
|
||||
privileged: true
|
||||
command: "/sbin/init"
|
||||
|
||||
@@ -17,7 +17,8 @@ images:
|
||||
alma: "inecs/ansible-lab:alma-latest"
|
||||
rocky: "inecs/ansible-lab:rocky-latest"
|
||||
redos: "inecs/ansible-lab:redos-latest"
|
||||
|
||||
ubuntu: "inecs/ansible-lab:ubuntu-latest"
|
||||
debian: "inecs/ansible-lab:debian-latest"
|
||||
systemd_defaults:
|
||||
privileged: true
|
||||
command: "/sbin/init"
|
||||
|
||||
@@ -17,7 +17,8 @@ images:
|
||||
alma: "inecs/ansible-lab:alma-latest"
|
||||
rocky: "inecs/ansible-lab:rocky-latest"
|
||||
redos: "inecs/ansible-lab:redos-latest"
|
||||
|
||||
ubuntu: "inecs/ansible-lab:ubuntu-latest"
|
||||
debian: "inecs/ansible-lab:debian-latest"
|
||||
systemd_defaults:
|
||||
privileged: true
|
||||
command: "/sbin/init"
|
||||
|
||||
@@ -17,7 +17,8 @@ images:
|
||||
alma: "inecs/ansible-lab:alma-latest"
|
||||
rocky: "inecs/ansible-lab:rocky-latest"
|
||||
redos: "inecs/ansible-lab:redos-latest"
|
||||
|
||||
ubuntu: "inecs/ansible-lab:ubuntu-latest"
|
||||
debian: "inecs/ansible-lab:debian-latest"
|
||||
systemd_defaults:
|
||||
privileged: true
|
||||
command: "/sbin/init"
|
||||
|
||||
@@ -52,6 +52,8 @@ check_images() {
|
||||
"inecs/ansible-lab:centos-latest"
|
||||
"inecs/ansible-lab:alma-latest"
|
||||
"inecs/ansible-lab:rocky-latest"
|
||||
"inecs/ansible-lab:ubuntu-latest"
|
||||
"inecs/ansible-lab:debian-latest"
|
||||
)
|
||||
|
||||
local missing_images=()
|
||||
@@ -101,6 +103,12 @@ check_images() {
|
||||
"inecs/ansible-lab:rocky-latest")
|
||||
echo " make docker build-image IMAGE=rocky"
|
||||
;;
|
||||
"inecs/ansible-lab:ubuntu-latest")
|
||||
echo " make docker build-image IMAGE=ubuntu"
|
||||
;;
|
||||
"inecs/ansible-lab:debian-latest")
|
||||
echo " make docker build-image IMAGE=debian"
|
||||
;;
|
||||
*)
|
||||
echo " # Неизвестный образ: $image"
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user