Skip to content

Commit

Permalink
Merge pull request #47 from stackhpc/dev
Browse files Browse the repository at this point in the history
Make the role more resilient to path only oss (v19.8.1)
  • Loading branch information
brtkwr authored Aug 15, 2019
2 parents 21acbbe + 40e75e3 commit 93304ca
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ beegfs_oss:
- port: 8003
dev: "/dev/sdb"
path: # specifying dev overrides path
beegfs_oss_tunable: "{{ beegfs_oss | map(attribute='dev') | map('relpath', '/dev/' ) | list }}"
beegfs_oss_tunable: "{{ beegfs_oss | selectattr('dev', 'defined') | map(attribute='dev') | map('relpath', '/dev/' ) | list }}"
# Whether to support multiple ports per OSS:
# - if this is set to false, make sure that you configure the ports to the same
# value when passing beegfs_oss as an input.
Expand Down
9 changes: 6 additions & 3 deletions tasks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,16 @@

- include: oss.yml
vars:
oss_replace: "{{ '-r' if (oss_item == beegfs_oss|first or beegfs_oss_multi_port) else '' }}"
oss_path: "{{ oss_item.path | default(beegfs_oss_path_prefix + oss_item.dev) }}"
oss_dev: "{{ oss_item.dev | default('') }}"
oss_dev_is_defined: "{{ oss_item.dev is defined }}"
oss_path: "{{ oss_item.path | default(beegfs_oss_path_prefix + oss_dev) }}"
oss_port: "{{ oss_item.port }}"
oss_dev: "{{ oss_item.dev | default(omit) }}"
oss_replace: "{{ '-r' if (oss_item == beegfs_oss|first or beegfs_oss_multi_port) else '' }}"
with_items: "{{ beegfs_oss }}"
loop_control:
loop_var: oss_item
failed_when: >
(oss_item.dev is not defined and oss_item.path is not defined)
when: beegfs_enable.oss | default(false) | bool

- include: tuning.yml
Expand Down
4 changes: 3 additions & 1 deletion tasks/destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
enabled: false
state: stopped
become: true
when: beegfs_enable.oss | bool
when:
- beegfs_enable.oss | bool
- item.dev is defined
with_items: "{{ beegfs_oss }}"

- name: Stop and disable BeeGFS storage services
Expand Down
10 changes: 3 additions & 7 deletions tasks/oss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,15 @@
src: "{{ oss_dev }}"
path: "{{ oss_path }}"
state: unmounted
when:
- oss_dev is defined
- beegfs_force_format | bool
when: beegfs_force_format | bool
notify: Restart BeeGFS storage service
- name: Attempt to format if the device is not mounted or if beegfs_force_format is true
filesystem:
dev: "{{ oss_dev }}"
fstype: "{{ beegfs_fstype }}"
force: "{{ beegfs_force_format | bool }}"
opts: "{{ beegfs_filesystem_opts }}"
when:
- oss_dev is defined
- (oss_dev not in mounted_devs) or (beegfs_force_format | bool)
when: (oss_dev not in mounted_devs) or (beegfs_force_format | bool)
notify: Restart BeeGFS storage service
- name: Ensure the mount point exists
file:
Expand All @@ -58,9 +54,9 @@
fstype: "{{ beegfs_fstype }}"
state: mounted
opts: "{{ beegfs_mount_opts }}"
when: oss_dev is defined
notify: Restart BeeGFS storage service
become: true
when: oss_dev_is_defined

- name: Run storage service setup script
command: |
Expand Down

0 comments on commit 93304ca

Please sign in to comment.