From 104000b468612d5f0f2982d4e55542a0b654187c Mon Sep 17 00:00:00 2001 From: Vasily Kleschov Date: Tue, 10 Feb 2026 19:03:57 +0100 Subject: [PATCH 1/2] Add ability to force-install some systemd packages to make the flow working --- alts/shared/models.py | 4 +++ alts/worker/runners/base.py | 6 +++- .../roles/install_uninstall/tasks/main.yml | 29 ++++++++++++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/alts/shared/models.py b/alts/shared/models.py index d93da4c..c6c41a6 100644 --- a/alts/shared/models.py +++ b/alts/shared/models.py @@ -318,6 +318,10 @@ def __init__(self, **data): 'kernel', 'dnf', ] + force_install_pkgs: List[str] = [ + 'systemd-standalone-sysusers', + 'systemd-standalone-tmpfiles', + ] keepalive_interval: int = 30 # unit in seconds commands_exec_timeout: int = 30 # unit in seconds provision_timeout: int = 1200 # 20 minutes in seconds diff --git a/alts/worker/runners/base.py b/alts/worker/runners/base.py index 40865de..351ed3f 100644 --- a/alts/worker/runners/base.py +++ b/alts/worker/runners/base.py @@ -876,11 +876,13 @@ def install_package_no_log( package_version=package_version, package_epoch=package_epoch, ) + force_install = package_name in CONFIG.force_install_pkgs self._logger.info( - 'Installing %s on %s...', + 'Installing %s on %s...%s', full_pkg_name, self.env_name, + ' (force install due to known conflicts)' if force_install else '', ) cmd_args = [ '-i', @@ -892,6 +894,8 @@ def install_package_no_log( f'pkg_version={package_version}', '-e', f'dist_name={dist_name}', + '-e', + f'force_install={force_install}', ] if module_name and module_stream and module_version: cmd_args.extend([ diff --git a/resources/roles/install_uninstall/tasks/main.yml b/resources/roles/install_uninstall/tasks/main.yml index 6cdac15..46e5472 100644 --- a/resources/roles/install_uninstall/tasks/main.yml +++ b/resources/roles/install_uninstall/tasks/main.yml @@ -121,9 +121,36 @@ name: "{{ pkg_name }}" state: present args: "{{ dnf_args }}" - when: ansible_facts.os_family == 'RedHat' + when: + - ansible_facts.os_family == 'RedHat' + - not (force_install | default(false) | bool) + tags: + - install_package + +- name: Force install RPM package (bypass conflicts) + when: + - ansible_facts.os_family == 'RedHat' + - force_install | default(false) | bool tags: - install_package + block: + - name: Create temporary directory for forced RPM download + ansible.builtin.file: + path: /tmp/force_install + state: directory + + - name: Download RPM package + ansible.builtin.shell: + cmd: "dnf download --destdir=/tmp/force_install {{ pkg_name }}" + + - name: Install downloaded RPM bypassing conflicts + ansible.builtin.shell: + cmd: "rpm -i --nodeps --force /tmp/force_install/*.rpm" + + - name: Clean up downloaded RPMs + ansible.builtin.file: + path: /tmp/force_install + state: absent - name: Install DEB package ansible.builtin.apt: From 537b7cb899dd98e91bab438300baefb37d6b51f0 Mon Sep 17 00:00:00 2001 From: Daniil Anfimov Date: Mon, 23 Feb 2026 14:42:57 +0200 Subject: [PATCH 2/2] Bug fixes --- alts/shared/models.py | 4 ---- alts/worker/runners/base.py | 7 +------ .../roles/install_uninstall/defaults/main.yml | 5 +++++ .../roles/install_uninstall/tasks/main.yml | 21 ++++++++++++++++--- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/alts/shared/models.py b/alts/shared/models.py index c6c41a6..d93da4c 100644 --- a/alts/shared/models.py +++ b/alts/shared/models.py @@ -318,10 +318,6 @@ def __init__(self, **data): 'kernel', 'dnf', ] - force_install_pkgs: List[str] = [ - 'systemd-standalone-sysusers', - 'systemd-standalone-tmpfiles', - ] keepalive_interval: int = 30 # unit in seconds commands_exec_timeout: int = 30 # unit in seconds provision_timeout: int = 1200 # 20 minutes in seconds diff --git a/alts/worker/runners/base.py b/alts/worker/runners/base.py index 351ed3f..dbcfcf1 100644 --- a/alts/worker/runners/base.py +++ b/alts/worker/runners/base.py @@ -876,13 +876,10 @@ def install_package_no_log( package_version=package_version, package_epoch=package_epoch, ) - force_install = package_name in CONFIG.force_install_pkgs - self._logger.info( - 'Installing %s on %s...%s', + 'Installing %s on %s...', full_pkg_name, self.env_name, - ' (force install due to known conflicts)' if force_install else '', ) cmd_args = [ '-i', @@ -894,8 +891,6 @@ def install_package_no_log( f'pkg_version={package_version}', '-e', f'dist_name={dist_name}', - '-e', - f'force_install={force_install}', ] if module_name and module_stream and module_version: cmd_args.extend([ diff --git a/resources/roles/install_uninstall/defaults/main.yml b/resources/roles/install_uninstall/defaults/main.yml index 770f498..38fd845 100644 --- a/resources/roles/install_uninstall/defaults/main.yml +++ b/resources/roles/install_uninstall/defaults/main.yml @@ -4,3 +4,8 @@ el7_disablerepo_pkg_prefixes: el7_disablerepo_repos: - centos-7-os - centos-7-updates +dnf_download_utils_pkg: "dnf-utils" +yum_download_utils_pkg: "yum-utils" +force_install_pkgs: + - "systemd-standalone-sysusers" + - "systemd-standalone-tmpfiles" diff --git a/resources/roles/install_uninstall/tasks/main.yml b/resources/roles/install_uninstall/tasks/main.yml index 46e5472..1129be5 100644 --- a/resources/roles/install_uninstall/tasks/main.yml +++ b/resources/roles/install_uninstall/tasks/main.yml @@ -19,6 +19,7 @@ is_ea_apache24_mod_cgid: "{{ pkg_name.startswith('ea-apache24-mod_cgid') }}" is_ea_apache24_mod_http2: "{{ pkg_name.startswith('ea-apache24-mod_http2') }}" dnf_args: "{{ default_dnf_args | combine(extra_dnf_args) | combine(disablerepo_args) }}" + force_install: "{{ force_install_pkgs | select('in', pkg_name) | list | length > 0 }}" apt_args: allow_unauthenticated: true vars: @@ -123,14 +124,24 @@ args: "{{ dnf_args }}" when: - ansible_facts.os_family == 'RedHat' - - not (force_install | default(false) | bool) + - not (force_install | bool) + tags: + - install_package + +- name: Ensure download utilities are installed + ansible.builtin.package: + name: "{{ yum_download_utils_pkg if ansible_facts.distribution_major_version | int <= 7 else dnf_download_utils_pkg }}" + state: present + when: + - ansible_facts.os_family == 'RedHat' + - force_install | bool tags: - install_package - name: Force install RPM package (bypass conflicts) when: - ansible_facts.os_family == 'RedHat' - - force_install | default(false) | bool + - force_install | bool tags: - install_package block: @@ -141,7 +152,11 @@ - name: Download RPM package ansible.builtin.shell: - cmd: "dnf download --destdir=/tmp/force_install {{ pkg_name }}" + cmd: >- + {{ 'yumdownloader --destdir=/tmp/force_install' + if ansible_facts.distribution_major_version | int <= 7 + else 'dnf download --destdir=/tmp/force_install' }} + {{ pkg_name }} - name: Install downloaded RPM bypassing conflicts ansible.builtin.shell: