diff --git a/README.md b/README.md index 010fea5..53d27d5 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,8 @@ sequenceserver_user: "sequenceserver" Variable to define the user running the sequenceserver service and submitting the SLURM jobs. This user must have a SLURM account. ```yaml +# NGINX version to install, from https://nginx.org/packages/mainline +sequenceserver_nginx_version: 1.25.5 # proxy_read_timeout (nginx directive) sequenceserver_proxy_read_timeout: 180 # Authentication with LDAP - Mandatory if users or groups are used in variable sequenceserver_blast_db diff --git a/defaults/main.yml b/defaults/main.yml index 96e6afc..56e96fb 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -61,6 +61,8 @@ sequenceserver_user: "sequenceserver" # NGINX # +# NGINX version to install +sequenceserver_nginx_version: 1.25.5 # proxy_read_timeout (nginx directive) sequenceserver_proxy_read_timeout: 180 # Authentication with LDAP - Mandatory if users or groups are used in variable sequenceserver_blast_db diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index 7a578f2..932e83e 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -54,3 +54,8 @@ ansible.builtin.file: path: /tmp mode: '1777' + - name: Install previous Nginx version, to test uninstall + include_role: + name: nginxinc.nginx + vars: + nginx_version: =1.23.1-1~focal diff --git a/tasks/install.dependencies.yml b/tasks/install.dependencies.yml index 32f054f..d9a3beb 100644 --- a/tasks/install.dependencies.yml +++ b/tasks/install.dependencies.yml @@ -2,9 +2,39 @@ # NGINX +- name: Get installed Nginx version + command: + cmd: nginx -v + register: get_nginx_version + check_mode: no + failed_when: get_nginx_version.rc != 0 + changed_when: false + +- name: Uninstall NGINX if already installed + block: + + - name: Set sequenceserver_installed_nginx_version variable + set_fact: + sequenceserver_installed_nginx_version: "{{ get_nginx_version.stderr | regex_search('nginx/(?P\\d+\\.\\d+\\.\\d+)', '\\g') | first }}" + + - name: Display installed NGINX version + ansible.builtin.debug: + var: sequenceserver_installed_nginx_version + + - name: Uninstall Nginx + include_role: + name: nginxinc.nginx + vars: + nginx_setup: "uninstall" + when: sequenceserver_installed_nginx_version != sequenceserver_nginx_version + + when: not get_nginx_version.failed + - name: Install Nginx include_role: name: nginxinc.nginx + vars: + nginx_version: "={{ sequenceserver_nginx_version }}-1~focal" # NGINX LDAP authentication @@ -19,16 +49,6 @@ - name: Install the nginx-ldap-auth module when not present block: - - name: Get installed Nginx version - command: - cmd: nginx -v - register: get_nginx_version - check_mode: no - - - name: Set sequenceserver_nginx_version variable - set_fact: - sequenceserver_nginx_version: "{{ get_nginx_version.stderr | regex_search('nginx/(?P\\d+\\.\\d+\\.\\d+)', '\\g') | first }}" - - name: Create directory for nginx related sources if it does not exist file: path: "{{ sequenceserver_nginx_loaded_sources_path }}"