Skip to content

Commit

Permalink
Fix lustre IP route detection if there is no gateway (#567)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jovial authored Feb 12, 2025
1 parent b35f61c commit 302011e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions ansible/roles/lustre/tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
- name: Gather Lustre interface info
shell:
cmd: |
ip r get {{ _lustre_mgs_ip }}
ip --json r get {{ _lustre_mgs_ip }}
changed_when: false
register: _lustre_ip_r_mgs
vars:
_lustre_mgs_ip: "{{ lustre_mgs_nid | split('@') | first }}"

- name: Set facts for Lustre interface
set_fact:
_lustre_interface: "{{ _lustre_ip_r_mgs_info[4] }}"
_lustre_ip: "{{ _lustre_ip_r_mgs_info[6] }}"
_lustre_interface: "{{ _lustre_ip_r_mgs_info.dev }}"
_lustre_ip: "{{ _lustre_ip_r_mgs_info.prefsrc }}"
vars:
_lustre_ip_r_mgs_info: "{{ _lustre_ip_r_mgs.stdout_lines.0 | split }}"
# first line e.g. "10.167.128.1 via 10.179.0.2 dev eth0 src 10.179.3.149 uid 1000"
_lustre_ip_r_mgs_info: "{{ _lustre_ip_r_mgs.stdout | from_json | first }}"

- name: Write LNet configuration file
template:
Expand Down Expand Up @@ -44,4 +43,3 @@
state: "{{ (item.mount_state | default(lustre_mount_state)) }}"
opts: "{{ item.mount_options | default(lustre_mount_options) }}"
loop: "{{ lustre_mounts }}"

0 comments on commit 302011e

Please sign in to comment.