Skip to content

Conversation

dvalinrh
Copy link
Contributor

@dvalinrh dvalinrh commented Oct 2, 2025

Description

Fixes it so the private network ip is present when we run uperf.

Before/After Comparison

Before: Due to the reboot, and restarting ssh we lose the ipv4 private ip address.
After: Address is present.

Clerical Stuff

This closes #288

Relates to JIRA: RPOPC-636

@dvalinrh dvalinrh requested a review from a team October 2, 2025 12:57
Copy link

github-actions bot commented Oct 2, 2025

PullHero Review

Provider: generativelanguage.googleapis.com Model: gemini-2.0-flash

Okay, I've reviewed the proposed changes. Here's my analysis:

Code Review

The changes address a known issue with networking on Ubuntu, specifically related to netplan and ensuring consistent IP addressing for network interfaces used in the ssh_key_exchange role. The changes also avoid restarting the sshd service on ubuntu due to connectivity issues after restart.

Positive Aspects:

  • Addresses a Real Problem: The changes directly tackle a networking quirk in Ubuntu that can disrupt the ssh_key_exchange process.
  • Conditional Logic: The use of when: config_info.os_vendor == "ubuntu" ensures that the Ubuntu-specific commands are only executed when necessary, preventing unintended consequences on other operating systems.
  • Clear Intent: The comments clearly explain the reasoning behind the changes, improving code readability and maintainability.

Areas for Concern:

  • Hardcoded Interface Name: The ifconfig commands use ens6 as the interface name. This might not be consistent across all Ubuntu systems. It would be better to dynamically determine the correct interface name.
  • IP Address Assignment: The IP addresses 10.0.25.100 and 10.0.25.101 are hardcoded. While these might work in many scenarios, it would be better to dynamically assign IP addresses or allow them to be configurable.
  • Idempotency: The apt -y install net-tools commands are not idempotent. If net-tools is already installed, apt will return a non-zero exit code (though, with -y, it will still continue). It's better to use the apt module in Ansible to ensure idempotency. Also, the net config with ifconfig is not persistent across reboots.
  • Testing: There are no explicit tests included to verify that these changes fix the Ubuntu networking issue without causing regressions on other platforms.

Suggestions:

  1. Dynamically Determine Interface Name: Use Ansible facts or a shell command to determine the correct interface name instead of hardcoding ens6. Something like ansible_facts.default_ipv4.interface or ip route | awk '{print $5;exit}'

  2. Consider Dynamic IP Assignment: Explore options for dynamically assigning IP addresses. This could involve using DHCP or a configuration file to store the IP assignments. If dynamic assignment is not feasible, at least make the IP addresses configurable via variables.

  3. Use Ansible apt Module: Replace the shell command with the Ansible apt module for installing net-tools to ensure idempotency:

    - name: Ensure net-tools is installed
      become: yes
      apt:
        name: net-tools
        state: present
  4. Add Testing: Include tests (even simple connectivity tests) to verify the changes on Ubuntu and ensure no regressions on other platforms. This could be done using ping or a similar command.

  5. Document Netplan Persistence: Add a note about the ifconfig commands not being persistent across reboots and suggest looking into netplan for more robust network configuration.

Revised Code Snippet (Illustrative):

---
#
# Ubuntu is a bit of a pain with netplan.  Issue ifconfig here in hopes
# of having the ip stick.
#
- name: Ubuntu net config
  block:
  - name: Ensure net-tools is installed
    become: yes
    apt:
      name: net-tools
      state: present

  - name: Get network interface
    command: "ip route | awk '{print $5;exit}'"
    register: network_interface

  - name: ifconfig host 0
    delegate_to: "{{ ip_list[0] }}"
    become: yes
    shell: "ifconfig {{ network_interface.stdout }} 10.0.25.100 netmask 255.255.255.0"

  - name: ifconfig host 1
    delegate_to: "{{ ip_list[1] }}"
    become: yes
    shell: "ifconfig {{ network_interface.stdout }} 10.0.25.101 netmask 255.255.255.0"
    
  when: config_info.os_vendor == "ubuntu"

  # tasks file for roles/ssh_key_exchange
- name: SSH KeyGen command


**Vote**: 0

**[PullHero](https://github.com/pullhero/)**

Copy link

github-actions bot commented Oct 2, 2025

This relates to RPOPC-636

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ubuntu is dropping the private network.
1 participant