Skip to content

Commit

Permalink
Container service updates (#141)
Browse files Browse the repository at this point in the history
Adds automatic pulling/updating of container service images as part of
ansible run.
This is useful in helping to keep the container service up to date with
the latest images.

I have also added a REST call to enable the AutoRun pipeline if a flag
is set. The AutoRun pipeline is currently needed to send session archive
notification emails, but can be disabled (default) if these are not
required.

---------

Co-authored-by: Daniel Matthews <[email protected]>
  • Loading branch information
tomdoel and drmatthews authored Oct 11, 2024
1 parent a93ac09 commit 5596400
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
3 changes: 3 additions & 0 deletions roles/xnat/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@ xnat_config_logo: /images/logo.png # use the default XNAT logo

# Pipeline engine
xnat_pipeline_engine_enabled: true

# Note that AutoRun is currently required for session archive notifications
xnat_autorun_enabled: false
14 changes: 14 additions & 0 deletions roles/xnat/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,17 @@
validate_certs: "{{ ssl.validate_certs }}"
status_code: 200, 201, 304
loop: "{{ automation_scripts | default([]) }}"

- name: Enable AutoRun pipeline
ansible.builtin.uri:
url: "{{ web_server.url }}/xapi/pipelines"
user: "{{ xnat_service_admin.username }}"
password: "{{ xnat_service_admin.password }}"
method: POST
body_format: json
body:
autoRunEnabled: true
allowAutoRunProjectOverride: false
validate_certs: "{{ ssl.validate_certs }}"
status_code: 200
when: xnat_autorun_enabled
14 changes: 13 additions & 1 deletion roles/xnat_container_service/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,16 @@
vars:
container_registry: "{{ item }}"
loop: "{{ xnat_container_service_hubs | default([]) }}"
when: external_storage_drive is defined

- name: Pull containers
ansible.builtin.uri:
url:
"{{ web_server.url }}/xapi/docker/hubs/{{ item.hub_name }}/pull?image={{
item.image }}&save-commands=true"
user: "{{ xnat_service_admin.username }}"
password: "{{ xnat_service_admin.password }}"
method: POST
body_format: json
validate_certs: "{{ ssl.validate_certs }}"
status_code: 200, 404
loop: "{{ xnat_container_service_images | default([]) }}"

0 comments on commit 5596400

Please sign in to comment.