Skip to content

Commit e59b2be

Browse files
committed
autodetermine lustre interface
1 parent 22be72c commit e59b2be

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

ansible/roles/lustre/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ Install and configure a Lustre client. This builds RPM packages from source.
1515
- `fs_name`: The name of the filesystem to mount
1616
- `mount_point`: Path to mount filesystem at. Default is `/mnt/lustre/{{ lustre_fs_name}}`
1717
- `mount_state`: Mountpoint state, as for [ansible.posix.mount](https://docs.ansible.com/ansible/latest/collections/ansible/posix/mount_module.html#parameter-state). Default `mounted`.
18-
Any of these parameters may alternatively be specified as role variables prefixed `lustre_`. If both are given entries in `lustre_mounts` take priority.
19-
- `lustre_subnet_cidr`: Required str. CIDR of subnet for interface to be used for Lustre.
18+
TODO: FIXME: Any of these parameters may alternatively be specified as role variables prefixed `lustre_`. If both are given entries in `lustre_mounts` take priority.
2019
The following variables control the package build and and install and should not generally be required:
2120
- `lustre_build_packages`: Optional list. Prerequisite packages required to build Lustre. See `defaults/main.yml`.
2221
- `lustre_build_dir`: Optional str. Path to build lustre at, default `/tmp/lustre-release`.

ansible/roles/lustre/defaults/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
lustre_version: '2.15.5' # https://www.lustre.org/lustre-2-15-5-released/
2-
#lustre_subnet_cidr:
32
#lustre_mgs_nid:
43
lustre_fs_name: lustre
54
lustre_mount_point: "/mnt/lustre/{{ lustre_fs_name }}"

ansible/roles/lustre/tasks/configure.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
- name: Gather interface info
1+
- name: Gather Lustre interface info
22
shell:
33
cmd: |
4-
ip -o -f inet addr show | awk '{print $2, $4}' | awk -F/ '{print $1}'
4+
ip r get {{ _lustre_mgs_ip }}
55
changed_when: false
6-
register: _inet_interfaces
6+
register: _lustre_ip_r_mgs
7+
vars:
8+
_lustre_mgs_ip: "{{ lustre_mgs_nid | split('@') | first }}"
79

8-
- name: Set fact for Lustre interface
10+
- name: Set facts for Lustre interface
911
set_fact:
10-
_lustre_interface: "{{ item.0 }}"
11-
when: lustre_subnet_cidr | ansible.utils.network_in_usable(item.1)
12-
loop: "{{ _inet_interfaces.stdout_lines | map('split') }}"
13-
14-
- name: Ensure Lustre interface found
15-
assert:
16-
that: _lustre_interface is defined
17-
fail_msg: "No interface was found for lustre_subnet_cidr={{ lustre_subnet_cidr }}"
12+
_lustre_interface: "{{ _lustre_ip_r_mgs_info[4] }}"
13+
_lustre_ip: "{{ _lustre_ip_r_mgs_info[6] }}"
14+
vars:
15+
_lustre_ip_r_mgs_info: "{{ _lustre_ip_r_mgs.stdout_lines.0 | split }}"
16+
# first line e.g. "10.167.128.1 via 10.179.0.2 dev eth0 src 10.179.3.149 uid 1000"
1817

1918
- name: Write LNet configuration file
2019
template:
@@ -29,7 +28,6 @@
2928
systemd:
3029
name: lnet
3130
state: "{{ 'restarted' if _lnet_conf.changed else 'started' }}"
32-
when: _lnet_conf.changed
3331

3432
- name: Ensure mount points exist
3533
ansible.builtin.file:

0 commit comments

Comments
 (0)