david_igou.routeros_configuration.to_routeros_config filter – Build a routeros_config dict from api_info results.
Note
This filter plugin is part of the david_igou.routeros_configuration collection (version 0.0.8-alpha).
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install david_igou.routeros_configuration.
To use it in a playbook, specify: david_igou.routeros_configuration.to_routeros_config.
New in david_igou.routeros_configuration 0.0.1-alpha
Synopsis
Turns the registered results of a looped
community.routeros.api_infointo therouteros_configstructure theconfigurerole consumes.Each entry has its
.idremoved. Entries left with no settable fields (and paths left with no entries) are omitted, so all-default singletons and empty paths do not clutter the capture. Optionally redacts sensitive field values.
Input
This describes the input of the filter, the value before | david_igou.routeros_configuration.to_routeros_config.
Parameter |
Comments |
|---|---|
The |
Keyword parameters
This describes keyword parameters of the filter. These are the values key1=value1, key2=value2 and so on in the following
example: input | david_igou.routeros_configuration.to_routeros_config(key1=value1, key2=value2, ...)
Parameter |
Comments |
|---|---|
The Default: |
|
Slash paths whose entry order is significant. These are emitted with |
|
Replace the value of any sensitive field with By default a field is sensitive when its name ends in Choices:
|
|
Field names treated as sensitive when |
|
Mapping of slash path to a list of field names to strip from that path’s entries — either volatile runtime values (e.g. |
Notes
Note
Redaction is opt-in. A redacted capture is for review only — the literal
REDACTEDvalues do not round-trip; prefer encrypting an unredacted capture with Ansible Vault.
See Also
See also
- community.routeros.api_info
The official documentation on the community.routeros.api_info module.
- community.routeros.api_modify
The official documentation on the community.routeros.api_modify module.
Examples
- name: Capture paths
community.routeros.api_info:
path: "{{ item | replace('/', ' ') | trim }}"
hide_defaults: true
include_dynamic: false
include_read_only: false
loop: "{{ routeros_export_vars_paths }}"
register: captured
- name: Assemble routeros_config
ansible.builtin.set_fact:
routeros_config: "{{ captured.results | david_igou.routeros_configuration.to_routeros_config }}"
Return Value
Key |
Description |
|---|---|
A Returned: success |