.. _vyos.rest.vyos_config_module: ********************* vyos.rest.vyos_config ********************* **Manage VyOS configuration using REST API** Version added: 1.0.0 .. contents:: :local: :depth: 1 Synopsis -------- - Manages VyOS device configuration via the REST API. - Accepts configuration commands in CLI ``set``/``delete`` string format and applies them via the REST ``/configure`` endpoint. - Uses REST API (``connection=httpapi``) instead of CLI. Parameters ---------- .. raw:: html
Parameter Choices/Defaults Comments
lines
list / elements=string
Ordered list of set or delete commands to apply.
Commands should be in standard VyOS CLI format, e.g. set system host-name router1 or delete protocols bgp.
match
string
    Choices:
  • line ←
  • none
Controls how commands are matched against the running configuration.
line checks each command against the running config and only applies commands that would change the configuration.
none applies all commands without checking the running config.
save
boolean
    Choices:
  • no ←
  • yes
Save the configuration to disk after applying changes.
src
path
Path to a file containing set/delete commands, one per line.
Blank lines and lines starting with # are ignored.
Mutually exclusive with lines.

Notes ----- .. note:: - Requires ``ansible_connection=httpapi`` with the VyOS httpapi plugin. - ``ansible_network_os`` must be set to ``vyos.rest.vyos``. - Unlike the CLI collection's ``vyos_config``, this module does not support ``backup``, ``confirm``, or ``comment`` options as these are CLI-specific. - Commands are parsed from CLI string format into REST API path arrays. Examples -------- .. code-block:: yaml - name: Apply configuration lines vyos.rest.vyos_config: lines: - set system host-name router1 - set system domain-name example.com - set interfaces ethernet eth0 description "WAN" save: true - name: Delete configuration vyos.rest.vyos_config: lines: - delete protocols bgp save: true - name: Apply config from file vyos.rest.vyos_config: src: /tmp/vyos_config.txt match: none save: true - name: Always apply without matching vyos.rest.vyos_config: lines: - set system host-name router1 match: none Return Values ------------- Common return values are documented `here `_, the following are the fields unique to this module: .. raw:: html
Key Returned Description
commands
list
always
List of commands applied to the device.

response
dictionary
always
Raw API response from the device.

saved
boolean
when save is true and changes were made
Whether the configuration was saved to disk.



Status ------ Authors ~~~~~~~ - VyOS Community (@vyos)