diff --git a/docs/presets-by-os.md b/docs/presets-by-os.md new file mode 100644 index 0000000..faf58bd --- /dev/null +++ b/docs/presets-by-os.md @@ -0,0 +1,167 @@ +# Пресеты по операционным системам + +Этот документ описывает специализированные пресеты для тестирования на конкретных версиях операционных систем. + +## 🐧 Ubuntu пресеты + +### ubuntu-all.yml +**Описание:** Пресет со всеми версиями Ubuntu (20.04, 22.04, 24.04) +**Хосты:** 6 хостов (по 2 на каждую версию) +**Порты:** 8020-8025 +**Использование:** +```bash +make role test ubuntu-all +``` + +### ubuntu20.yml +**Описание:** Пресет для Ubuntu 20.04 LTS +**Хосты:** 3 хоста (web, db, app) +**Порты:** 8020-8022 +**Использование:** +```bash +make role test ubuntu20 +``` + +### ubuntu22.yml +**Описание:** Пресет для Ubuntu 22.04 LTS +**Хосты:** 3 хоста (web, db, app) +**Порты:** 8022-8024 +**Использование:** +```bash +make role test ubuntu22 +``` + +### ubuntu24.yml +**Описание:** Пресет для Ubuntu 24.04 LTS +**Хосты:** 3 хоста (web, db, app) +**Порты:** 8024-8026 +**Использование:** +```bash +make role test ubuntu24 +``` + +## 🐧 Debian пресеты + +### debian-all.yml +**Описание:** Пресет со всеми версиями Debian (9, 10, 11, 12) +**Хосты:** 8 хостов (по 2 на каждую версию) +**Порты:** 9009-9016 +**Использование:** +```bash +make role test debian-all +``` + +### debian9.yml +**Описание:** Пресет для Debian 9 Stretch +**Хосты:** 3 хоста (web, db, app) +**Порты:** 9009-9011 +**Использование:** +```bash +make role test debian9 +``` + +### debian10.yml +**Описание:** Пресет для Debian 10 Buster +**Хосты:** 3 хоста (web, db, app) +**Порты:** 9012-9014 +**Использование:** +```bash +make role test debian10 +``` + +### debian11.yml +**Описание:** Пресет для Debian 11 Bullseye +**Хосты:** 3 хоста (web, db, app) +**Порты:** 9015-9017 +**Использование:** +```bash +make role test debian11 +``` + +### debian12.yml +**Описание:** Пресет для Debian 12 Bookworm +**Хосты:** 3 хоста (web, db, app) +**Порты:** 9018-9020 +**Использование:** +```bash +make role test debian12 +``` + +## 🐧 CentOS пресеты + +### centos-all.yml +**Описание:** Пресет со всеми версиями CentOS (7, 8, 9) +**Хосты:** 6 хостов (по 2 на каждую версию) +**Порты:** 7007-7012 +**Использование:** +```bash +make role test centos-all +``` + +### centos7.yml +**Описание:** Пресет для CentOS 7 +**Хосты:** 3 хоста (web, db, app) +**Порты:** 7007-7009 +**Использование:** +```bash +make role test centos7 +``` + +### centos8.yml +**Описание:** Пресет для CentOS 8 +**Хосты:** 3 хоста (web, db, app) +**Порты:** 7010-7012 +**Использование:** +```bash +make role test centos8 +``` + +### centos9.yml +**Описание:** Пресет для CentOS 9 Stream +**Хосты:** 3 хоста (web, db, app) +**Порты:** 7013-7015 +**Использование:** +```bash +make role test centos9 +``` + +## 📊 Сравнение пресетов + +| Пресет | ОС | Версии | Хостов | Порты | Назначение | +|--------|----|---------|---------|--------|------------| +| ubuntu-all | Ubuntu | 20.04, 22.04, 24.04 | 6 | 8020-8025 | Тестирование всех версий Ubuntu | +| debian-all | Debian | 9, 10, 11, 12 | 8 | 9009-9016 | Тестирование всех версий Debian | +| centos-all | CentOS | 7, 8, 9 | 6 | 7007-7012 | Тестирование всех версий CentOS | +| ubuntu20 | Ubuntu | 20.04 | 3 | 8020-8022 | Тестирование Ubuntu 20.04 | +| ubuntu22 | Ubuntu | 22.04 | 3 | 8022-8024 | Тестирование Ubuntu 22.04 | +| ubuntu24 | Ubuntu | 24.04 | 3 | 8024-8026 | Тестирование Ubuntu 24.04 | +| debian9 | Debian | 9 | 3 | 9009-9011 | Тестирование Debian 9 | +| debian10 | Debian | 10 | 3 | 9012-9014 | Тестирование Debian 10 | +| debian11 | Debian | 11 | 3 | 9015-9017 | Тестирование Debian 11 | +| debian12 | Debian | 12 | 3 | 9018-9020 | Тестирование Debian 12 | +| centos7 | CentOS | 7 | 3 | 7007-7009 | Тестирование CentOS 7 | +| centos8 | CentOS | 8 | 3 | 7010-7012 | Тестирование CentOS 8 | +| centos9 | CentOS | 9 | 3 | 7013-7015 | Тестирование CentOS 9 | + +## 🎯 Рекомендации по использованию + +### Для разработки: +- Используйте `ubuntu22` или `debian12` для быстрого тестирования +- Используйте `ubuntu-all` для проверки совместимости с разными версиями Ubuntu + +### Для продакшена: +- Используйте `centos-all` для проверки RHEL-совместимых систем +- Используйте `debian-all` для проверки Debian-совместимых систем + +### Для CI/CD: +- Используйте отдельные пресеты для изолированного тестирования +- Используйте `*-all` пресеты для комплексной проверки совместимости + +## 🔧 Настройка портов + +Все пресеты используют уникальные диапазоны портов: +- **Ubuntu:** 8020-8026 +- **Debian:** 9009-9020 +- **CentOS:** 7007-7015 + +Это позволяет запускать несколько пресетов одновременно без конфликтов портов. diff --git a/molecule/presets/centos-all.yml b/molecule/presets/centos-all.yml new file mode 100644 index 0000000..bd47a91 --- /dev/null +++ b/molecule/presets/centos-all.yml @@ -0,0 +1,52 @@ +--- +#description: Пресет со всеми версиями CentOS (7, 8, 9) +# Автор: Сергей Антропов +# Сайт: https://devops.org.ru + +docker_network: labnet +generated_inventory: "{{ molecule_ephemeral_directory }}/inventory/hosts.ini" + +# systemd-ready образы CentOS +images: + centos7: "inecs/ansible-lab:centos7-latest" + centos8: "inecs/ansible-lab:centos8-latest" + centos9: "inecs/ansible-lab:centos9-latest" + +systemd_defaults: + privileged: true + command: "/sbin/init" + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + tmpfs: ["/run", "/run/lock"] + capabilities: ["SYS_ADMIN"] + +hosts: + # CentOS 7 + - name: centos7-1 + family: centos7 + groups: [centos, test, web] + publish: ["7007:80"] + - name: centos7-2 + family: centos7 + groups: [centos, test, db] + publish: ["7008:80"] + + # CentOS 8 + - name: centos8-1 + family: centos8 + groups: [centos, test, web] + publish: ["7009:80"] + - name: centos8-2 + family: centos8 + groups: [centos, test, db] + publish: ["7010:80"] + + # CentOS 9 Stream + - name: centos9-1 + family: centos9 + groups: [centos, test, web] + publish: ["7011:80"] + - name: centos9-2 + family: centos9 + groups: [centos, test, db] + publish: ["7012:80"] diff --git a/molecule/presets/centos7.yml b/molecule/presets/centos7.yml new file mode 100644 index 0000000..fd9c12c --- /dev/null +++ b/molecule/presets/centos7.yml @@ -0,0 +1,34 @@ +--- +#description: Пресет для CentOS 7 +# Автор: Сергей Антропов +# Сайт: https://devops.org.ru + +docker_network: labnet +generated_inventory: "{{ molecule_ephemeral_directory }}/inventory/hosts.ini" + +# systemd-ready образ CentOS 7 +images: + centos7: "inecs/ansible-lab:centos7-latest" + +systemd_defaults: + privileged: true + command: "/sbin/init" + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + tmpfs: ["/run", "/run/lock"] + capabilities: ["SYS_ADMIN"] + +hosts: + # CentOS 7 хосты + - name: centos7-web + family: centos7 + groups: [centos, test, web] + publish: ["7007:80"] + - name: centos7-db + family: centos7 + groups: [centos, test, db] + publish: ["7008:80"] + - name: centos7-app + family: centos7 + groups: [centos, test, app] + publish: ["7009:80"] diff --git a/molecule/presets/centos8.yml b/molecule/presets/centos8.yml new file mode 100644 index 0000000..f07f183 --- /dev/null +++ b/molecule/presets/centos8.yml @@ -0,0 +1,34 @@ +--- +#description: Пресет для CentOS 8 +# Автор: Сергей Антропов +# Сайт: https://devops.org.ru + +docker_network: labnet +generated_inventory: "{{ molecule_ephemeral_directory }}/inventory/hosts.ini" + +# systemd-ready образ CentOS 8 +images: + centos8: "inecs/ansible-lab:centos8-latest" + +systemd_defaults: + privileged: true + command: "/sbin/init" + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + tmpfs: ["/run", "/run/lock"] + capabilities: ["SYS_ADMIN"] + +hosts: + # CentOS 8 хосты + - name: centos8-web + family: centos8 + groups: [centos, test, web] + publish: ["7010:80"] + - name: centos8-db + family: centos8 + groups: [centos, test, db] + publish: ["7011:80"] + - name: centos8-app + family: centos8 + groups: [centos, test, app] + publish: ["7012:80"] diff --git a/molecule/presets/centos9.yml b/molecule/presets/centos9.yml new file mode 100644 index 0000000..2f7beb8 --- /dev/null +++ b/molecule/presets/centos9.yml @@ -0,0 +1,34 @@ +--- +#description: Пресет для CentOS 9 Stream +# Автор: Сергей Антропов +# Сайт: https://devops.org.ru + +docker_network: labnet +generated_inventory: "{{ molecule_ephemeral_directory }}/inventory/hosts.ini" + +# systemd-ready образ CentOS 9 +images: + centos9: "inecs/ansible-lab:centos9-latest" + +systemd_defaults: + privileged: true + command: "/sbin/init" + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + tmpfs: ["/run", "/run/lock"] + capabilities: ["SYS_ADMIN"] + +hosts: + # CentOS 9 Stream хосты + - name: centos9-web + family: centos9 + groups: [centos, test, web] + publish: ["7013:80"] + - name: centos9-db + family: centos9 + groups: [centos, test, db] + publish: ["7014:80"] + - name: centos9-app + family: centos9 + groups: [centos, test, app] + publish: ["7015:80"] diff --git a/molecule/presets/debian-all.yml b/molecule/presets/debian-all.yml new file mode 100644 index 0000000..12af22f --- /dev/null +++ b/molecule/presets/debian-all.yml @@ -0,0 +1,63 @@ +--- +#description: Пресет со всеми версиями Debian (9, 10, 11, 12) +# Автор: Сергей Антропов +# Сайт: https://devops.org.ru + +docker_network: labnet +generated_inventory: "{{ molecule_ephemeral_directory }}/inventory/hosts.ini" + +# systemd-ready образы Debian +images: + debian9: "inecs/ansible-lab:debian9-latest" + debian10: "inecs/ansible-lab:debian10-latest" + debian11: "inecs/ansible-lab:debian11-latest" + debian12: "inecs/ansible-lab:debian12-latest" + +systemd_defaults: + privileged: true + command: "/sbin/init" + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + tmpfs: ["/run", "/run/lock"] + capabilities: ["SYS_ADMIN"] + +hosts: + # Debian 9 Stretch + - name: debian9-1 + family: debian9 + groups: [debian, test, web] + publish: ["9009:80"] + - name: debian9-2 + family: debian9 + groups: [debian, test, db] + publish: ["9010:80"] + + # Debian 10 Buster + - name: debian10-1 + family: debian10 + groups: [debian, test, web] + publish: ["9011:80"] + - name: debian10-2 + family: debian10 + groups: [debian, test, db] + publish: ["9012:80"] + + # Debian 11 Bullseye + - name: debian11-1 + family: debian11 + groups: [debian, test, web] + publish: ["9013:80"] + - name: debian11-2 + family: debian11 + groups: [debian, test, db] + publish: ["9014:80"] + + # Debian 12 Bookworm + - name: debian12-1 + family: debian12 + groups: [debian, test, web] + publish: ["9015:80"] + - name: debian12-2 + family: debian12 + groups: [debian, test, db] + publish: ["9016:80"] diff --git a/molecule/presets/debian10.yml b/molecule/presets/debian10.yml new file mode 100644 index 0000000..6e255b3 --- /dev/null +++ b/molecule/presets/debian10.yml @@ -0,0 +1,34 @@ +--- +#description: Пресет для Debian 10 Buster +# Автор: Сергей Антропов +# Сайт: https://devops.org.ru + +docker_network: labnet +generated_inventory: "{{ molecule_ephemeral_directory }}/inventory/hosts.ini" + +# systemd-ready образ Debian 10 +images: + debian10: "inecs/ansible-lab:debian10-latest" + +systemd_defaults: + privileged: true + command: "/sbin/init" + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + tmpfs: ["/run", "/run/lock"] + capabilities: ["SYS_ADMIN"] + +hosts: + # Debian 10 Buster хосты + - name: debian10-web + family: debian10 + groups: [debian, test, web] + publish: ["9012:80"] + - name: debian10-db + family: debian10 + groups: [debian, test, db] + publish: ["9013:80"] + - name: debian10-app + family: debian10 + groups: [debian, test, app] + publish: ["9014:80"] diff --git a/molecule/presets/debian11.yml b/molecule/presets/debian11.yml new file mode 100644 index 0000000..0abf90a --- /dev/null +++ b/molecule/presets/debian11.yml @@ -0,0 +1,34 @@ +--- +#description: Пресет для Debian 11 Bullseye +# Автор: Сергей Антропов +# Сайт: https://devops.org.ru + +docker_network: labnet +generated_inventory: "{{ molecule_ephemeral_directory }}/inventory/hosts.ini" + +# systemd-ready образ Debian 11 +images: + debian11: "inecs/ansible-lab:debian11-latest" + +systemd_defaults: + privileged: true + command: "/sbin/init" + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + tmpfs: ["/run", "/run/lock"] + capabilities: ["SYS_ADMIN"] + +hosts: + # Debian 11 Bullseye хосты + - name: debian11-web + family: debian11 + groups: [debian, test, web] + publish: ["9015:80"] + - name: debian11-db + family: debian11 + groups: [debian, test, db] + publish: ["9016:80"] + - name: debian11-app + family: debian11 + groups: [debian, test, app] + publish: ["9017:80"] diff --git a/molecule/presets/debian12.yml b/molecule/presets/debian12.yml new file mode 100644 index 0000000..a51d751 --- /dev/null +++ b/molecule/presets/debian12.yml @@ -0,0 +1,34 @@ +--- +#description: Пресет для Debian 12 Bookworm +# Автор: Сергей Антропов +# Сайт: https://devops.org.ru + +docker_network: labnet +generated_inventory: "{{ molecule_ephemeral_directory }}/inventory/hosts.ini" + +# systemd-ready образ Debian 12 +images: + debian12: "inecs/ansible-lab:debian12-latest" + +systemd_defaults: + privileged: true + command: "/sbin/init" + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + tmpfs: ["/run", "/run/lock"] + capabilities: ["SYS_ADMIN"] + +hosts: + # Debian 12 Bookworm хосты + - name: debian12-web + family: debian12 + groups: [debian, test, web] + publish: ["9018:80"] + - name: debian12-db + family: debian12 + groups: [debian, test, db] + publish: ["9019:80"] + - name: debian12-app + family: debian12 + groups: [debian, test, app] + publish: ["9020:80"] diff --git a/molecule/presets/debian9.yml b/molecule/presets/debian9.yml new file mode 100644 index 0000000..306dd93 --- /dev/null +++ b/molecule/presets/debian9.yml @@ -0,0 +1,34 @@ +--- +#description: Пресет для Debian 9 Stretch +# Автор: Сергей Антропов +# Сайт: https://devops.org.ru + +docker_network: labnet +generated_inventory: "{{ molecule_ephemeral_directory }}/inventory/hosts.ini" + +# systemd-ready образ Debian 9 +images: + debian9: "inecs/ansible-lab:debian9-latest" + +systemd_defaults: + privileged: true + command: "/sbin/init" + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + tmpfs: ["/run", "/run/lock"] + capabilities: ["SYS_ADMIN"] + +hosts: + # Debian 9 Stretch хосты + - name: debian9-web + family: debian9 + groups: [debian, test, web] + publish: ["9009:80"] + - name: debian9-db + family: debian9 + groups: [debian, test, db] + publish: ["9010:80"] + - name: debian9-app + family: debian9 + groups: [debian, test, app] + publish: ["9011:80"] diff --git a/molecule/presets/ubuntu-all.yml b/molecule/presets/ubuntu-all.yml new file mode 100644 index 0000000..fea2790 --- /dev/null +++ b/molecule/presets/ubuntu-all.yml @@ -0,0 +1,52 @@ +--- +#description: Пресет со всеми версиями Ubuntu (20.04, 22.04, 24.04) +# Автор: Сергей Антропов +# Сайт: https://devops.org.ru + +docker_network: labnet +generated_inventory: "{{ molecule_ephemeral_directory }}/inventory/hosts.ini" + +# systemd-ready образы Ubuntu +images: + ubuntu20: "inecs/ansible-lab:ubuntu20-latest" + ubuntu22: "inecs/ansible-lab:ubuntu22-latest" + ubuntu24: "inecs/ansible-lab:ubuntu24-latest" + +systemd_defaults: + privileged: true + command: "/sbin/init" + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + tmpfs: ["/run", "/run/lock"] + capabilities: ["SYS_ADMIN"] + +hosts: + # Ubuntu 20.04 LTS + - name: ubuntu20-1 + family: ubuntu20 + groups: [ubuntu, test, web] + publish: ["8020:80"] + - name: ubuntu20-2 + family: ubuntu20 + groups: [ubuntu, test, db] + publish: ["8021:80"] + + # Ubuntu 22.04 LTS + - name: ubuntu22-1 + family: ubuntu22 + groups: [ubuntu, test, web] + publish: ["8022:80"] + - name: ubuntu22-2 + family: ubuntu22 + groups: [ubuntu, test, db] + publish: ["8023:80"] + + # Ubuntu 24.04 LTS + - name: ubuntu24-1 + family: ubuntu24 + groups: [ubuntu, test, web] + publish: ["8024:80"] + - name: ubuntu24-2 + family: ubuntu24 + groups: [ubuntu, test, db] + publish: ["8025:80"] diff --git a/molecule/presets/ubuntu20.yml b/molecule/presets/ubuntu20.yml new file mode 100644 index 0000000..ca04b6d --- /dev/null +++ b/molecule/presets/ubuntu20.yml @@ -0,0 +1,34 @@ +--- +#description: Пресет для Ubuntu 20.04 LTS +# Автор: Сергей Антропов +# Сайт: https://devops.org.ru + +docker_network: labnet +generated_inventory: "{{ molecule_ephemeral_directory }}/inventory/hosts.ini" + +# systemd-ready образ Ubuntu 20.04 +images: + ubuntu20: "inecs/ansible-lab:ubuntu20-latest" + +systemd_defaults: + privileged: true + command: "/sbin/init" + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + tmpfs: ["/run", "/run/lock"] + capabilities: ["SYS_ADMIN"] + +hosts: + # Ubuntu 20.04 LTS хосты + - name: ubuntu20-web + family: ubuntu20 + groups: [ubuntu, test, web] + publish: ["8020:80"] + - name: ubuntu20-db + family: ubuntu20 + groups: [ubuntu, test, db] + publish: ["8021:80"] + - name: ubuntu20-app + family: ubuntu20 + groups: [ubuntu, test, app] + publish: ["8022:80"] diff --git a/molecule/presets/ubuntu22.yml b/molecule/presets/ubuntu22.yml new file mode 100644 index 0000000..63f43ac --- /dev/null +++ b/molecule/presets/ubuntu22.yml @@ -0,0 +1,34 @@ +--- +#description: Пресет для Ubuntu 22.04 LTS +# Автор: Сергей Антропов +# Сайт: https://devops.org.ru + +docker_network: labnet +generated_inventory: "{{ molecule_ephemeral_directory }}/inventory/hosts.ini" + +# systemd-ready образ Ubuntu 22.04 +images: + ubuntu22: "inecs/ansible-lab:ubuntu22-latest" + +systemd_defaults: + privileged: true + command: "/sbin/init" + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + tmpfs: ["/run", "/run/lock"] + capabilities: ["SYS_ADMIN"] + +hosts: + # Ubuntu 22.04 LTS хосты + - name: ubuntu22-web + family: ubuntu22 + groups: [ubuntu, test, web] + publish: ["8022:80"] + - name: ubuntu22-db + family: ubuntu22 + groups: [ubuntu, test, db] + publish: ["8023:80"] + - name: ubuntu22-app + family: ubuntu22 + groups: [ubuntu, test, app] + publish: ["8024:80"] diff --git a/molecule/presets/ubuntu24.yml b/molecule/presets/ubuntu24.yml new file mode 100644 index 0000000..3454ae4 --- /dev/null +++ b/molecule/presets/ubuntu24.yml @@ -0,0 +1,34 @@ +--- +#description: Пресет для Ubuntu 24.04 LTS +# Автор: Сергей Антропов +# Сайт: https://devops.org.ru + +docker_network: labnet +generated_inventory: "{{ molecule_ephemeral_directory }}/inventory/hosts.ini" + +# systemd-ready образ Ubuntu 24.04 +images: + ubuntu24: "inecs/ansible-lab:ubuntu24-latest" + +systemd_defaults: + privileged: true + command: "/sbin/init" + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + tmpfs: ["/run", "/run/lock"] + capabilities: ["SYS_ADMIN"] + +hosts: + # Ubuntu 24.04 LTS хосты + - name: ubuntu24-web + family: ubuntu24 + groups: [ubuntu, test, web] + publish: ["8024:80"] + - name: ubuntu24-db + family: ubuntu24 + groups: [ubuntu, test, db] + publish: ["8025:80"] + - name: ubuntu24-app + family: ubuntu24 + groups: [ubuntu, test, app] + publish: ["8026:80"] diff --git a/roles/deploy.yml b/roles/deploy.yml index 6e43308..5dd65c3 100644 --- a/roles/deploy.yml +++ b/roles/deploy.yml @@ -6,5 +6,5 @@ - name: Развертывание всех ролей hosts: all roles: - # - ping - - devops + - ping + # - devops