From 4caa8fdec33c73673bc3afbe368b45b1f353b34a Mon Sep 17 00:00:00 2001 From: Aidaho Date: Thu, 23 May 2024 18:19:58 +0300 Subject: [PATCH] v7.2.5.0: Refactor ansible setup script and fix typos This commit includes a refactoring of the ansible setup script that simplifies the process of installing the python package 'passlib' by directly using pip3. Additionally, typos in the descriptors of certain tasks such as directory creation and SELINUX configuration have been corrected for better readability and understanding of the code. --- .../roles/service_common/tasks/main.yml | 39 ++++--------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/app/scripts/ansible/roles/service_common/tasks/main.yml b/app/scripts/ansible/roles/service_common/tasks/main.yml index 0fbe2a4..7038077 100644 --- a/app/scripts/ansible/roles/service_common/tasks/main.yml +++ b/app/scripts/ansible/roles/service_common/tasks/main.yml @@ -19,7 +19,7 @@ - name: populate service facts service_facts: -- name: Creates directorys +- name: Creates directories file: path: "{{ item.path }}" state: directory @@ -31,7 +31,7 @@ - { path: "{{ service_dir }}/conf.d"} when: service not in ansible_facts.packages -- name: Creates directorys for Apache +- name: Creates directories for Apache file: path: "{{ item.path }}" state: directory @@ -45,34 +45,11 @@ - service not in ansible_facts.packages - service == "apache" -- name: Set passlib version - set_fact: - passlib_ver: "python3-passlib" - when: ansible_facts['distribution_major_version'] == '8' or (ansible_facts['os_family'] == 'Debian' or ansible_facts['os_family'] == 'Ubuntu') - ignore_errors: True - -- name: Set passlib version - set_fact: - passlib_ver: "python-passlib" - when: ansible_facts['distribution_major_version'] == '7' - ignore_errors: True - -- name: Set passlib version - set_fact: - passlib_ver: "passlib" - when: ansible_facts['distribution_major_version'] == '9' - ignore_errors: True - - name: Install passlib - ansible.builtin.package: - name: "{{passlib_ver}}" - state: present - when: - - service not in ansible_facts.packages - - ansible_facts['distribution_major_version'] != '9' - environment: - http_proxy: "{{PROXY}}" - https_proxy: "{{PROXY}}" + pip: + name: passlib + executable: pip3 + state: latest - name: Copying over nginx.conf template: src={{item.src}} dest={{item.dest}} mode="0666" force="no" @@ -135,7 +112,7 @@ when: ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS' -- name: Disble SELINUX in config +- name: Disable SELINUX in config template: src: /var/www/haproxy-wi/app/scripts/ansible/roles/haproxy/templates/selinux.j2 dest: /etc/selinux/config @@ -145,7 +122,7 @@ - '"Enforcing" in sestatus.stdout' -- name: Disble SELINUX in env +- name: Disable SELINUX in env shell: setenforce 0 ignore_errors: yes debugger: never