--- # ============================================================================= # CONVERGE - Сборка и запуск тестовых сценариев # ============================================================================= - hosts: localhost gather_facts: false vars: # Получаем preset из переменной окружения или используем default preset_name: "{{ lookup('env', 'MOLECULE_PRESET') | default('default') }}" preset_file: "/workspace/molecule/presets/{{ preset_name }}.yml" tasks: - name: Display filtered hosts debug: msg: | ================================================================================ Начало работы converge.yml ================================================================================ # ============================================================================= # НАСТРОЙКА - Загрузка конфигурации и подготовка # ============================================================================= - name: Configuration setup debug: msg: | ================================================================================ НАСТРОЙКА - Загрузка пресетов конфигурации и подготовка ================================================================================ Preset: {{ preset_name }} ================================================================================ - name: Load preset configuration include_vars: "{{ preset_file }}" when: preset_file is file ignore_errors: true # ============================================================================= # ПОДГОТОВКА КОНТЕЙНЕРОВ (бывший run.yml) # ============================================================================= - name: Подготовка окружения для тестирования hosts: all become: true tasks: # Сброс цветовых кодов ANSI для корректного отображения - name: Reset ANSI color codes debug: msg: "\033[0m" changed_when: false tags: - setup - color-reset - name: Display filtered hosts debug: msg: | ================================================================================ ПОДГОТОВКА КОНТЕЙНЕРОВ ================================================================================ # Создание tmp директории для Ansible - name: Create Ansible tmp directory file: path: /tmp/.ansible-tmp state: directory mode: '0755' owner: root group: root tags: - setup - tmp # Обновление кеша пакетов для Debian/Ubuntu - name: Update package cache (Debian/Ubuntu) apt: update_cache: true cache_valid_time: 3600 when: ansible_os_family == 'Debian' changed_when: false tags: - setup - update # Обновление кеша пакетов для RHEL/CentOS/AlmaLinux/Rocky - name: Update package cache (RHEL/CentOS/AlmaLinux/Rocky) yum: update_cache: true when: ansible_os_family == 'RedHat' changed_when: false tags: - setup - update # Обновление кеша пакетов для Alt Linux - name: Update package cache (Alt Linux) command: apt-get update when: ansible_os_family == 'Altlinux' changed_when: false failed_when: false tags: - setup - update # Обновление кеша пакетов для Astra Linux - name: Update package cache (Astra Linux) command: apt-get update when: ansible_os_family == 'Astra Linux' changed_when: false failed_when: false tags: - setup - update # Установка common tools для всех ОС - name: Install common tools (Debian/Ubuntu) apt: name: - curl - jq - ca-certificates - iproute2 - iputils-ping - procps - net-tools - vim - wget - unzip - git - sudo state: present update_cache: false when: ansible_os_family == 'Debian' no_log: true tags: - setup - tools - name: Install common tools (RHEL/CentOS/AlmaLinux/Rocky) yum: name: - curl - jq - ca-certificates - iproute - iputils - procps-ng - net-tools - vim - wget - unzip - git - sudo state: present when: ansible_os_family == 'RedHat' no_log: true tags: - setup - tools - name: Install common tools (Alt Linux) command: apt-get install -y curl jq ca-certificates iproute2 iputils procps net-tools vim wget unzip git sudo when: ansible_os_family == 'Altlinux' changed_when: false failed_when: false no_log: true tags: - setup - tools - name: Install common tools (Astra Linux) command: apt-get install -y curl jq ca-certificates iproute2 iputils procps net-tools vim wget unzip git sudo when: ansible_os_family == 'Astra Linux' changed_when: false failed_when: false no_log: true tags: - setup - tools # Установка Python для Ansible (если не установлен) - name: Install Python (Debian/Ubuntu) apt: name: - python3 - python3-pip - python3-venv state: present when: ansible_os_family == 'Debian' no_log: true tags: - setup - python - name: Install Python (RHEL/CentOS/AlmaLinux/Rocky) yum: name: - python3 - python3-pip state: present when: ansible_os_family == 'RedHat' no_log: true tags: - setup - python - name: Install Python (Alt Linux) command: apt-get install -y python3 python3-pip when: ansible_os_family == 'Altlinux' changed_when: false failed_when: false no_log: true tags: - setup - python - name: Install Python (Astra Linux) command: apt-get install -y python3 python3-pip when: ansible_os_family == 'Astra Linux' changed_when: false failed_when: false no_log: true tags: - setup - python - name: Display filtered hosts debug: msg: | ================================================================================ ПОДГОТОВКА КОНТЕЙНЕРОВ ЗАВЕРШЕНА ================================================================================ - name: Display filtered hosts debug: msg: | ================================================================================ РАБОТА ФАЙЛА CONVERGE.YML ЗАВЕРШЕНА ================================================================================