From a1ed81b0a2380a9844fa3661926eec5b378eef04 Mon Sep 17 00:00:00 2001 From: Aidaho Date: Tue, 13 Aug 2024 00:21:42 +0300 Subject: [PATCH] v8.0: Comment out duplicate HAProxy installation task Disabled a redundant HAProxy installation section in the Ansible playbook by commenting it out. Also removed the unnecessary `distro` library import and standardized the Python interpreter path in the service installation module for cleanup and consistency. --- app/modules/service/installation.py | 4 +-- .../roles/haproxy/tasks/installation.yml | 34 +++++++++---------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/app/modules/service/installation.py b/app/modules/service/installation.py index da3e8974..3b6f4a65 100644 --- a/app/modules/service/installation.py +++ b/app/modules/service/installation.py @@ -3,7 +3,6 @@ import json from typing import Union from packaging import version -import distro import ansible import ansible_runner @@ -212,7 +211,6 @@ def run_ansible(inv: dict, server_ips: list, ansible_role: str) -> dict: proxy = sql.get_setting('proxy') proxy_serv = '' tags = '' - python_int = '/usr/bin/python3' if distro.id() == 'ubuntu' else '/usr/bin/python3.11' try: agent_pid = server_mod.start_ssh_agent() @@ -263,7 +261,7 @@ def run_ansible(inv: dict, server_ips: list, ansible_role: str) -> dict: 'AWX_DISPLAY': False, 'SSH_AUTH_PID': agent_pid['pid'], 'SSH_AUTH_SOCK': agent_pid['socket'], - 'ANSIBLE_PYTHON_INTERPRETER': python_int + 'ANSIBLE_PYTHON_INTERPRETER': '/usr/bin/python3' } kwargs = { 'private_data_dir': '/var/www/haproxy-wi/app/scripts/ansible/', diff --git a/app/scripts/ansible/roles/haproxy/tasks/installation.yml b/app/scripts/ansible/roles/haproxy/tasks/installation.yml index 70d6cde8..ad6e3542 100644 --- a/app/scripts/ansible/roles/haproxy/tasks/installation.yml +++ b/app/scripts/ansible/roles/haproxy/tasks/installation.yml @@ -37,23 +37,23 @@ http_proxy: "{{PROXY}}" https_proxy: "{{PROXY}}" -- name: Try to install another HAProxy {{HAPVER}} on {{distr_short_name}}{{ansible_facts['distribution_major_version']}} - yum: - name: - - http://repo1.roxy-wi.org/haproxy/haproxy-{{HAPVER}}.{{distr_short_name}}{{ansible_facts['distribution_major_version']}}.x86_64.rpm - - socat - - rsyslog - - bind-utils - state: present - when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and ("'timed out' in install_result.stderr") - ignore_errors: yes - register: install_result1 - retries: 3 - until: install_result1.rc == 0 - delay: 3 - environment: - http_proxy: "{{PROXY}}" - https_proxy: "{{PROXY}}" +#- name: Try to install another HAProxy {{HAPVER}} on {{distr_short_name}}{{ansible_facts['distribution_major_version']}} +# yum: +# name: +# - http://repo1.roxy-wi.org/haproxy/haproxy-{{HAPVER}}.{{distr_short_name}}{{ansible_facts['distribution_major_version']}}.x86_64.rpm +# - socat +# - rsyslog +# - bind-utils +# state: present +# when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and ("'timed out' in install_result.stderr") +# ignore_errors: yes +# register: install_result1 +# retries: 3 +# until: install_result1.rc == 0 +# delay: 3 +# environment: +# http_proxy: "{{PROXY}}" +# https_proxy: "{{PROXY}}" - name: set_fact from wi