Skip to content

Commit

Permalink
install a given specific nginx version, uninstall previous version (#28)
Browse files Browse the repository at this point in the history
 install a given nginx version, uninstall previous version, update test
  • Loading branch information
loraine-gueguen authored Aug 2, 2024
1 parent 227cf47 commit b0b3d6c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 10 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
40 changes: 30 additions & 10 deletions tasks/install.dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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<version>\\d+\\.\\d+\\.\\d+)', '\\g<version>') | 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

Expand All @@ -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<version>\\d+\\.\\d+\\.\\d+)', '\\g<version>') | first }}"

- name: Create directory for nginx related sources if it does not exist
file:
path: "{{ sequenceserver_nginx_loaded_sources_path }}"
Expand Down

0 comments on commit b0b3d6c

Please sign in to comment.