Skip to content

Commit

Permalink
Add support to provision role for multiple mount points
Browse files Browse the repository at this point in the history
This supports linking a container service to multiple XNAT instances. The docker server will have a separate external storage drive mounted for each XNAT server.
  • Loading branch information
tomdoel committed Jul 23, 2024
1 parent cdc28f6 commit a8090a5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions playbooks/install_xnat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@

roles:
- role: mirsg.infrastructure.provision
vars:
provision_mount_points:
"{{ container_service_mounts | default([ external_storage_drive ]) }} "
- role: mirsg.infrastructure.install_python
- role: mirsg.infrastructure.docker
- role: mirsg.infrastructure.firewalld
Expand Down
8 changes: 4 additions & 4 deletions roles/provision/tasks/check_mounts.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
- name: Ensure correct permissions are set for the mountpoint
ansible.builtin.file:
path: "{{ external_storage_drive }}"
path: "{{ mount_point }}"
owner: root
group: root
state: directory
mode: "0755"

- name: "Check if storage is mounted: {{ external_storage_drive }}"
ansible.builtin.command: mountpoint {{ external_storage_drive }}
- name: "Check if storage is mounted: {{ mount_point }}"
ansible.builtin.command: mountpoint {{ mount_point }}
register: check_mountpoint
failed_when: false
changed_when: false
Expand All @@ -22,7 +22,7 @@
- name:
Check that storage has been mounted correctly if it was previously not
mounted
ansible.builtin.command: mountpoint {{ external_storage_drive }}
ansible.builtin.command: mountpoint {{ mount_point }}
when: "'is not a mountpoint' in check_mountpoint.stdout"
register: check_mountpoint_again
failed_when: "'is not a mountpoint' in check_mountpoint_again.stdout"
Expand Down
5 changes: 4 additions & 1 deletion roles/provision/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
- name: Check mounts are available
tags: restart
ansible.builtin.include_tasks: check_mounts.yml
when: external_storage_drive is defined
vars:
mount_point: "{{ item }}"
loop: "{{ provision_mount_points | default([external_storage_drive]) }}"
when: provision_mount_points is defined or external_storage_drive is defined

- name: Set up for RedHat 7
ansible.builtin.include_tasks: RedHat7.yml
Expand Down

0 comments on commit a8090a5

Please sign in to comment.