Skip to content

Conversation

@ipspace
Copy link
Owner

@ipspace ipspace commented Jan 29, 2026

This commit refactors the readiness checks to integrate the internal SSH readiness checks with the Ansible checks (for example, the check for the first Junos interface):

Data structure changes:

  • The devices that require readiness checks MUST have netlab_ready group variable, which should include value 'ansible' for devices with Ansible checks. This commit modifies device definitions for all devices using readiness checks
  • The 'ansible' output module creates netlab_ready_ansible and netlab_ready_ssh groups

netlab initial changes:

  • The 'ready' module got its own run function which is invoked with the args.ready option
  • The 'ready' module first collect the nodes based on their wait-for-ready requirements, executes internal readiness checks, and starts the Ansible 'device-ready' playbook if needed
  • The internal readiness checks can be disable in topology defaults (defaults.netlab.initial.ready.check variable)
  • deploy.run function calls ready.run function as one of the first steps
  • deploy.run and ready.run functions use log.section_header for improved logging functionality

Ansible-related changes:

  • The 'device-ready.ansible' playbook is split into two plays (SSH readiness and Ansible checks)
  • The new ansible groups are used in 'device-ready.ansible' playbook to limit the hosts involved in each play
  • The 'wait-for-ready' task list is no longer included into the initial-config.ansible playbook -- the readiness check is performed solely in the device-ready.ansible playbook
  • The 'wait-for-ready' task list no longer performs the generic readiness checks (ssh was the only generic check). The generic checks are performed as plays in the 'device-ready.ansible' playbook

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors the device readiness checking system to better integrate internal SSH checks with device-specific Ansible checks. The key improvement is separating the responsibilities: Python code handles SSH connectivity checks, while Ansible playbooks handle device-specific readiness conditions (like waiting for interfaces to appear).

Changes:

  • Refactored readiness check architecture to separate internal (Python) SSH checks from Ansible-based device checks
  • Modified device definitions to specify readiness requirements via netlab_ready group variable with values 'ssh' and/or 'ansible'
  • Split the device-ready Ansible playbook into two distinct plays for SSH and device-specific checks

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.

Show a summary per file
File Description
netsim/outputs/ansible.py Creates dynamic Ansible inventory groups (netlab_ready_ssh, netlab_ready_ansible) based on device readiness requirements
netsim/devices/*.yml Updates device definitions to specify readiness check requirements; Junos family devices inherit from parent, other devices explicitly declare
netsim/defaults/netlab.yml Adds configuration to specify which readiness checks use internal code vs Ansible
netsim/cli/initial/utils.py Refactors Ansible argument building; adds get_deploy_nodeset helper function
netsim/cli/initial/ready.py Implements new run function with internal SSH checks and conditional Ansible playbook execution
netsim/cli/initial/deploy.py Integrates ready.run into deployment flow with improved logging via section_header
netsim/cli/initial/init.py Simplifies initial command flow by delegating to ready.run
netsim/ansible/tasks/wait-for-ready.yml Removes generic SSH checks (now handled by dedicated play)
netsim/ansible/tasks/readiness-check/vyos-clab.yml Removes redundant wait_for_connection (SSH checked in separate play)
netsim/ansible/initial-config.ansible Removes wait-for-ready import (readiness now checked before config deployment)
netsim/ansible/device-ready.ansible Splits into two plays: SSH readiness and device-specific conditions with appropriate tags
docs/netlab/initial.md Updates documentation to explain the two-stage readiness checking and configuration option

@ipspace
Copy link
Owner Author

ipspace commented Jan 29, 2026

@ssasso @DanPartelly @sdargoeuves @ddutt -- Anyone wants to try these out? Things are slowly getting in shape (I still have to separate "normalize" phase from the rest of the configs)

This commit refactors the readiness checks to integrate the internal SSH
readiness checks with the Ansible checks (for example, the check for the
first Junos interface):

Data structure changes:

* The devices that require readiness checks MUST have netlab_ready group
  variable, which should include value 'ansible' for devices with
  Ansible checks. This commit modifies device definitions for all
  devices using readiness checks
* The 'ansible' output module creates netlab_ready_ansible and
  netlab_ready_ssh groups

netlab initial changes:

* The 'ready' module got its own run function which is invoked with the
  args.ready option
* The 'ready' module first collect the nodes based on their
  wait-for-ready requirements, executes internal readiness checks, and
  starts the Ansible 'device-ready' playbook if needed
* The internal readiness checks can be disable in topology defaults
  (defaults.netlab.initial.ready._check_ variable)
* deploy.run function calls ready.run function as one of the first steps
* deploy.run and ready.run functions use log.section_header for improved
  logging functionality

Ansible-related changes:

* The 'device-ready.ansible' playbook is split into two plays
  (SSH readiness and Ansible checks)
* The new ansible groups are used in 'device-ready.ansible' playbook to
  limit the hosts involved in each play
* The 'wait-for-ready' task list is no longer included into the
  initial-config.ansible playbook -- the readiness check is performed
  solely in the device-ready.ansible playbook
* The 'wait-for-ready' task list no longer performs the generic
  readiness checks  (ssh was the only generic check). The generic checks
  are performed as plays in the 'device-ready.ansible' playbook
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.

2 participants