Добавлена поддержка собственных образов для molecule тестирования

- Созданы пресеты для тестирования с собственными образами:
  - custom-minimal.yml - минимальный тест (4 хоста)
  - custom-images.yml - полный тест (все образы)
  - custom-performance.yml - тест производительности (8 хостов)
- Обновлен molecule.yml для поддержки собственных образов
- Добавлен скрипт test-custom-images.sh для автоматизации тестирования
- Добавлены команды в Makefile:
  - make custom-images test [minimal|full|performance]
  - make custom-images check - проверка наличия образов
  - make custom-images build - сборка всех образов
- Поддержка образов: ansible-controller, alt-linux, astra-linux, redos, rhel, centos, alma, rocky

Автор: Сергей Антропов
Сайт: https://devops.org.ru
This commit is contained in:
Сергей Антропов
2025-10-25 15:46:05 +03:00
parent d8fa474522
commit 3b2533c8ee
6 changed files with 612 additions and 0 deletions

View File

@@ -0,0 +1,143 @@
---
#description: Пресет для тестирования на собственных образах AnsibleTemplate
# Автор: Сергей Антропов
# Сайт: https://devops.org.ru
docker_network: ansible-lab
generated_inventory: "{{ molecule_ephemeral_directory }}/inventory/hosts.ini"
# Собственные образы AnsibleTemplate
images:
# Debian-based образы
ansible-controller: "inecs/ansible-lab:ansible-controller-latest"
# ALT Linux
alt-linux: "inecs/ansible-lab:alt-linux-latest"
# Astra Linux
astra-linux: "inecs/ansible-lab:astra-linux-latest"
# RedOS
redos: "inecs/ansible-lab:redos-latest"
# RHEL-based образы
rhel: "inecs/ansible-lab:rhel-latest"
centos: "inecs/ansible-lab:centos-latest"
alma: "inecs/ansible-lab:alma-latest"
rocky: "inecs/ansible-lab:rocky-latest"
systemd_defaults:
privileged: true
command: "/sbin/init"
volumes:
- "/sys/fs/cgroup:/sys/fs/cgroup:ro"
tmpfs: ["/run", "/run/lock"]
capabilities: ["SYS_ADMIN"]
# Описание кластера с собственными образами
hosts:
# Ansible Controller
- name: ansible-controller
family: debian
groups: [controller, ansible, management]
image: "{{ images.ansible-controller }}"
publish: ["8080:8080", "8443:8443"]
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "{{ molecule_ephemeral_directory }}/ansible:/ansible"
# ALT Linux серверы
- name: alt1
family: alt
groups: [alt, servers, web]
image: "{{ images.alt-linux }}"
- name: alt2
family: alt
groups: [alt, servers, app]
image: "{{ images.alt-linux }}"
# Astra Linux серверы
- name: astra1
family: astra
groups: [astra, servers, web]
image: "{{ images.astra-linux }}"
- name: astra2
family: astra
groups: [astra, servers, app]
image: "{{ images.astra-linux }}"
# RedOS серверы
- name: redos1
family: redos
groups: [redos, servers, web]
image: "{{ images.redos }}"
- name: redos2
family: redos
groups: [redos, servers, app]
image: "{{ images.redos }}"
# RHEL серверы
- name: rhel1
family: rhel
groups: [rhel, servers, web]
image: "{{ images.rhel }}"
- name: rhel2
family: rhel
groups: [rhel, servers, app]
image: "{{ images.rhel }}"
# CentOS серверы
- name: centos1
family: centos
groups: [centos, servers, web]
image: "{{ images.centos }}"
- name: centos2
family: centos
groups: [centos, servers, app]
image: "{{ images.centos }}"
# AlmaLinux серверы
- name: alma1
family: alma
groups: [alma, servers, web]
image: "{{ images.alma }}"
- name: alma2
family: alma
groups: [alma, servers, app]
image: "{{ images.alma }}"
# Rocky Linux серверы
- name: rocky1
family: rocky
groups: [rocky, servers, web]
image: "{{ images.rocky }}"
- name: rocky2
family: rocky
groups: [rocky, servers, app]
image: "{{ images.rocky }}"
# База данных на разных ОС
- name: db-rhel
family: rhel
groups: [database, rhel, db]
image: "{{ images.rhel }}"
publish: ["5432:5432", "3306:3306"]
- name: db-centos
family: centos
groups: [database, centos, db]
image: "{{ images.centos }}"
publish: ["5433:5432", "3307:3306"]
# Load balancer на ALT Linux
- name: lb-alt
family: alt
groups: [loadbalancer, haproxy, alt]
image: "{{ images.alt-linux }}"
publish: ["80:80", "443:443"]
# Мониторинг на Astra Linux
- name: monitor-astra
family: astra
groups: [monitoring, prometheus, astra]
image: "{{ images.astra-linux }}"
publish: ["9090:9090", "3000:3000"]