Browse Source

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.
pull/387/head
Aidaho 6 months ago
parent
commit
4caa8fdec3
  1. 39
      app/scripts/ansible/roles/service_common/tasks/main.yml

39
app/scripts/ansible/roles/service_common/tasks/main.yml

@ -19,7 +19,7 @@
- name: populate service facts - name: populate service facts
service_facts: service_facts:
- name: Creates directorys - name: Creates directories
file: file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
@ -31,7 +31,7 @@
- { path: "{{ service_dir }}/conf.d"} - { path: "{{ service_dir }}/conf.d"}
when: service not in ansible_facts.packages when: service not in ansible_facts.packages
- name: Creates directorys for Apache - name: Creates directories for Apache
file: file:
path: "{{ item.path }}" path: "{{ item.path }}"
state: directory state: directory
@ -45,34 +45,11 @@
- service not in ansible_facts.packages - service not in ansible_facts.packages
- service == "apache" - 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 - name: Install passlib
ansible.builtin.package: pip:
name: "{{passlib_ver}}" name: passlib
state: present executable: pip3
when: state: latest
- service not in ansible_facts.packages
- ansible_facts['distribution_major_version'] != '9'
environment:
http_proxy: "{{PROXY}}"
https_proxy: "{{PROXY}}"
- name: Copying over nginx.conf - name: Copying over nginx.conf
template: src={{item.src}} dest={{item.dest}} mode="0666" force="no" 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' when: ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS'
- name: Disble SELINUX in config - name: Disable SELINUX in config
template: template:
src: /var/www/haproxy-wi/app/scripts/ansible/roles/haproxy/templates/selinux.j2 src: /var/www/haproxy-wi/app/scripts/ansible/roles/haproxy/templates/selinux.j2
dest: /etc/selinux/config dest: /etc/selinux/config
@ -145,7 +122,7 @@
- '"Enforcing" in sestatus.stdout' - '"Enforcing" in sestatus.stdout'
- name: Disble SELINUX in env - name: Disable SELINUX in env
shell: setenforce 0 shell: setenforce 0
ignore_errors: yes ignore_errors: yes
debugger: never debugger: never

Loading…
Cancel
Save