Skip to content

Commit

Permalink
install a given nginx version, uninstall previous version, update test
Browse files Browse the repository at this point in the history
  • Loading branch information
loraine-gueguen committed Aug 2, 2024
1 parent 227cf47 commit 0e8839d
Show file tree
Hide file tree
Showing 4 changed files with 38 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
sequenceserver_nginx_version: 1.26.1
# 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.26.1
# 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
39 changes: 29 additions & 10 deletions tasks/install.dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,38 @@

# NGINX

- name: Get installed Nginx version
command:
cmd: nginx -v
register: get_nginx_version
check_mode: no
failed_when: get_nginx_version.rc != 0

- name: Uninstall NGINX if already installed
block:

- name: Set sequenceserver_installed_nginx_version variable

Check failure on line 15 in tasks/install.dependencies.yml

View workflow job for this annotation

GitHub Actions / Lint

15:3 [indentation] wrong indentation: expected 4 but found 2
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 }}"

# NGINX LDAP authentication

Expand All @@ -19,16 +48,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 0e8839d

Please sign in to comment.