From 762c276f61dd8fb599d9600df93c1a2992a8cf2e Mon Sep 17 00:00:00 2001 From: omnom62 <75066712+omnom62@users.noreply.github.com> Date: Wed, 16 Sep 2026 22:32:53 +1000 Subject: T6837: vyos_config replace (#493) * T6837: vyos_config replace core --- docs/vyos.vyos.vyos_config_module.rst | 62 ++++++++++++++++++++++++++++++++--- docs/vyos.vyos.vyos_user_module.rst | 4 +++ 2 files changed, 62 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/vyos.vyos.vyos_config_module.rst b/docs/vyos.vyos.vyos_config_module.rst index bf91bb0f..054ae208 100644 --- a/docs/vyos.vyos.vyos_config_module.rst +++ b/docs/vyos.vyos.vyos_config_module.rst @@ -52,6 +52,7 @@ Parameters
allow_password_change argument specifies whether any configuration lines which would change a user's password should be filtered out. By default only plaintext password changes are allowed and any encrypted-password keys are filtered out. In order to allow all password updates, both plaintext and encrypted, set this argument to all.replace is set to config; the candidate is loaded as-is via VyOS's native load, which has no equivalent filtering mechanism.backup is set to true, if backup is set to false this option will be silently ignored.backup is set to yes, if backup is set to no this option will be silently ignored.config argument specifies the base configuration to use to compare against the desired configuration. If this value is not specified, the module will automatically retrieve the current active configuration from the remote device. The configuration lines in the option value should be similar to how it will appear if present in the running-configuration of the device including indentation to ensure idempotency and correct diff.replace is set to config.replace is set to config -- see replace below.match argument controls the method used to match against the current active configuration. By default, the desired config is matched against the active config and the deltas are loaded. If the match argument is set to none the active configuration is ignored and the configuration is always loaded.replace is set to config, since no line-level diff is computed in that mode.line (default), the module computes a set/delete command diff and pushes only the changed lines -- this is the existing behavior, unchanged.config, the module uploads the full candidate configuration (src) to the device and issues VyOS's native load command in configuration mode, which replaces the running configuration wholesale with the candidate's exact contents. VyOS's own configuration engine performs the reconciliation, rather than the module computing per-line deltas. This mirrors the mechanism offered by cisco.iosxr.iosxr_config's replace=config.replace=config requires src and does not accept lines -- there is no way to convert flat set/delete commands into the hierarchical form load requires without re-implementing VyOS's own config-tree builder.src in the default line mode, the module does not validate the candidate's contents or format under replace=config -- supplying a well-formed, complete configuration is the caller's responsibility.replace=config requires the device to accept file transfer (SCP) over the same network_cli SSH session used for configuration commands.replace=config writes the candidate to a fixed path on the device (overwritten on each run, matching cisco.iosxr.iosxr_config's own replace=config precedent). Running replace=config concurrently against the same host is not supported.show configuration) rather than from a trusted, separately maintained source, be aware that VyOS may return masked placeholder values (for example a run of literal asterisks) in place of local users' encrypted-password/plaintext-password values when queried through automation, even though the identical command returns the real value when typed interactively at a terminal. Pushing a masked capture back through replace=config sends the literal placeholder as the new password value; VyOS's own commit-time validation is expected to reject an obviously malformed hash, but a masked value that happens to pass basic format validation could apply silently. Prefer sourcing replace=config candidates from a trusted, version-controlled artifact rather than a live automated capture whenever the configuration contains local password-based users.check_mode, the candidate is written to a temporary file on the device so that VyOS's own compare can produce an accurate preview diff. No commit occurs in check mode.backup=yes, the value of changed reflects whether the backup file's content changed on the Ansible control node, not whether the device configuration changed -- this is existing behavior in the shared netcommon action plugin backing config-family modules across collections, not specific to replace=config.save argument controls whether or not changes made to the active configuration are saved to disk. This is independent of committing the config. When set to true, the active configuration is saved.save argument controls whether or not changes made to the active configuration are saved to disk. This is independent of committing the config. When set to True, the active configuration is saved.src argument specifies the path to the source config file to load. The source config file can either be in bracket format or set format. The source file can include Jinja2 template variables. The configuration lines in the source file should be similar to how it will appear if present in the running-configuration of the device including indentation to ensure idempotency and correct diff.replace is set to config, src is required and must contain a complete configuration in hierarchical/bracket format -- the same format produced by show configuration or found in /config/config.boot. Flat set/delete command format (as produced by show configuration commands) is not accepted in that mode; VyOS's native load command rejects it with a parse error.replace=line mode (default), the list of set/delete commands sent to the device.replace=config mode, contains only the single load <path> command actually issued to the device -- not an itemized diff. See diff for the actual change content, sourced from VyOS's own compare output.replace is set to config.