diff --git a/molecule/default/create.yml b/molecule/default/create.yml index c9b024c..18e3c0b 100644 --- a/molecule/default/create.yml +++ b/molecule/default/create.yml @@ -85,6 +85,24 @@ loop_control: { label: "{{ item.name }}" } when: item.family is defined and images[item.family] is defined + # Ожидание стабилизации контейнеров + - name: Wait for containers to be ready + pause: + seconds: 5 + when: hosts | length > 0 + + # Создание tmp директории в контейнерах + - name: Create Ansible tmp directory in containers + community.docker.docker_container_exec: + container: "{{ item.name }}" + command: "mkdir -p /tmp/.ansible-tmp && chmod 755 /tmp/.ansible-tmp" + loop: "{{ hosts | selectattr('type','undefined') | list }}" + loop_control: { label: "{{ item.name }}" } + when: item.family is defined and images[item.family] is defined + ignore_errors: true + retries: 3 + delay: 2 + # DinD nodes - name: Start DinD nodes (docker:27-dind) community.docker.docker_container: @@ -144,6 +162,7 @@ [all:vars] ansible_connection=community.docker.docker ansible_python_interpreter=/usr/bin/python3 + ansible_remote_tmp=/tmp/.ansible-tmp {% for group, members in (groups_map | dictsort) %} [{{ group }}] diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 7b45134..10213ac 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -49,8 +49,11 @@ provisioner: config_options: defaults: stdout_callback: yaml + remote_tmp: /tmp/.ansible-tmp + interpreter_python: auto_silent env: ANSIBLE_STDOUT_CALLBACK: yaml + ANSIBLE_REMOTE_TMP: /tmp/.ansible-tmp inventory: links: hosts: "${MOLECULE_EPHEMERAL_DIRECTORY}/inventory/hosts.ini" diff --git a/molecule/default/site.yml b/molecule/default/site.yml index 18d4d75..4fd6237 100644 --- a/molecule/default/site.yml +++ b/molecule/default/site.yml @@ -13,6 +13,17 @@ hosts: all become: true tasks: + # Создание 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: @@ -127,6 +138,18 @@ - setup - python + # Установка Python 3.8+ для RHEL/CentOS/Rocky/AlmaLinux + - name: Install Python 3.8+ (RHEL/CentOS/Rocky/AlmaLinux) + yum: + name: + - python3 + - python3-pip + state: present + when: ansible_os_family == 'RedHat' + tags: + - setup + - python + - name: Install Python (RHEL/CentOS/AlmaLinux/Rocky) yum: name: