Skip to content

Commit 302011e

Browse files
authored
Fix lustre IP route detection if there is no gateway (#567)
* Fix lustre IP route detection if there is no gateway This handles the following case ``` 172.26.0.251 dev ib0 src 172.26.0.196 uid 0 ``` in addition to: ``` 10.167.128.1 via 10.179.0.2 dev eth0 src 10.179.3.149 uid 1000 ``` * Use json output of IP * Trailing whitespace * json output is a list
1 parent b35f61c commit 302011e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

ansible/roles/lustre/tasks/configure.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
- name: Gather Lustre interface info
22
shell:
33
cmd: |
4-
ip r get {{ _lustre_mgs_ip }}
4+
ip --json r get {{ _lustre_mgs_ip }}
55
changed_when: false
66
register: _lustre_ip_r_mgs
77
vars:
88
_lustre_mgs_ip: "{{ lustre_mgs_nid | split('@') | first }}"
99

1010
- name: Set facts for Lustre interface
1111
set_fact:
12-
_lustre_interface: "{{ _lustre_ip_r_mgs_info[4] }}"
13-
_lustre_ip: "{{ _lustre_ip_r_mgs_info[6] }}"
12+
_lustre_interface: "{{ _lustre_ip_r_mgs_info.dev }}"
13+
_lustre_ip: "{{ _lustre_ip_r_mgs_info.prefsrc }}"
1414
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"
15+
_lustre_ip_r_mgs_info: "{{ _lustre_ip_r_mgs.stdout | from_json | first }}"
1716

1817
- name: Write LNet configuration file
1918
template:
@@ -44,4 +43,3 @@
4443
state: "{{ (item.mount_state | default(lustre_mount_state)) }}"
4544
opts: "{{ item.mount_options | default(lustre_mount_options) }}"
4645
loop: "{{ lustre_mounts }}"
47-

0 commit comments

Comments
 (0)