Обновление проекта

This commit is contained in:
Сергей Антропов
2025-10-28 19:19:49 +03:00
parent 0b4efd9ca1
commit f6d1182193
11 changed files with 257 additions and 31 deletions

View File

@@ -3,6 +3,12 @@
# Автор: Сергей Антропов
# Сайт: https://devops.org.ru
- name: "Reset ANSI color codes"
debug:
msg: "\033[0m"
changed_when: false
tags: [python, color-reset]
- name: "Отладочная информация о системе"
debug:
msg:
@@ -85,6 +91,14 @@
- python_current_package_manager in ['apt', 'dnf', 'zypper']
- python_current_package_manager != 'unknown'
- name: "Обновление списка пакетов (ClearLinux)"
command: "swupd update"
changed_when: false
when:
- python_current_package_manager == 'swupd'
- python_current_package_manager != 'unknown'
ignore_errors: true
- name: "Обновление списка пакетов после добавления репозиториев"
package:
name: "*"
@@ -104,6 +118,14 @@
when:
- python_current_build_deps | length > 0
- python_current_package_manager != 'unknown'
- python_current_package_manager != 'swupd'
ignore_errors: true
- name: "Установка системных зависимостей для компиляции (ClearLinux)"
command: "swupd bundle-add {{ python_current_build_deps | join(' ') }}"
when:
- python_current_build_deps | length > 0
- python_current_package_manager == 'swupd'
ignore_errors: true
# =============================================================================
@@ -124,6 +146,16 @@
when:
- python_current_packages | length > 0
- python_current_package_manager != 'unknown'
- python_current_package_manager != 'swupd'
- python_version_check.rc != 0
register: python_package_install
ignore_errors: true
- name: "Установка Python из пакетов (ClearLinux)"
command: "swupd bundle-add {{ python_current_packages | join(' ') }}"
when:
- python_current_packages | length > 0
- python_current_package_manager == 'swupd'
- python_version_check.rc != 0
register: python_package_install
ignore_errors: true
@@ -187,7 +219,7 @@
- python_current_packages | length == 0
- python_version_check.rc != 0
- download_result is defined
- download_result.status_code == 200
- download_result.rc is defined and download_result.rc == 0
- name: "Конфигурация Python для компиляции"
command: >
@@ -207,7 +239,7 @@
- python_current_packages | length == 0
- python_version_check.rc != 0
- download_result is defined
- download_result.status_code == 200
- download_result.rc is defined and download_result.rc == 0
- name: "Компиляция Python"
make:
@@ -217,7 +249,7 @@
- python_current_packages | length == 0
- python_version_check.rc != 0
- download_result is defined
- download_result.status_code == 200
- download_result.rc is defined and download_result.rc == 0
- name: "Установка скомпилированного Python"
make:
@@ -228,7 +260,7 @@
- python_current_packages | length == 0
- python_version_check.rc != 0
- download_result is defined
- download_result.status_code == 200
- download_result.rc is defined and download_result.rc == 0
- name: "Обновление библиотек для скомпилированного Python"
command: "ldconfig"
@@ -238,7 +270,7 @@
- python_current_packages | length == 0
- python_version_check.rc != 0
- download_result is defined
- download_result.status_code == 200
- download_result.rc is defined and download_result.rc == 0
# =============================================================================
# ЭТАП 7: СОЗДАНИЕ СИМВОЛИЧЕСКИХ ССЫЛОК
@@ -407,6 +439,19 @@
- pip_latest_version is defined
- pip_current_version.stdout is defined
- pip_latest_version not in pip_current_version.stdout
- python_current_package_manager != 'swupd'
ignore_errors: true
- name: "Обновление pip до последней версии (ClearLinux)"
command: "{{ python_current_pip }} install --upgrade pip --break-system-packages"
changed_when: false
when:
- python_version_check.rc == 0
- pip_current_version.rc == 0
- pip_latest_version is defined
- pip_current_version.stdout is defined
- pip_latest_version not in pip_current_version.stdout
- python_current_package_manager == 'swupd'
ignore_errors: true
# =============================================================================
@@ -473,6 +518,7 @@
package_facts:
manager: "{{ python_current_package_manager }}"
when: python_current_package_manager != 'unknown'
ignore_errors: true
- name: "Финальный отчет об установке"
debug:
@@ -483,10 +529,10 @@
================================================================================
📊 ИНФОРМАЦИЯ О СИСТЕМЕ:
• Дистрибутив: {{ system_facts.ansible_facts.distribution }} {{ system_facts.ansible_facts.distribution_version }}
• Семейство ОС: {{ system_facts.ansible_facts.os_family }}
• Архитектура: {{ system_facts.ansible_facts.architecture }}
• Ядро: {{ system_facts.ansible_facts.kernel }}
• Дистрибутив: {{ ansible_distribution }} {{ ansible_distribution_version }}
• Семейство ОС: {{ ansible_os_family }}
• Архитектура: {{ ansible_architecture }}
• Ядро: {{ ansible_kernel }}
🐍 PYTHON:
• Версия: {{ final_python_version.stdout | default('НЕ УСТАНОВЛЕН') }}

View File

@@ -24,6 +24,7 @@ python_package_managers:
"alt linux": "apt-rpm"
astra: "apt"
"astra linux": "apt"
clearlinux: "swupd"
# Пакеты для установки Python 3.12 в разных дистрибутивах
python_packages_by_os:
@@ -120,6 +121,13 @@ python_packages_by_os:
- python3.12-lib2to3
- python3.12-gdbm
- python3.12-tk
clearlinux:
- python3
- python3-dev
- python3-pip
- python3-setuptools
- python3-wheel
- python3-venv
"alt linux":
- python3.12
- python3.12-devel
@@ -196,6 +204,7 @@ python_update_commands:
"alt linux": "apt-get update"
astra: "apt update"
"astra linux": "apt update"
clearlinux: "swupd update"
# Команды для установки пакетов
python_install_commands:
@@ -213,6 +222,7 @@ python_install_commands:
"alt linux": "apt-get install -y"
astra: "apt install -y"
"astra linux": "apt install -y"
clearlinux: "swupd bundle-add"
# Пути к исполняемым файлам Python
python_executable_paths:
@@ -230,6 +240,7 @@ python_executable_paths:
"alt linux": "/usr/bin/python3.12"
astra: "/usr/bin/python3.12"
"astra linux": "/usr/bin/python3.12"
clearlinux: "/usr/bin/python3"
# Пути к pip
python_pip_paths:
@@ -247,6 +258,7 @@ python_pip_paths:
"alt linux": "/usr/bin/pip3.12"
astra: "/usr/bin/pip3.12"
"astra linux": "/usr/bin/pip3.12"
clearlinux: "/usr/bin/pip3"
# Системные зависимости для компиляции
python_build_deps_by_os:
@@ -441,6 +453,20 @@ python_build_deps_by_os:
- libdb-dev
- libpcap-dev
- liblzma-dev
clearlinux:
- os-core-devel
- python3-dev
- zlib-devel
- openssl-devel
- libffi-devel
- sqlite-devel
- readline-devel
- bzip2-devel
- ncurses-devel
- xz-devel
- tk-devel
- gdbm-devel
- expat-devel
"alt linux":
- gcc
- gcc-c++