Enable prettier via pre-commit (#188)
parent
6e25216d7a
commit
4fe771a95c
|
@ -9,11 +9,38 @@ repos:
|
||||||
- id: no-commit-to-branch
|
- id: no-commit-to-branch
|
||||||
args: [--branch, main]
|
args: [--branch, main]
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
|
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||||
|
rev: "v2.6.2"
|
||||||
|
hooks:
|
||||||
|
- id: prettier
|
||||||
|
# Original hook implementation is flaky due to *several* bugs described
|
||||||
|
# in https://github.com/prettier/prettier/issues/12364
|
||||||
|
# a) CI=1 needed to avoid incomplete output
|
||||||
|
# b) two executions are needed because --list-different works correctly
|
||||||
|
# only when run with --check as with --write the output will also
|
||||||
|
# include other entries and logging level cannot be used to keep only
|
||||||
|
# modified files listed (any file is listed using the log level, regardless if
|
||||||
|
# is modified or not).
|
||||||
|
# c) We avoid letting pre-commit pass each filename in order to avoid
|
||||||
|
# running multiple instances in parallel. This also ensures that running
|
||||||
|
# prettier from the command line behaves identically with the pre-commit
|
||||||
|
# one. No real performance downsides.
|
||||||
|
# d) exit with the return code from list-different (0=none, 1=some)
|
||||||
|
# rather than the write (0=successfully rewrote files). pre-commit.ci
|
||||||
|
entry: env CI=1 bash -c "prettier --list-different . || ec=$? && prettier --loglevel=error --write . && exit $ec"
|
||||||
|
pass_filenames: false
|
||||||
|
args: []
|
||||||
|
additional_dependencies:
|
||||||
|
- prettier
|
||||||
|
- prettier-plugin-toml
|
||||||
|
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 22.3.0
|
rev: 22.3.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
args: [-l, "79"]
|
args: [-l, "79"]
|
||||||
|
|
||||||
- repo: https://github.com/ansible-network/collection_prep
|
- repo: https://github.com/ansible-network/collection_prep
|
||||||
rev: 1.0.0
|
rev: 1.0.0
|
||||||
hooks:
|
hooks:
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Stuff we don't want priettier to ever to look into
|
||||||
|
.*/
|
||||||
|
coverage/
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
.env
|
||||||
|
.venv
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env.bak/
|
||||||
|
venv.bak/
|
||||||
|
|
||||||
|
# A linked collection directory created by pytest-ansible-units
|
||||||
|
collections/
|
||||||
|
|
||||||
|
README.md
|
|
@ -19,16 +19,16 @@ releases:
|
||||||
modules:
|
modules:
|
||||||
- description: Parse cli output or text using a variety of parsers
|
- description: Parse cli output or text using a variety of parsers
|
||||||
name: cli_parse
|
name: cli_parse
|
||||||
namespace: ''
|
namespace: ""
|
||||||
- description: Find the difference between currently set facts
|
- description: Find the difference between currently set facts
|
||||||
name: fact_diff
|
name: fact_diff
|
||||||
namespace: ''
|
namespace: ""
|
||||||
- description: Update currently set facts
|
- description: Update currently set facts
|
||||||
name: update_fact
|
name: update_fact
|
||||||
namespace: ''
|
namespace: ""
|
||||||
- description: Validate data with provided criteria
|
- description: Validate data with provided criteria
|
||||||
name: validate
|
name: validate
|
||||||
namespace: ''
|
namespace: ""
|
||||||
plugins:
|
plugins:
|
||||||
lookup:
|
lookup:
|
||||||
- description: Retrieve the value in a variable using a path
|
- description: Retrieve the value in a variable using a path
|
||||||
|
@ -43,14 +43,14 @@ releases:
|
||||||
- description: Validate data with provided criteria
|
- description: Validate data with provided criteria
|
||||||
name: validate
|
name: validate
|
||||||
namespace: null
|
namespace: null
|
||||||
release_date: '2020-12-08'
|
release_date: "2020-12-08"
|
||||||
1.0.1:
|
1.0.1:
|
||||||
changes:
|
changes:
|
||||||
minor_changes:
|
minor_changes:
|
||||||
- Move CHANGELOG.rst file under changelogs folder as required
|
- Move CHANGELOG.rst file under changelogs folder as required
|
||||||
fragments:
|
fragments:
|
||||||
- fix_changelog_file_location.yaml
|
- fix_changelog_file_location.yaml
|
||||||
release_date: '2020-12-08'
|
release_date: "2020-12-08"
|
||||||
2.0.0:
|
2.0.0:
|
||||||
changes:
|
changes:
|
||||||
breaking_changes:
|
breaking_changes:
|
||||||
|
@ -66,7 +66,7 @@ releases:
|
||||||
- 32_doc_updates.yaml
|
- 32_doc_updates.yaml
|
||||||
- sub_plugins_dir_change.yaml
|
- sub_plugins_dir_change.yaml
|
||||||
- upcap_ansible.yaml
|
- upcap_ansible.yaml
|
||||||
release_date: '2021-01-29'
|
release_date: "2021-01-29"
|
||||||
2.0.1:
|
2.0.1:
|
||||||
changes:
|
changes:
|
||||||
bugfixes:
|
bugfixes:
|
||||||
|
@ -75,7 +75,7 @@ releases:
|
||||||
fragments:
|
fragments:
|
||||||
- ansible-doc.yaml
|
- ansible-doc.yaml
|
||||||
- cli_parse_fix.yaml
|
- cli_parse_fix.yaml
|
||||||
release_date: '2021-02-25'
|
release_date: "2021-02-25"
|
||||||
2.0.2:
|
2.0.2:
|
||||||
changes:
|
changes:
|
||||||
bugfixes:
|
bugfixes:
|
||||||
|
@ -84,7 +84,7 @@ releases:
|
||||||
fragments:
|
fragments:
|
||||||
- cli_parse_errors_return.yaml
|
- cli_parse_errors_return.yaml
|
||||||
- jsonschema_data_validation_fix.yaml
|
- jsonschema_data_validation_fix.yaml
|
||||||
release_date: '2021-03-29'
|
release_date: "2021-03-29"
|
||||||
2.1.0:
|
2.1.0:
|
||||||
changes:
|
changes:
|
||||||
bugfixes:
|
bugfixes:
|
||||||
|
@ -96,7 +96,7 @@ releases:
|
||||||
- add-xmltojson-and-jsontoxml-filter.yaml
|
- add-xmltojson-and-jsontoxml-filter.yaml
|
||||||
- add_missing_test_requirements.yml
|
- add_missing_test_requirements.yml
|
||||||
- fix_tests.yaml
|
- fix_tests.yaml
|
||||||
release_date: '2021-04-27'
|
release_date: "2021-04-27"
|
||||||
2.2.0:
|
2.2.0:
|
||||||
changes:
|
changes:
|
||||||
minor_changes:
|
minor_changes:
|
||||||
|
@ -118,7 +118,7 @@ releases:
|
||||||
- add_netaddr_test_plugins_6.yml
|
- add_netaddr_test_plugins_6.yml
|
||||||
- add_netaddr_test_plugins_7.yml
|
- add_netaddr_test_plugins_7.yml
|
||||||
- add_netaddr_test_plugins_8.yml
|
- add_netaddr_test_plugins_8.yml
|
||||||
release_date: '2021-05-17'
|
release_date: "2021-05-17"
|
||||||
2.3.0:
|
2.3.0:
|
||||||
changes:
|
changes:
|
||||||
bugfixes:
|
bugfixes:
|
||||||
|
@ -132,7 +132,7 @@ releases:
|
||||||
- empty_list_mapping.yml
|
- empty_list_mapping.yml
|
||||||
- improve_coverage_for_filter_plugins.yaml
|
- improve_coverage_for_filter_plugins.yaml
|
||||||
- update_doc_for_usable_range_filter_plugin.yml
|
- update_doc_for_usable_range_filter_plugin.yml
|
||||||
release_date: '2021-06-22'
|
release_date: "2021-06-22"
|
||||||
2.3.1:
|
2.3.1:
|
||||||
changes:
|
changes:
|
||||||
bugfixes:
|
bugfixes:
|
||||||
|
@ -140,7 +140,7 @@ releases:
|
||||||
- Improve test coverage
|
- Improve test coverage
|
||||||
fragments:
|
fragments:
|
||||||
- 81_add_support_for_format.yaml
|
- 81_add_support_for_format.yaml
|
||||||
release_date: '2021-07-26'
|
release_date: "2021-07-26"
|
||||||
2.4.0:
|
2.4.0:
|
||||||
changes:
|
changes:
|
||||||
bugfixes:
|
bugfixes:
|
||||||
|
@ -152,14 +152,14 @@ releases:
|
||||||
- 85_update_validate_plugin.yaml
|
- 85_update_validate_plugin.yaml
|
||||||
- 88_compare_resource_list_filter_plugin.yaml
|
- 88_compare_resource_list_filter_plugin.yaml
|
||||||
- param_list_compare_docs_added.yaml
|
- param_list_compare_docs_added.yaml
|
||||||
release_date: '2021-08-28'
|
release_date: "2021-08-28"
|
||||||
2.4.1:
|
2.4.1:
|
||||||
changes:
|
changes:
|
||||||
release_summary: Rereleased 2.4.0 with trivial changes.
|
release_summary: Rereleased 2.4.0 with trivial changes.
|
||||||
fragments:
|
fragments:
|
||||||
- 2.4.1.yaml
|
- 2.4.1.yaml
|
||||||
- fix_network_ee.yaml
|
- fix_network_ee.yaml
|
||||||
release_date: '2021-09-24'
|
release_date: "2021-09-24"
|
||||||
2.4.2:
|
2.4.2:
|
||||||
changes:
|
changes:
|
||||||
release_summary: Rereleased 2.4.1 with valid requirement.txt.
|
release_summary: Rereleased 2.4.1 with valid requirement.txt.
|
||||||
|
@ -167,22 +167,22 @@ releases:
|
||||||
- 2.4.2.yaml
|
- 2.4.2.yaml
|
||||||
- add_ignore_2.13.yaml
|
- add_ignore_2.13.yaml
|
||||||
- bugfix_100.yaml
|
- bugfix_100.yaml
|
||||||
release_date: '2021-10-07'
|
release_date: "2021-10-07"
|
||||||
2.4.3:
|
2.4.3:
|
||||||
changes:
|
changes:
|
||||||
release_summary: Rereleased 2.4.2 with fix of network ee tests.
|
release_summary: Rereleased 2.4.2 with fix of network ee tests.
|
||||||
fragments:
|
fragments:
|
||||||
- 2.4.3.yaml
|
- 2.4.3.yaml
|
||||||
- fix_network_ee.yaml
|
- fix_network_ee.yaml
|
||||||
release_date: '2021-12-07'
|
release_date: "2021-12-07"
|
||||||
2.5.0:
|
2.5.0:
|
||||||
changes:
|
changes:
|
||||||
doc_changes:
|
doc_changes:
|
||||||
- Enhancement in documentation and docstring.
|
- Enhancement in documentation and docstring.
|
||||||
minor_changes:
|
minor_changes:
|
||||||
- '''keep_keys'' filter plugin added.'
|
- "'keep_keys' filter plugin added."
|
||||||
- '''remove_keys'' filter plugin added.'
|
- "'remove_keys' filter plugin added."
|
||||||
- '''replace_keys'' filter plugin added.'
|
- "'replace_keys' filter plugin added."
|
||||||
- Add cli_merge ipaddr filter plugin.
|
- Add cli_merge ipaddr filter plugin.
|
||||||
- Add ip4_hex filter plugin.
|
- Add ip4_hex filter plugin.
|
||||||
- Add ipaddr filter plugin.
|
- Add ipaddr filter plugin.
|
||||||
|
@ -219,16 +219,16 @@ releases:
|
||||||
- add_slaac_mac_hwaddr_filter.yaml
|
- add_slaac_mac_hwaddr_filter.yaml
|
||||||
- docfix_minor_corrections.yaml
|
- docfix_minor_corrections.yaml
|
||||||
- recursive_filter_plugins.yaml
|
- recursive_filter_plugins.yaml
|
||||||
release_date: '2022-01-31'
|
release_date: "2022-01-31"
|
||||||
2.5.1:
|
2.5.1:
|
||||||
changes:
|
changes:
|
||||||
doc_changes:
|
doc_changes:
|
||||||
- '`in_any_network` - plugin doc fix for redundant line.'
|
- "`in_any_network` - plugin doc fix for redundant line."
|
||||||
fragments:
|
fragments:
|
||||||
- Improve_test_covrage.yaml
|
- Improve_test_covrage.yaml
|
||||||
- minor_doc_update.yaml
|
- minor_doc_update.yaml
|
||||||
- unit_test_container_venv.yaml
|
- unit_test_container_venv.yaml
|
||||||
release_date: '2022-03-01'
|
release_date: "2022-03-01"
|
||||||
2.5.2:
|
2.5.2:
|
||||||
changes:
|
changes:
|
||||||
bugfixes:
|
bugfixes:
|
||||||
|
@ -237,18 +237,18 @@ releases:
|
||||||
- ipaddr - Fix issue of breaking ipaddr filter with netcommon 2.6.0(https://github.com/ansible-collections/ansible.netcommon/issues/375).
|
- ipaddr - Fix issue of breaking ipaddr filter with netcommon 2.6.0(https://github.com/ansible-collections/ansible.netcommon/issues/375).
|
||||||
fragments:
|
fragments:
|
||||||
- bugfix_ipaddr_filter.yaml
|
- bugfix_ipaddr_filter.yaml
|
||||||
release_date: '2022-03-04'
|
release_date: "2022-03-04"
|
||||||
2.6.0:
|
2.6.0:
|
||||||
changes:
|
changes:
|
||||||
minor_changes:
|
minor_changes:
|
||||||
- '''consolidate'' filter plugin added.'
|
- "'consolidate' filter plugin added."
|
||||||
fragments:
|
fragments:
|
||||||
- 0-ignore.yml
|
- 0-ignore.yml
|
||||||
- consolidate_filter_plugin.yml
|
- consolidate_filter_plugin.yml
|
||||||
- enable_upgrade_black.yml
|
- enable_upgrade_black.yml
|
||||||
- pre-commit-enable.yml
|
- pre-commit-enable.yml
|
||||||
- pre-commit-skip.yml
|
- pre-commit-skip.yml
|
||||||
release_date: '2022-04-12'
|
release_date: "2022-04-12"
|
||||||
2.6.1:
|
2.6.1:
|
||||||
changes:
|
changes:
|
||||||
release_summary: Rereleased 2.6.0 with fixes for internal testing.
|
release_summary: Rereleased 2.6.0 with fixes for internal testing.
|
||||||
|
@ -258,4 +258,4 @@ releases:
|
||||||
- pylint-black-flake.yml
|
- pylint-black-flake.yml
|
||||||
- sanity_fix.yaml
|
- sanity_fix.yaml
|
||||||
- test inits.yml
|
- test inits.yml
|
||||||
release_date: '2022-04-25'
|
release_date: "2022-04-25"
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
trivial:
|
||||||
|
- Enable prettier via pre-commit
|
|
@ -1,2 +1,2 @@
|
||||||
---
|
---
|
||||||
requires_ansible: '>=2.9.10'
|
requires_ansible: ">=2.9.10"
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
vars:
|
vars:
|
||||||
msg: "one of the following is required: command, text"
|
msg: "one of the following is required: command, text"
|
||||||
|
|
||||||
|
|
||||||
- name: "{{ parser }} validate argspec"
|
- name: "{{ parser }} validate argspec"
|
||||||
ansible.utils.cli_parse:
|
ansible.utils.cli_parse:
|
||||||
text: ""
|
text: ""
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
- "{{ nxos_ttp_text['parsed'][0][0] | selectattr('interface', 'search', 'mgmt0') | list | length }}"
|
- "{{ nxos_ttp_text['parsed'][0][0] | selectattr('interface', 'search', 'mgmt0') | list | length }}"
|
||||||
- "{{ nxos_ttp_text['parsed'] == nxos_ttp_text_parsed }}"
|
- "{{ nxos_ttp_text['parsed'] == nxos_ttp_text_parsed }}"
|
||||||
|
|
||||||
|
|
||||||
- name: "{{ parser }} Pass text and custom variable"
|
- name: "{{ parser }} Pass text and custom variable"
|
||||||
ansible.utils.cli_parse:
|
ansible.utils.cli_parse:
|
||||||
text: "{{ lookup('ansible.builtin.file', '{{ role_path }}/files/nxos_show_interface.txt') }}"
|
text: "{{ lookup('ansible.builtin.file', '{{ role_path }}/files/nxos_show_interface.txt') }}"
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
recurse: false
|
recurse: false
|
||||||
use_regex: true
|
use_regex: true
|
||||||
patterns:
|
patterns:
|
||||||
- '^(?!_|main).+$'
|
- "^(?!_|main).+$"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
register: found
|
register: found
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,7 @@
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
data_sources:
|
data_sources:
|
||||||
- data:
|
- data:
|
||||||
[
|
[{ "name": "GigabitEthernet0/1" }, { "name": "GigabitEthernet0/2" }]
|
||||||
{ "name": "GigabitEthernet0/1" },
|
|
||||||
{ "name": "GigabitEthernet0/2" },
|
|
||||||
]
|
|
||||||
match_key: name
|
match_key: name
|
||||||
name: acl_interfaces
|
name: acl_interfaces
|
||||||
- data:
|
- data:
|
||||||
|
|
|
@ -59,7 +59,6 @@
|
||||||
ansible.utils.fact_diff:
|
ansible.utils.fact_diff:
|
||||||
before: "{{ before|to_nice_yaml }}"
|
before: "{{ before|to_nice_yaml }}"
|
||||||
after: "{{ after|to_nice_yaml }}"
|
after: "{{ after|to_nice_yaml }}"
|
||||||
|
|
||||||
# TASK [ansible.utils.fact_diff] **************************************
|
# TASK [ansible.utils.fact_diff] **************************************
|
||||||
# --- before
|
# --- before
|
||||||
# +++ after
|
# +++ after
|
||||||
|
@ -74,7 +73,6 @@
|
||||||
|
|
||||||
# changed: [localhost]
|
# changed: [localhost]
|
||||||
|
|
||||||
|
|
||||||
#### Show the difference between complex object using restconf
|
#### Show the difference between complex object using restconf
|
||||||
# ansible_connection: ansible.netcommon.httpapi
|
# ansible_connection: ansible.netcommon.httpapi
|
||||||
# ansible_httpapi_use_ssl: True
|
# ansible_httpapi_use_ssl: True
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
recurse: false
|
recurse: false
|
||||||
use_regex: true
|
use_regex: true
|
||||||
patterns:
|
patterns:
|
||||||
- '^(?!_|main).+$'
|
- "^(?!_|main).+$"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
register: found
|
register: found
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
plugin:
|
plugin:
|
||||||
vars:
|
vars:
|
||||||
skip_lines:
|
skip_lines:
|
||||||
- '+'
|
- "+"
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
recurse: false
|
recurse: false
|
||||||
use_regex: true
|
use_regex: true
|
||||||
patterns:
|
patterns:
|
||||||
- '^(?!_|main).+$'
|
- "^(?!_|main).+$"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
register: found
|
register: found
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
---
|
---
|
||||||
- name: Setup xml and expected json
|
- name: Setup xml and expected json
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
data: "
|
data: '
|
||||||
<netconf-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\"><schemas><schema/></schemas></netconf-state>
|
<netconf-state xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"><schemas><schema/></schemas></netconf-state>
|
||||||
"
|
'
|
||||||
output: {
|
output:
|
||||||
"netconf-state": {
|
{
|
||||||
|
"netconf-state":
|
||||||
|
{
|
||||||
"@xmlns": "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring",
|
"@xmlns": "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring",
|
||||||
"schemas": {
|
"schemas": { "schema": null },
|
||||||
"schema": null
|
},
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- debug:
|
- debug:
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
- name: Setup invalid xml as input to ansible.utils.from_xml.
|
- name: Setup invalid xml as input to ansible.utils.from_xml.
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
data: "<netconf-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\">"
|
data: '<netconf-state xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">'
|
||||||
|
|
||||||
- name: validate input xml
|
- name: validate input xml
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
# ansible_facts:
|
# ansible_facts:
|
||||||
# value: '0'
|
# value: '0'
|
||||||
|
|
||||||
|
|
||||||
#### Working with hostvars
|
#### Working with hostvars
|
||||||
|
|
||||||
- name: Retrieve a value deep inside all of the host's vars
|
- name: Retrieve a value deep inside all of the host's vars
|
||||||
|
@ -37,7 +36,6 @@
|
||||||
# as_filter: '0'
|
# as_filter: '0'
|
||||||
# as_lookup: '0'
|
# as_lookup: '0'
|
||||||
|
|
||||||
|
|
||||||
#### Used alongside ansible.utils.to_paths
|
#### Used alongside ansible.utils.to_paths
|
||||||
|
|
||||||
- name: Get the paths for the object
|
- name: Get the paths for the object
|
||||||
|
@ -53,7 +51,6 @@
|
||||||
vars:
|
vars:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
value: "{{ vars|ansible.utils.get_path(item) }}"
|
value: "{{ vars|ansible.utils.get_path(item) }}"
|
||||||
|
|
||||||
# TASK [Get the paths for the object] *******************************
|
# TASK [Get the paths for the object] *******************************
|
||||||
# ok: [nxos101] => changed=false
|
# ok: [nxos101] => changed=false
|
||||||
# ansible_facts:
|
# ansible_facts:
|
||||||
|
@ -73,7 +70,6 @@
|
||||||
# ok: [nxos101] => (item=a.b.c.e[1]) =>
|
# ok: [nxos101] => (item=a.b.c.e[1]) =>
|
||||||
# msg: The value of path a.b.c.e[1] in vars is False
|
# msg: The value of path a.b.c.e[1] in vars is False
|
||||||
|
|
||||||
|
|
||||||
#### Working with complex structures and transforming results
|
#### Working with complex structures and transforming results
|
||||||
|
|
||||||
# - name: Retrieve the current interface config
|
# - name: Retrieve the current interface config
|
||||||
|
@ -92,7 +88,6 @@
|
||||||
# - by_name['Ethernet1/2'].description|upper
|
# - by_name['Ethernet1/2'].description|upper
|
||||||
# - by_name['Ethernet1/3'].description|default('')
|
# - by_name['Ethernet1/3'].description|default('')
|
||||||
|
|
||||||
|
|
||||||
# TASK [Get the description of several interfaces] ******************
|
# TASK [Get the description of several interfaces] ******************
|
||||||
# ok: [nxos101] => (item=by_name['Ethernet1/1'].description) => changed=false
|
# ok: [nxos101] => (item=by_name['Ethernet1/1'].description) => changed=false
|
||||||
# msg: Configured by ansible
|
# msg: Configured by ansible
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
# ansible_facts:
|
# ansible_facts:
|
||||||
# value: '0'
|
# value: '0'
|
||||||
|
|
||||||
|
|
||||||
#### Working with hostvars
|
#### Working with hostvars
|
||||||
|
|
||||||
- name: Retrieve a value deep inside all of the host's vars
|
- name: Retrieve a value deep inside all of the host's vars
|
||||||
|
@ -37,7 +36,6 @@
|
||||||
# as_filter: '0'
|
# as_filter: '0'
|
||||||
# as_lookup: '0'
|
# as_lookup: '0'
|
||||||
|
|
||||||
|
|
||||||
#### Used alongside ansible.utils.to_paths
|
#### Used alongside ansible.utils.to_paths
|
||||||
|
|
||||||
- name: Get the paths for the object
|
- name: Get the paths for the object
|
||||||
|
@ -53,7 +51,6 @@
|
||||||
vars:
|
vars:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
value: "{{ lookup('ansible.utils.get_path', hostvars[inventory_hostname], item) }}"
|
value: "{{ lookup('ansible.utils.get_path', hostvars[inventory_hostname], item) }}"
|
||||||
|
|
||||||
# TASK [Get the paths for the object] *******************************
|
# TASK [Get the paths for the object] *******************************
|
||||||
# ok: [nxos101] => changed=false
|
# ok: [nxos101] => changed=false
|
||||||
# ansible_facts:
|
# ansible_facts:
|
||||||
|
@ -73,7 +70,6 @@
|
||||||
# ok: [nxos101] => (item=a.b.c.e[1]) =>
|
# ok: [nxos101] => (item=a.b.c.e[1]) =>
|
||||||
# msg: The value of path a.b.c.e[1] in vars is False
|
# msg: The value of path a.b.c.e[1] in vars is False
|
||||||
|
|
||||||
|
|
||||||
#### Working with complex structures and transforming results
|
#### Working with complex structures and transforming results
|
||||||
|
|
||||||
# - name: Retrieve the current interface config
|
# - name: Retrieve the current interface config
|
||||||
|
@ -92,7 +88,6 @@
|
||||||
# - by_name['Ethernet1/2'].description|upper
|
# - by_name['Ethernet1/2'].description|upper
|
||||||
# - by_name['Ethernet1/3'].description|default('')
|
# - by_name['Ethernet1/3'].description|default('')
|
||||||
|
|
||||||
|
|
||||||
# TASK [Get the description of several interfaces] ******************
|
# TASK [Get the description of several interfaces] ******************
|
||||||
# ok: [nxos101] => (item=by_name['Ethernet1/1'].description) => changed=false
|
# ok: [nxos101] => (item=by_name['Ethernet1/1'].description) => changed=false
|
||||||
# msg: Configured by ansible
|
# msg: Configured by ansible
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
recurse: false
|
recurse: false
|
||||||
use_regex: true
|
use_regex: true
|
||||||
patterns:
|
patterns:
|
||||||
- '^(?!_|main).+$'
|
- "^(?!_|main).+$"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
register: found
|
register: found
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
expected: "{{ a.b.c.d[0] }}"
|
expected: "{{ a.b.c.d[0] }}"
|
||||||
- result: "{{ a|ansible.utils.get_path('b.c.d[1]') }}"
|
- result: "{{ a|ansible.utils.get_path('b.c.d[1]') }}"
|
||||||
expected: "{{ a.b.c.d[1] }}"
|
expected: "{{ a.b.c.d[1] }}"
|
||||||
- result: "{{ a|ansible.utils.get_path('b[\"c\"]') }}"
|
- result: '{{ a|ansible.utils.get_path(''b["c"]'') }}'
|
||||||
expected: "{{ a.b.c }}"
|
expected: "{{ a.b.c }}"
|
||||||
- result: "{{ lookup('ansible.utils.get_path', vars, 'a') }}"
|
- result: "{{ lookup('ansible.utils.get_path', vars, 'a') }}"
|
||||||
expected: "{{ a }}"
|
expected: "{{ a }}"
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
expected: "{{ a.b.c.d[0] }}"
|
expected: "{{ a.b.c.d[0] }}"
|
||||||
- result: "{{ lookup('ansible.utils.get_path', a, 'b.c.d[1]') }}"
|
- result: "{{ lookup('ansible.utils.get_path', a, 'b.c.d[1]') }}"
|
||||||
expected: "{{ a.b.c.d[1] }}"
|
expected: "{{ a.b.c.d[1] }}"
|
||||||
- result: "{{ lookup('ansible.utils.get_path', a, 'b[\"c\"]') }}"
|
- result: '{{ lookup(''ansible.utils.get_path'', a, ''b["c"]'') }}'
|
||||||
expected: "{{ a.b.c }}"
|
expected: "{{ a.b.c }}"
|
||||||
|
|
||||||
- ansible.builtin.set_fact:
|
- ansible.builtin.set_fact:
|
||||||
|
|
|
@ -51,7 +51,6 @@
|
||||||
# ok: [sw01] => (item=2) =>
|
# ok: [sw01] => (item=2) =>
|
||||||
# msg: 3 is > than 1
|
# msg: 3 is > than 1
|
||||||
|
|
||||||
|
|
||||||
#### Working with lists of dictionaries
|
#### Working with lists of dictionaries
|
||||||
|
|
||||||
- ansible.builtin.set_fact:
|
- ansible.builtin.set_fact:
|
||||||
|
@ -102,7 +101,6 @@
|
||||||
# ok: [nxos101] => (item=3) =>
|
# ok: [nxos101] => (item=3) =>
|
||||||
# msg: The device named fw02.example.corp is a firewall
|
# msg: The device named fw02.example.corp is a firewall
|
||||||
|
|
||||||
|
|
||||||
#### Working with complex structures from resource modules
|
#### Working with complex structures from resource modules
|
||||||
|
|
||||||
# - name: Retrieve the current L3 interface configuration
|
# - name: Retrieve the current L3 interface configuration
|
||||||
|
@ -153,7 +151,6 @@
|
||||||
# ok: [nxos101] => (item=[{'interface_idx': '128', 'address_idxs': [0]}, 0]) =>
|
# ok: [nxos101] => (item=[{'interface_idx': '128', 'address_idxs': [0]}, 0]) =>
|
||||||
# msg: mgmt0 has ip 192.168.101.14/24
|
# msg: mgmt0 has ip 192.168.101.14/24
|
||||||
|
|
||||||
|
|
||||||
#### Working with deeply nested data
|
#### Working with deeply nested data
|
||||||
|
|
||||||
- ansible.builtin.set_fact:
|
- ansible.builtin.set_fact:
|
||||||
|
@ -201,7 +198,6 @@
|
||||||
index: 3
|
index: 3
|
||||||
index: 3
|
index: 3
|
||||||
|
|
||||||
|
|
||||||
- name: Find the description of loopback111, subinterface index 10
|
- name: Find the description of loopback111, subinterface index 10
|
||||||
debug:
|
debug:
|
||||||
msg: |-
|
msg: |-
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
vars:
|
vars:
|
||||||
params:
|
params:
|
||||||
data: "{{ data }}"
|
data: "{{ data }}"
|
||||||
test: '>'
|
test: ">"
|
||||||
value: 1
|
value: 1
|
||||||
|
|
||||||
# TASK [Find numbers greater than 1, using with] *****************************
|
# TASK [Find numbers greater than 1, using with] *****************************
|
||||||
|
@ -67,7 +67,6 @@
|
||||||
# ok: [nxos101] => (item=2) =>
|
# ok: [nxos101] => (item=2) =>
|
||||||
# msg: 3 is > than 1
|
# msg: 3 is > than 1
|
||||||
|
|
||||||
|
|
||||||
#### Working with lists of dictionaries
|
#### Working with lists of dictionaries
|
||||||
|
|
||||||
- ansible.builtin.set_fact:
|
- ansible.builtin.set_fact:
|
||||||
|
@ -118,7 +117,6 @@
|
||||||
# ok: [nxos101] => (item=3) =>
|
# ok: [nxos101] => (item=3) =>
|
||||||
# msg: The device named fw02.example.corp is a firewall
|
# msg: The device named fw02.example.corp is a firewall
|
||||||
|
|
||||||
|
|
||||||
#### Working with complex structures from resource modules
|
#### Working with complex structures from resource modules
|
||||||
|
|
||||||
# - name: Retrieve the current L3 interface configuration
|
# - name: Retrieve the current L3 interface configuration
|
||||||
|
@ -169,7 +167,6 @@
|
||||||
# ok: [nxos101] => (item=[{'interface_idx': '128', 'address_idxs': [0]}, 0]) =>
|
# ok: [nxos101] => (item=[{'interface_idx': '128', 'address_idxs': [0]}, 0]) =>
|
||||||
# msg: mgmt0 has ip 192.168.101.14/24
|
# msg: mgmt0 has ip 192.168.101.14/24
|
||||||
|
|
||||||
|
|
||||||
#### Working with deeply nested data
|
#### Working with deeply nested data
|
||||||
|
|
||||||
- ansible.builtin.set_fact:
|
- ansible.builtin.set_fact:
|
||||||
|
@ -217,7 +214,6 @@
|
||||||
index: 3
|
index: 3
|
||||||
index: 3
|
index: 3
|
||||||
|
|
||||||
|
|
||||||
- name: Find the description of loopback111, subinterface index 10
|
- name: Find the description of loopback111, subinterface index 10
|
||||||
debug:
|
debug:
|
||||||
msg: |-
|
msg: |-
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
recurse: false
|
recurse: false
|
||||||
use_regex: true
|
use_regex: true
|
||||||
patterns:
|
patterns:
|
||||||
- '^(?!_|main).+$'
|
- "^(?!_|main).+$"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
register: found
|
register: found
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,6 @@
|
||||||
- test: "{{ lookup('ansible.utils.index_of', complex.d, 'match', '.*d$') }}"
|
- test: "{{ lookup('ansible.utils.index_of', complex.d, 'match', '.*d$') }}"
|
||||||
result: [0, 1]
|
result: [0, 1]
|
||||||
|
|
||||||
|
|
||||||
- ansible.builtin.set_fact:
|
- ansible.builtin.set_fact:
|
||||||
complex:
|
complex:
|
||||||
a:
|
a:
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
assert:
|
assert:
|
||||||
that: "{{ result1 == '1a:2b:3c:4d:5e:6f' }}"
|
that: "{{ result1 == '1a:2b:3c:4d:5e:6f' }}"
|
||||||
|
|
||||||
|
|
||||||
- name: hwaddr filter test2
|
- name: hwaddr filter test2
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
result1: "{{ '1a:2b:3c:4d:5e:6f'|ansible.utils.hwaddr('cisco') }}"
|
result1: "{{ '1a:2b:3c:4d:5e:6f'|ansible.utils.hwaddr('cisco') }}"
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
assert:
|
assert:
|
||||||
that: "{{ result2 == ipaddr_result2 }}"
|
that: "{{ result2 == ipaddr_result2 }}"
|
||||||
|
|
||||||
|
|
||||||
- name: ipaddr filter with public network query
|
- name: ipaddr filter with public network query
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
result3: "{{ value|ansible.utils.ipaddr('public') }}"
|
result3: "{{ value|ansible.utils.ipaddr('public') }}"
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
assert:
|
assert:
|
||||||
that: "{{ result1 == '192.168.1.1' }}"
|
that: "{{ result1 == '192.168.1.1' }}"
|
||||||
|
|
||||||
|
|
||||||
- name: Get the next tenth address in IPv6 with Ipmath filter
|
- name: Get the next tenth address in IPv6 with Ipmath filter
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
result1: "{{ '2001::1'|ansible.utils.ipmath('10') }}"
|
result1: "{{ '2001::1'|ansible.utils.ipmath('10') }}"
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
value:
|
value:
|
||||||
- 192.24.2.1
|
- 192.24.2.1
|
||||||
- ::ffff:192.168.32.0/120
|
- ::ffff:192.168.32.0/120
|
||||||
- ''
|
- ""
|
||||||
- ::ffff:192.24.2.1/128
|
- ::ffff:192.24.2.1/128
|
||||||
- 192.168.32.0/24
|
- 192.168.32.0/24
|
||||||
- fe80::100/10
|
- fe80::100/10
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
assert:
|
assert:
|
||||||
that: "{{ result1 == '1a:2b:3c:4d:5e:6f' }}"
|
that: "{{ result1 == '1a:2b:3c:4d:5e:6f' }}"
|
||||||
|
|
||||||
|
|
||||||
- name: macaddr filter test2
|
- name: macaddr filter test2
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
result1: "{{ '1a:2b:3c:4d:5e:6f'|ansible.utils.macaddr('cisco') }}"
|
result1: "{{ '1a:2b:3c:4d:5e:6f'|ansible.utils.macaddr('cisco') }}"
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
recurse: false
|
recurse: false
|
||||||
use_regex: true
|
use_regex: true
|
||||||
patterns:
|
patterns:
|
||||||
- '^(?!_|main).+$'
|
- "^(?!_|main).+$"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
register: found
|
register: found
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
assert:
|
assert:
|
||||||
that: "{{ result1 == False }}"
|
that: "{{ result1 == False }}"
|
||||||
|
|
||||||
|
|
||||||
- name: network_in_network filter test3
|
- name: network_in_network filter test3
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
result1: "{{ '192.168.0.0/16'|ansible.utils.network_in_network('192.168.0.0/24') }}"
|
result1: "{{ '192.168.0.0/16'|ansible.utils.network_in_network('192.168.0.0/24') }}"
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
assert:
|
assert:
|
||||||
that: "{{ result1 == False }}"
|
that: "{{ result1 == False }}"
|
||||||
|
|
||||||
|
|
||||||
- name: network_in_usable filter test3
|
- name: network_in_usable filter test3
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
result1: "{{ '192.168.0.0/16'|ansible.utils.network_in_usable('192.168.0.255') }}"
|
result1: "{{ '192.168.0.0/16'|ansible.utils.network_in_usable('192.168.0.255') }}"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
address: '192.168.144.5'
|
address: "192.168.144.5"
|
||||||
subnet: '192.168.0.0/16'
|
subnet: "192.168.0.0/16"
|
||||||
result1_val:
|
result1_val:
|
||||||
- "192.24.2.1"
|
- "192.24.2.1"
|
||||||
- "192.168.32.0/24"
|
- "192.168.32.0/24"
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
recurse: false
|
recurse: false
|
||||||
use_regex: true
|
use_regex: true
|
||||||
patterns:
|
patterns:
|
||||||
- '^(?!_|main).+$'
|
- "^(?!_|main).+$"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
register: found
|
register: found
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
recurse: false
|
recurse: false
|
||||||
use_regex: true
|
use_regex: true
|
||||||
patterns:
|
patterns:
|
||||||
- '^(?!_|main).+$'
|
- "^(?!_|main).+$"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
register: found
|
register: found
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
recurse: false
|
recurse: false
|
||||||
use_regex: true
|
use_regex: true
|
||||||
patterns:
|
patterns:
|
||||||
- '^(?!_|main).+$'
|
- "^(?!_|main).+$"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
register: found
|
register: found
|
||||||
|
|
||||||
|
|
|
@ -6,42 +6,42 @@
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
network_resources:
|
network_resources:
|
||||||
modules:
|
modules:
|
||||||
- 'acl_interfaces'
|
- "acl_interfaces"
|
||||||
- 'acls'
|
- "acls"
|
||||||
- 'bgp_address_family'
|
- "bgp_address_family"
|
||||||
- 'bgp_global'
|
- "bgp_global"
|
||||||
- 'interfaces'
|
- "interfaces"
|
||||||
- 'l2_interfaces'
|
- "l2_interfaces"
|
||||||
- 'l3_interfaces'
|
- "l3_interfaces"
|
||||||
- 'lacp'
|
- "lacp"
|
||||||
- 'lacp_interfaces'
|
- "lacp_interfaces"
|
||||||
- 'lag_interfaces'
|
- "lag_interfaces"
|
||||||
- 'lldp_global'
|
- "lldp_global"
|
||||||
- 'lldp_interfaces'
|
- "lldp_interfaces"
|
||||||
- 'logging_global'
|
- "logging_global"
|
||||||
- 'ospf_interfaces'
|
- "ospf_interfaces"
|
||||||
- 'ospfv2'
|
- "ospfv2"
|
||||||
- 'ospfv3'
|
- "ospfv3"
|
||||||
- 'prefix_lists'
|
- "prefix_lists"
|
||||||
- 'route_maps'
|
- "route_maps"
|
||||||
- 'static_routes'
|
- "static_routes"
|
||||||
- 'vlans'
|
- "vlans"
|
||||||
|
|
||||||
- name: Setup target resources with bangs
|
- name: Setup target resources with bangs
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
provided_resources:
|
provided_resources:
|
||||||
- '!all'
|
- "!all"
|
||||||
- '!acl_interfaces'
|
- "!acl_interfaces"
|
||||||
- 'acls'
|
- "acls"
|
||||||
- 'bgp_address_family'
|
- "bgp_address_family"
|
||||||
- 'bgp_global'
|
- "bgp_global"
|
||||||
|
|
||||||
- name: Setup target resources with bangs
|
- name: Setup target resources with bangs
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
expected_network_resources:
|
expected_network_resources:
|
||||||
- 'acls'
|
- "acls"
|
||||||
- 'bgp_address_family'
|
- "bgp_address_family"
|
||||||
- 'bgp_global'
|
- "bgp_global"
|
||||||
|
|
||||||
- name: Get the final list of resources
|
- name: Get the final list of resources
|
||||||
set_fact:
|
set_fact:
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
recurse: false
|
recurse: false
|
||||||
use_regex: true
|
use_regex: true
|
||||||
patterns:
|
patterns:
|
||||||
- '^(?!_|main).+$'
|
- "^(?!_|main).+$"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
register: found
|
register: found
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
recurse: false
|
recurse: false
|
||||||
use_regex: true
|
use_regex: true
|
||||||
patterns:
|
patterns:
|
||||||
- '^(?!_|main).+$'
|
- "^(?!_|main).+$"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
register: found
|
register: found
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
vars:
|
vars:
|
||||||
msg: "'5' is not a valid boolean"
|
msg: "'5' is not a valid boolean"
|
||||||
|
|
||||||
|
|
||||||
- name: Check argspec validation with lookup
|
- name: Check argspec validation with lookup
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
_result: "{{ lookup('ansible.utils.to_paths') }}"
|
_result: "{{ lookup('ansible.utils.to_paths') }}"
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
- name: Use prepend to add the initial variable name
|
- name: Use prepend to add the initial variable name
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
paths: "{{ a|ansible.utils.to_paths(prepend='a') }}"
|
paths: "{{ a|ansible.utils.to_paths(prepend='a') }}"
|
||||||
|
|
||||||
# TASK [Use prepend to add the initial variable name] **************************
|
# TASK [Use prepend to add the initial variable name] **************************
|
||||||
# ok: [nxos101] => changed=false
|
# ok: [nxos101] => changed=false
|
||||||
# ansible_facts:
|
# ansible_facts:
|
||||||
|
@ -36,7 +35,6 @@
|
||||||
# a.b.c.e[0]: true
|
# a.b.c.e[0]: true
|
||||||
# a.b.c.e[1]: false
|
# a.b.c.e[1]: false
|
||||||
|
|
||||||
|
|
||||||
#### Using a complex object
|
#### Using a complex object
|
||||||
|
|
||||||
# - name: Make an API call
|
# - name: Make an API call
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
- name: Use prepend to add the initial variable name
|
- name: Use prepend to add the initial variable name
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
paths: "{{ lookup('ansible.utils.to_paths', a, prepend='a') }}"
|
paths: "{{ lookup('ansible.utils.to_paths', a, prepend='a') }}"
|
||||||
|
|
||||||
# TASK [Use prepend to add the initial variable name] **************************
|
# TASK [Use prepend to add the initial variable name] **************************
|
||||||
# ok: [nxos101] => changed=false
|
# ok: [nxos101] => changed=false
|
||||||
# ansible_facts:
|
# ansible_facts:
|
||||||
|
@ -36,7 +35,6 @@
|
||||||
# a.b.c.e[0]: true
|
# a.b.c.e[0]: true
|
||||||
# a.b.c.e[1]: false
|
# a.b.c.e[1]: false
|
||||||
|
|
||||||
|
|
||||||
#### Using a complex object
|
#### Using a complex object
|
||||||
|
|
||||||
# - name: Make an API call
|
# - name: Make an API call
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
recurse: false
|
recurse: false
|
||||||
use_regex: true
|
use_regex: true
|
||||||
patterns:
|
patterns:
|
||||||
- '^(?!_|main).+$'
|
- "^(?!_|main).+$"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
register: found
|
register: found
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
recurse: false
|
recurse: false
|
||||||
use_regex: true
|
use_regex: true
|
||||||
patterns:
|
patterns:
|
||||||
- '^(?!_|main).+$'
|
- "^(?!_|main).+$"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
register: found
|
register: found
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
recurse: false
|
recurse: false
|
||||||
use_regex: true
|
use_regex: true
|
||||||
patterns:
|
patterns:
|
||||||
- '^(?!_|main).+$'
|
- "^(?!_|main).+$"
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
register: found
|
register: found
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
"$id": "#root/items",
|
"$id": "#root/items",
|
||||||
"title": "Items",
|
"title": "Items",
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"examples": [
|
"examples": [1],
|
||||||
1
|
|
||||||
],
|
|
||||||
"default": 0
|
"default": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,6 @@
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
is_data_valid: "{{ show_interfaces is ansible.utils.validate(criteria=in_rate_check_criteria) }}"
|
is_data_valid: "{{ show_interfaces is ansible.utils.validate(criteria=in_rate_check_criteria) }}"
|
||||||
|
|
||||||
|
|
||||||
- name: validate data using jsonschema engine (valid data read from file)
|
- name: validate data using jsonschema engine (valid data read from file)
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
data_criteria_checks: "{{ data|ansible.utils.validate(in_rate_check_criteria) }}"
|
data_criteria_checks: "{{ data|ansible.utils.validate(in_rate_check_criteria) }}"
|
||||||
|
|
|
@ -23,7 +23,7 @@ show_interfaces:
|
||||||
rate:
|
rate:
|
||||||
in_rate: 0
|
in_rate: 0
|
||||||
out_rate: 0
|
out_rate: 0
|
||||||
description: '# interface is configures with Ansible'
|
description: "# interface is configures with Ansible"
|
||||||
duplex_mode: full
|
duplex_mode: full
|
||||||
enabled: false
|
enabled: false
|
||||||
line_protocol: up
|
line_protocol: up
|
||||||
|
|
Loading…
Reference in New Issue