Enable prettier via pre-commit (#188)

pull/194/head
Bradley A. Thornton 2022-05-26 07:02:52 -07:00 committed by GitHub
parent 6e25216d7a
commit 4fe771a95c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 55932 additions and 55925 deletions

View File

@ -9,11 +9,38 @@ repos:
- id: no-commit-to-branch
args: [--branch, main]
- 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
rev: 22.3.0
hooks:
- id: black
args: [-l, "79"]
- repo: https://github.com/ansible-network/collection_prep
rev: 1.0.0
hooks:

17
.prettierignore Normal file
View File

@ -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

View File

@ -3,259 +3,259 @@ releases:
1.0.0:
changes:
bugfixes:
- linting and formatting for CI
- linting and formatting for CI
minor_changes:
- Add cli_parse module and plugins (https://github.com/ansible-collections/ansible.utils/pull/28)
- Added fact_diff plugin and sub plugin
- Added validate module/lookup/filter/test plugin to validate data based on
given criteria
- Add cli_parse module and plugins (https://github.com/ansible-collections/ansible.utils/pull/28)
- Added fact_diff plugin and sub plugin
- Added validate module/lookup/filter/test plugin to validate data based on
given criteria
fragments:
- 23 linting and formatting.yaml
- 28_cli_parse_plugins_add.yaml
- 29-add_docs_for_Cli_parse.yaml
- add_fact_diff.yaml
- docs_copyedit.yaml
- validate.yaml
- 23 linting and formatting.yaml
- 28_cli_parse_plugins_add.yaml
- 29-add_docs_for_Cli_parse.yaml
- add_fact_diff.yaml
- docs_copyedit.yaml
- validate.yaml
modules:
- description: Parse cli output or text using a variety of parsers
name: cli_parse
namespace: ''
- description: Find the difference between currently set facts
name: fact_diff
namespace: ''
- description: Update currently set facts
name: update_fact
namespace: ''
- description: Validate data with provided criteria
name: validate
namespace: ''
plugins:
lookup:
- description: Retrieve the value in a variable using a path
name: get_path
namespace: null
- description: Find the indices of items in a list matching some criteria
name: index_of
namespace: null
- description: Flatten a complex object into a dictionary of paths and values
name: to_paths
namespace: null
- description: Parse cli output or text using a variety of parsers
name: cli_parse
namespace: ""
- description: Find the difference between currently set facts
name: fact_diff
namespace: ""
- description: Update currently set facts
name: update_fact
namespace: ""
- description: Validate data with provided criteria
name: validate
namespace: null
release_date: '2020-12-08'
namespace: ""
plugins:
lookup:
- description: Retrieve the value in a variable using a path
name: get_path
namespace: null
- description: Find the indices of items in a list matching some criteria
name: index_of
namespace: null
- description: Flatten a complex object into a dictionary of paths and values
name: to_paths
namespace: null
- description: Validate data with provided criteria
name: validate
namespace: null
release_date: "2020-12-08"
1.0.1:
changes:
minor_changes:
- Move CHANGELOG.rst file under changelogs folder as required
- Move CHANGELOG.rst file under changelogs folder as required
fragments:
- fix_changelog_file_location.yaml
release_date: '2020-12-08'
- fix_changelog_file_location.yaml
release_date: "2020-12-08"
2.0.0:
changes:
breaking_changes:
- If added custom sub plugins in your collection move from old location `plugins/<sub-plugin-name>`
to the new location `plugins/sub_plugins/<sub-plugin-name>` and update the
imports as required
- Move sub plugins cli_parsers, fact_diff and validate to `plugins/sub_plugins`
folder
- The `cli_parsers` sub plugins folder name is changed to `cli_parse` to have
consistent naming convention, that is all the cli_parse subplugins will now
be in `plugins/sub_plugins/cli_parse` folder
- If added custom sub plugins in your collection move from old location `plugins/<sub-plugin-name>`
to the new location `plugins/sub_plugins/<sub-plugin-name>` and update the
imports as required
- Move sub plugins cli_parsers, fact_diff and validate to `plugins/sub_plugins`
folder
- The `cli_parsers` sub plugins folder name is changed to `cli_parse` to have
consistent naming convention, that is all the cli_parse subplugins will now
be in `plugins/sub_plugins/cli_parse` folder
fragments:
- 32_doc_updates.yaml
- sub_plugins_dir_change.yaml
- upcap_ansible.yaml
release_date: '2021-01-29'
- 32_doc_updates.yaml
- sub_plugins_dir_change.yaml
- upcap_ansible.yaml
release_date: "2021-01-29"
2.0.1:
changes:
bugfixes:
- Fix ansible.utils.cli_parse action plugin to support old cli_parse sub-plugin
structure in ansible.netcommon collection.
- Fix ansible.utils.cli_parse action plugin to support old cli_parse sub-plugin
structure in ansible.netcommon collection.
fragments:
- ansible-doc.yaml
- cli_parse_fix.yaml
release_date: '2021-02-25'
- ansible-doc.yaml
- cli_parse_fix.yaml
release_date: "2021-02-25"
2.0.2:
changes:
bugfixes:
- Fix cli_parse template_path read error (https://github.com/ansible-collections/ansible.utils/pull/51).
- Fix jsonschema input data format checking (https://github.com/ansible-collections/ansible.utils/pull/50).
- Fix cli_parse template_path read error (https://github.com/ansible-collections/ansible.utils/pull/51).
- Fix jsonschema input data format checking (https://github.com/ansible-collections/ansible.utils/pull/50).
fragments:
- cli_parse_errors_return.yaml
- jsonschema_data_validation_fix.yaml
release_date: '2021-03-29'
- cli_parse_errors_return.yaml
- jsonschema_data_validation_fix.yaml
release_date: "2021-03-29"
2.1.0:
changes:
bugfixes:
- Add missing test requirements (https://github.com/ansible-collections/ansible.utils/pull/57).
- Add missing test requirements (https://github.com/ansible-collections/ansible.utils/pull/57).
minor_changes:
- Add from_xml and to_xml fiter plugin (https://github.com/ansible-collections/ansible.utils/pull/56).
- Add from_xml and to_xml fiter plugin (https://github.com/ansible-collections/ansible.utils/pull/56).
fragments:
- 63-add_ignore_txt.yml
- add-xmltojson-and-jsontoxml-filter.yaml
- add_missing_test_requirements.yml
- fix_tests.yaml
release_date: '2021-04-27'
- 63-add_ignore_txt.yml
- add-xmltojson-and-jsontoxml-filter.yaml
- add_missing_test_requirements.yml
- fix_tests.yaml
release_date: "2021-04-27"
2.2.0:
changes:
minor_changes:
- Add in_any_network, in_network, in_one_network test plugins
- Add ip, ip_address test plugins
- Add ipv4, ipv4_address, ipv4_hostmask, ipv4_netmask test plugins
- Add ipv6, ipv6_address, ipv6_ipv4_mapped, ipv6_sixtofour, ipv6_teredo test
plugins
- Add loopback, mac, multicast test plugins
- Add private, public, reserved test plugins
- Add resolvable test plugins
- Add subnet_of, supernet_of, unspecified test plugins
- Add in_any_network, in_network, in_one_network test plugins
- Add ip, ip_address test plugins
- Add ipv4, ipv4_address, ipv4_hostmask, ipv4_netmask test plugins
- Add ipv6, ipv6_address, ipv6_ipv4_mapped, ipv6_sixtofour, ipv6_teredo test
plugins
- Add loopback, mac, multicast test plugins
- Add private, public, reserved test plugins
- Add resolvable test plugins
- Add subnet_of, supernet_of, unspecified test plugins
fragments:
- add_netaddr_test_plugins_1.yml
- add_netaddr_test_plugins_2.yml
- add_netaddr_test_plugins_3.yml
- add_netaddr_test_plugins_4.yml
- add_netaddr_test_plugins_5.yml
- add_netaddr_test_plugins_6.yml
- add_netaddr_test_plugins_7.yml
- add_netaddr_test_plugins_8.yml
release_date: '2021-05-17'
- add_netaddr_test_plugins_1.yml
- add_netaddr_test_plugins_2.yml
- add_netaddr_test_plugins_3.yml
- add_netaddr_test_plugins_4.yml
- add_netaddr_test_plugins_5.yml
- add_netaddr_test_plugins_6.yml
- add_netaddr_test_plugins_7.yml
- add_netaddr_test_plugins_8.yml
release_date: "2021-05-17"
2.3.0:
changes:
bugfixes:
- Also include empty lists and mappings into the output dictionary (https://github.com/ansible-collections/ansible.utils/pull/58).
- Also include empty lists and mappings into the output dictionary (https://github.com/ansible-collections/ansible.utils/pull/58).
doc_changes:
- Update doc for usable_range filter plugin
- Update doc for usable_range filter plugin
minor_changes:
- Add usable_range test plugin
- Add usable_range test plugin
fragments:
- add_usable_range_filter_plugin.yml
- empty_list_mapping.yml
- improve_coverage_for_filter_plugins.yaml
- update_doc_for_usable_range_filter_plugin.yml
release_date: '2021-06-22'
- add_usable_range_filter_plugin.yml
- empty_list_mapping.yml
- improve_coverage_for_filter_plugins.yaml
- update_doc_for_usable_range_filter_plugin.yml
release_date: "2021-06-22"
2.3.1:
changes:
bugfixes:
- Add support for the validation of formats to the jsonschema validator.
- Improve test coverage
- Add support for the validation of formats to the jsonschema validator.
- Improve test coverage
fragments:
- 81_add_support_for_format.yaml
release_date: '2021-07-26'
- 81_add_support_for_format.yaml
release_date: "2021-07-26"
2.4.0:
changes:
bugfixes:
- Update validate to use 2.11 ArgumentSpecValidator if available.
- Update validate to use 2.11 ArgumentSpecValidator if available.
minor_changes:
- Add new plugin param_list_compare that generates the final param list after
comparing base and provided/target param list.
- Add new plugin param_list_compare that generates the final param list after
comparing base and provided/target param list.
fragments:
- 85_update_validate_plugin.yaml
- 88_compare_resource_list_filter_plugin.yaml
- param_list_compare_docs_added.yaml
release_date: '2021-08-28'
- 85_update_validate_plugin.yaml
- 88_compare_resource_list_filter_plugin.yaml
- param_list_compare_docs_added.yaml
release_date: "2021-08-28"
2.4.1:
changes:
release_summary: Rereleased 2.4.0 with trivial changes.
fragments:
- 2.4.1.yaml
- fix_network_ee.yaml
release_date: '2021-09-24'
- 2.4.1.yaml
- fix_network_ee.yaml
release_date: "2021-09-24"
2.4.2:
changes:
release_summary: Rereleased 2.4.1 with valid requirement.txt.
fragments:
- 2.4.2.yaml
- add_ignore_2.13.yaml
- bugfix_100.yaml
release_date: '2021-10-07'
- 2.4.2.yaml
- add_ignore_2.13.yaml
- bugfix_100.yaml
release_date: "2021-10-07"
2.4.3:
changes:
release_summary: Rereleased 2.4.2 with fix of network ee tests.
fragments:
- 2.4.3.yaml
- fix_network_ee.yaml
release_date: '2021-12-07'
- 2.4.3.yaml
- fix_network_ee.yaml
release_date: "2021-12-07"
2.5.0:
changes:
doc_changes:
- Enhancement in documentation and docstring.
- Enhancement in documentation and docstring.
minor_changes:
- '''keep_keys'' filter plugin added.'
- '''remove_keys'' filter plugin added.'
- '''replace_keys'' filter plugin added.'
- Add cli_merge ipaddr filter plugin.
- Add ip4_hex filter plugin.
- Add ipaddr filter plugin.
- Add ipmath filter plugin.
- Add ipsubnet filter plugin.
- Add ipv4 filter plugin.
- Add ipv6 filter plugin.
- Add ipwrap filter plugin.
- Add network_in_network filter plugin.
- Add network_in_usable filter plugin.
- Add next_nth_usable filter plugin.
- Add nthhost filter plugin.
- Add previous_nth_usable filter plugin.
- Add reduce_on_network filter plugin.
- Add slaac,hwaddr,mac filter plugin.
- New validate sub-plugin "config" to validate device configuration against
user-defined rules (https://github.com/ansible-collections/ansible.network/issues/15).
- "'keep_keys' filter plugin added."
- "'remove_keys' filter plugin added."
- "'replace_keys' filter plugin added."
- Add cli_merge ipaddr filter plugin.
- Add ip4_hex filter plugin.
- Add ipaddr filter plugin.
- Add ipmath filter plugin.
- Add ipsubnet filter plugin.
- Add ipv4 filter plugin.
- Add ipv6 filter plugin.
- Add ipwrap filter plugin.
- Add network_in_network filter plugin.
- Add network_in_usable filter plugin.
- Add next_nth_usable filter plugin.
- Add nthhost filter plugin.
- Add previous_nth_usable filter plugin.
- Add reduce_on_network filter plugin.
- Add slaac,hwaddr,mac filter plugin.
- New validate sub-plugin "config" to validate device configuration against
user-defined rules (https://github.com/ansible-collections/ansible.network/issues/15).
fragments:
- 112-validate-config-plugin.yaml
- add_cli_merge_filter_plugin.yaml
- add_ip4_hex_filter.yaml
- add_ipaddr_filter_plugin.yaml
- add_ipmath_filter.yaml
- add_ipsubnet_filter_plugin.yaml
- add_ipv4_filter_plugin.yaml
- add_ipv6_filter_plugin.yaml
- add_ipwrap_filter_plugin.yaml
- add_network_in_network_filter.yaml
- add_network_in_usable_filter.yaml
- add_next_nth_usable_filter.yaml
- add_nthhost_filter.yaml
- add_previous_nth_usable_filter.yaml
- add_reduce_on_network_filter.yaml
- add_slaac_mac_hwaddr_filter.yaml
- docfix_minor_corrections.yaml
- recursive_filter_plugins.yaml
release_date: '2022-01-31'
- 112-validate-config-plugin.yaml
- add_cli_merge_filter_plugin.yaml
- add_ip4_hex_filter.yaml
- add_ipaddr_filter_plugin.yaml
- add_ipmath_filter.yaml
- add_ipsubnet_filter_plugin.yaml
- add_ipv4_filter_plugin.yaml
- add_ipv6_filter_plugin.yaml
- add_ipwrap_filter_plugin.yaml
- add_network_in_network_filter.yaml
- add_network_in_usable_filter.yaml
- add_next_nth_usable_filter.yaml
- add_nthhost_filter.yaml
- add_previous_nth_usable_filter.yaml
- add_reduce_on_network_filter.yaml
- add_slaac_mac_hwaddr_filter.yaml
- docfix_minor_corrections.yaml
- recursive_filter_plugins.yaml
release_date: "2022-01-31"
2.5.1:
changes:
doc_changes:
- '`in_any_network` - plugin doc fix for redundant line.'
- "`in_any_network` - plugin doc fix for redundant line."
fragments:
- Improve_test_covrage.yaml
- minor_doc_update.yaml
- unit_test_container_venv.yaml
release_date: '2022-03-01'
- Improve_test_covrage.yaml
- minor_doc_update.yaml
- unit_test_container_venv.yaml
release_date: "2022-03-01"
2.5.2:
changes:
bugfixes:
- Fix issue in ipaddr,ipv4,ipv6,ipwrap filters.(https://github.com/ansible-collections/ansible.utils/issues/148).
- ipaddr - Add valid network for link-local (https://github.com/ansible-collections/ansible.netcommon/issues/350).
- ipaddr - Fix issue of breaking ipaddr filter with netcommon 2.6.0(https://github.com/ansible-collections/ansible.netcommon/issues/375).
- Fix issue in ipaddr,ipv4,ipv6,ipwrap filters.(https://github.com/ansible-collections/ansible.utils/issues/148).
- ipaddr - Add valid network for link-local (https://github.com/ansible-collections/ansible.netcommon/issues/350).
- ipaddr - Fix issue of breaking ipaddr filter with netcommon 2.6.0(https://github.com/ansible-collections/ansible.netcommon/issues/375).
fragments:
- bugfix_ipaddr_filter.yaml
release_date: '2022-03-04'
- bugfix_ipaddr_filter.yaml
release_date: "2022-03-04"
2.6.0:
changes:
minor_changes:
- '''consolidate'' filter plugin added.'
- "'consolidate' filter plugin added."
fragments:
- 0-ignore.yml
- consolidate_filter_plugin.yml
- enable_upgrade_black.yml
- pre-commit-enable.yml
- pre-commit-skip.yml
release_date: '2022-04-12'
- 0-ignore.yml
- consolidate_filter_plugin.yml
- enable_upgrade_black.yml
- pre-commit-enable.yml
- pre-commit-skip.yml
release_date: "2022-04-12"
2.6.1:
changes:
release_summary: Rereleased 2.6.0 with fixes for internal testing.
fragments:
- 2.6.1-notes.yaml
- check_mode.yaml
- pylint-black-flake.yml
- sanity_fix.yaml
- test inits.yml
release_date: '2022-04-25'
- 2.6.1-notes.yaml
- check_mode.yaml
- pylint-black-flake.yml
- sanity_fix.yaml
- test inits.yml
release_date: "2022-04-25"

View File

@ -9,23 +9,23 @@ notesdir: fragments
prelude_section_name: release_summary
prelude_section_title: Release Summary
sections:
- - major_changes
- Major Changes
- - minor_changes
- Minor Changes
- - breaking_changes
- Breaking Changes / Porting Guide
- - deprecated_features
- Deprecated Features
- - removed_features
- Removed Features (previously deprecated)
- - security_fixes
- Security Fixes
- - bugfixes
- Bugfixes
- - known_issues
- Known Issues
- - doc_changes
- Documentation Changes
- - major_changes
- Major Changes
- - minor_changes
- Minor Changes
- - breaking_changes
- Breaking Changes / Porting Guide
- - deprecated_features
- Deprecated Features
- - removed_features
- Removed Features (previously deprecated)
- - security_fixes
- Security Fixes
- - bugfixes
- Bugfixes
- - known_issues
- Known Issues
- - doc_changes
- Documentation Changes
title: Ansible Utils Collection
trivial_section_name: trivial

View File

@ -0,0 +1,3 @@
---
trivial:
- Enable prettier via pre-commit

View File

@ -1,2 +1,2 @@
---
requires_ansible: '>=2.9.10'
requires_ansible: ">=2.9.10"

View File

@ -3,14 +3,14 @@ line-length = 79
[tool.pytest.ini_options]
addopts = [
"--integration-tests-path=tests/integration/targets",
"-vvv",
"-n",
"2",
"--log-level",
"WARNING",
"--color",
"yes"
"--integration-tests-path=tests/integration/targets",
"-vvv",
"-n",
"2",
"--log-level",
"WARNING",
"--color",
"yes"
]
testpaths = ["tests"]
filterwarnings = ['ignore:AnsibleCollectionFinder has already been configured']

View File

@ -1,18 +1,18 @@
[
[
[
[
{
"admin_state": "up,",
"interface": "mgmt0",
"state": "up",
"var": "extra_var"
},
{
"admin_state": "up,",
"interface": "Ethernet1/1",
"state": "up",
"var": "extra_var"
}
]
{
"admin_state": "up,",
"interface": "mgmt0",
"state": "up",
"var": "extra_var"
},
{
"admin_state": "up,",
"interface": "Ethernet1/1",
"state": "up",
"var": "extra_var"
}
]
]
]

View File

@ -1,56 +1,56 @@
{
"nf:rpc-reply": {
"@xmlns": "http://www.cisco.com/nxos:1.0:if_manager",
"@xmlns:nf": "urn:ietf:params:xml:ns:netconf:base:1.0",
"nf:data": {
"show": {
"interface": {
"__XML__OPT_Cmd_show_interface___readonly__": {
"__readonly__": {
"TABLE_interface": {
"ROW_interface": {
"admin_state": "up",
"eth_autoneg": "on",
"eth_bia_addr": "5e00.000b.0000",
"eth_bw": "1000000",
"eth_dly": "10",
"eth_duplex": "full",
"eth_ethertype": "0x0000",
"eth_hw_addr": "5e00.000b.0000",
"eth_hw_desc": "Ethernet",
"eth_ip_addr": "10.8.38.74",
"eth_ip_mask": "24",
"eth_ip_prefix": "10.8.38.0",
"eth_mdix": "off",
"eth_mode": "routed",
"eth_mtu": "1500",
"eth_reliability": "188",
"eth_rxload": "1",
"eth_speed": "1000 Mb/s",
"eth_txload": "1",
"interface": "mgmt0",
"medium": "broadcast",
"state": "up",
"vdc_lvl_in_avg_bytes": "816",
"vdc_lvl_in_avg_pkts": "0",
"vdc_lvl_in_bcast": "3124022",
"vdc_lvl_in_bytes": "966991855",
"vdc_lvl_in_mcast": "1743445",
"vdc_lvl_in_pkts": "7716327",
"vdc_lvl_in_ucast": "2848860",
"vdc_lvl_out_avg_bytes": "272",
"vdc_lvl_out_avg_pkts": "0",
"vdc_lvl_out_bcast": "3",
"vdc_lvl_out_bytes": "325131723",
"vdc_lvl_out_mcast": "155378",
"vdc_lvl_out_pkts": "3004554",
"vdc_lvl_out_ucast": "2849173"
}
}
}
}
"nf:rpc-reply": {
"@xmlns": "http://www.cisco.com/nxos:1.0:if_manager",
"@xmlns:nf": "urn:ietf:params:xml:ns:netconf:base:1.0",
"nf:data": {
"show": {
"interface": {
"__XML__OPT_Cmd_show_interface___readonly__": {
"__readonly__": {
"TABLE_interface": {
"ROW_interface": {
"admin_state": "up",
"eth_autoneg": "on",
"eth_bia_addr": "5e00.000b.0000",
"eth_bw": "1000000",
"eth_dly": "10",
"eth_duplex": "full",
"eth_ethertype": "0x0000",
"eth_hw_addr": "5e00.000b.0000",
"eth_hw_desc": "Ethernet",
"eth_ip_addr": "10.8.38.74",
"eth_ip_mask": "24",
"eth_ip_prefix": "10.8.38.0",
"eth_mdix": "off",
"eth_mode": "routed",
"eth_mtu": "1500",
"eth_reliability": "188",
"eth_rxload": "1",
"eth_speed": "1000 Mb/s",
"eth_txload": "1",
"interface": "mgmt0",
"medium": "broadcast",
"state": "up",
"vdc_lvl_in_avg_bytes": "816",
"vdc_lvl_in_avg_pkts": "0",
"vdc_lvl_in_bcast": "3124022",
"vdc_lvl_in_bytes": "966991855",
"vdc_lvl_in_mcast": "1743445",
"vdc_lvl_in_pkts": "7716327",
"vdc_lvl_in_ucast": "2848860",
"vdc_lvl_out_avg_bytes": "272",
"vdc_lvl_out_avg_pkts": "0",
"vdc_lvl_out_bcast": "3",
"vdc_lvl_out_bytes": "325131723",
"vdc_lvl_out_mcast": "155378",
"vdc_lvl_out_pkts": "3004554",
"vdc_lvl_out_ucast": "2849173"
}
}
}
}
}
}
}
}
}

View File

@ -1,7 +1,7 @@
{
"BOOT_IMAGE": "bootflash:///titanium-d1-kickstart.7.3.0.D1.1.bin",
"LAST_REBOOT_REASON": "",
"OS": "7.3(0)D1(1)",
"PLATFORM": "OSv",
"UPTIME": "110 day(s), 12 hour(s), 32 minute(s), 10 second(s)"
"BOOT_IMAGE": "bootflash:///titanium-d1-kickstart.7.3.0.D1.1.bin",
"LAST_REBOOT_REASON": "",
"OS": "7.3(0)D1(1)",
"PLATFORM": "OSv",
"UPTIME": "110 day(s), 12 hour(s), 32 minute(s), 10 second(s)"
}

View File

@ -45,7 +45,6 @@
vars:
msg: "one of the following is required: command, text"
- name: "{{ parser }} validate argspec"
ansible.utils.cli_parse:
text: ""

View File

@ -14,14 +14,13 @@
- name: "{{ parser }} Confirm response"
assert:
that:
- "{{ POpqMQoJWTiDpEW is defined }}"
- "{{ nxos_ttp_text['parsed'][0][0] | selectattr('interface', 'search', 'mgmt0') | list | length }}"
- "{{ nxos_ttp_text['parsed'] == nxos_ttp_text_parsed }}"
- "{{ POpqMQoJWTiDpEW is defined }}"
- "{{ nxos_ttp_text['parsed'][0][0] | selectattr('interface', 'search', 'mgmt0') | list | length }}"
- "{{ nxos_ttp_text['parsed'] == nxos_ttp_text_parsed }}"
- name: "{{ parser }} Pass text and custom variable"
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') }}"
parser:
name: ansible.utils.ttp
template_path: "{{ role_path }}/templates/nxos_show_interface.ttp"
@ -38,7 +37,7 @@
- name: "{{ parser }} Pass text and ttp_results modified"
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') }}"
parser:
name: ansible.utils.ttp
template_path: "{{ role_path }}/templates/nxos_show_interface.ttp"

View File

@ -6,7 +6,7 @@
recurse: false
use_regex: true
patterns:
- '^(?!_|main).+$'
- "^(?!_|main).+$"
delegate_to: localhost
register: found

View File

@ -3,10 +3,7 @@
ansible.builtin.set_fact:
data_sources:
- data:
[
{ "name": "GigabitEthernet0/1" },
{ "name": "GigabitEthernet0/2" },
]
[{ "name": "GigabitEthernet0/1" }, { "name": "GigabitEthernet0/2" }]
match_key: name
name: acl_interfaces
- data:

View File

@ -59,7 +59,6 @@
ansible.utils.fact_diff:
before: "{{ before|to_nice_yaml }}"
after: "{{ after|to_nice_yaml }}"
# TASK [ansible.utils.fact_diff] **************************************
# --- before
# +++ after
@ -74,7 +73,6 @@
# changed: [localhost]
#### Show the difference between complex object using restconf
# ansible_connection: ansible.netcommon.httpapi
# ansible_httpapi_use_ssl: True

View File

@ -6,7 +6,7 @@
recurse: false
use_regex: true
patterns:
- '^(?!_|main).+$'
- "^(?!_|main).+$"
delegate_to: localhost
register: found

View File

@ -6,7 +6,7 @@
plugin:
vars:
skip_lines:
- '+'
- "+"
ignore_errors: true
register: result

View File

@ -6,7 +6,7 @@
recurse: false
use_regex: true
patterns:
- '^(?!_|main).+$'
- "^(?!_|main).+$"
delegate_to: localhost
register: found

View File

@ -1,20 +1,20 @@
---
- name: Setup xml and expected json
ansible.builtin.set_fact:
data: "
<netconf-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring\"><schemas><schema/></schemas></netconf-state>
"
output: {
"netconf-state": {
"@xmlns": "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring",
"schemas": {
"schema": null
}
data: '
<netconf-state xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"><schemas><schema/></schemas></netconf-state>
'
output:
{
"netconf-state":
{
"@xmlns": "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring",
"schemas": { "schema": null },
},
}
}
- debug:
msg: "{{ data|ansible.utils.from_xml() }}"
msg: "{{ data|ansible.utils.from_xml() }}"
- name: Integration tests with and without default engine as xmltodict and
assert:
@ -25,7 +25,7 @@
- name: Setup invalid xml as input to ansible.utils.from_xml.
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
ansible.builtin.set_fact:

View File

@ -21,7 +21,6 @@
# ansible_facts:
# value: '0'
#### Working with hostvars
- name: Retrieve a value deep inside all of the host's vars
@ -37,7 +36,6 @@
# as_filter: '0'
# as_lookup: '0'
#### Used alongside ansible.utils.to_paths
- name: Get the paths for the object
@ -53,7 +51,6 @@
vars:
path: "{{ item }}"
value: "{{ vars|ansible.utils.get_path(item) }}"
# TASK [Get the paths for the object] *******************************
# ok: [nxos101] => changed=false
# ansible_facts:
@ -73,7 +70,6 @@
# ok: [nxos101] => (item=a.b.c.e[1]) =>
# msg: The value of path a.b.c.e[1] in vars is False
#### Working with complex structures and transforming results
# - name: Retrieve the current interface config
@ -92,7 +88,6 @@
# - by_name['Ethernet1/2'].description|upper
# - by_name['Ethernet1/3'].description|default('')
# TASK [Get the description of several interfaces] ******************
# ok: [nxos101] => (item=by_name['Ethernet1/1'].description) => changed=false
# msg: Configured by ansible

View File

@ -21,7 +21,6 @@
# ansible_facts:
# value: '0'
#### Working with hostvars
- name: Retrieve a value deep inside all of the host's vars
@ -37,7 +36,6 @@
# as_filter: '0'
# as_lookup: '0'
#### Used alongside ansible.utils.to_paths
- name: Get the paths for the object
@ -53,7 +51,6 @@
vars:
path: "{{ item }}"
value: "{{ lookup('ansible.utils.get_path', hostvars[inventory_hostname], item) }}"
# TASK [Get the paths for the object] *******************************
# ok: [nxos101] => changed=false
# ansible_facts:
@ -73,7 +70,6 @@
# ok: [nxos101] => (item=a.b.c.e[1]) =>
# msg: The value of path a.b.c.e[1] in vars is False
#### Working with complex structures and transforming results
# - name: Retrieve the current interface config
@ -92,7 +88,6 @@
# - by_name['Ethernet1/2'].description|upper
# - by_name['Ethernet1/3'].description|default('')
# TASK [Get the description of several interfaces] ******************
# ok: [nxos101] => (item=by_name['Ethernet1/1'].description) => changed=false
# msg: Configured by ansible

View File

@ -6,7 +6,7 @@
recurse: false
use_regex: true
patterns:
- '^(?!_|main).+$'
- "^(?!_|main).+$"
delegate_to: localhost
register: found

View File

@ -23,7 +23,7 @@
expected: "{{ a.b.c.d[0] }}"
- result: "{{ a|ansible.utils.get_path('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 }}"
- result: "{{ lookup('ansible.utils.get_path', vars, 'a') }}"
expected: "{{ a }}"
@ -37,7 +37,7 @@
expected: "{{ a.b.c.d[0] }}"
- result: "{{ lookup('ansible.utils.get_path', 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 }}"
- ansible.builtin.set_fact:

View File

@ -51,7 +51,6 @@
# ok: [sw01] => (item=2) =>
# msg: 3 is > than 1
#### Working with lists of dictionaries
- ansible.builtin.set_fact:
@ -94,7 +93,7 @@
msg: "The device named {{ data[item].name }} is a {{ data[item].type }}"
loop: "{{ data|ansible.utils.index_of('regex', expression, 'name') }}"
vars:
expression: '\.corp$' # ends with .corp
expression: '\.corp$' # ends with .corp
# TASK [Find the index of all devices with a .corp name] *********************
# ok: [nxos101] => (item=2) =>
@ -102,7 +101,6 @@
# ok: [nxos101] => (item=3) =>
# msg: The device named fw02.example.corp is a firewall
#### Working with complex structures from resource modules
# - name: Retrieve the current L3 interface configuration
@ -153,7 +151,6 @@
# ok: [nxos101] => (item=[{'interface_idx': '128', 'address_idxs': [0]}, 0]) =>
# msg: mgmt0 has ip 192.168.101.14/24
#### Working with deeply nested data
- ansible.builtin.set_fact:
@ -201,7 +198,6 @@
index: 3
index: 3
- name: Find the description of loopback111, subinterface index 10
debug:
msg: |-

View File

@ -58,7 +58,7 @@
vars:
params:
data: "{{ data }}"
test: '>'
test: ">"
value: 1
# TASK [Find numbers greater than 1, using with] *****************************
@ -67,7 +67,6 @@
# ok: [nxos101] => (item=2) =>
# msg: 3 is > than 1
#### Working with lists of dictionaries
- ansible.builtin.set_fact:
@ -110,7 +109,7 @@
msg: "The device named {{ data[item].name }} is a {{ data[item].type }}"
loop: "{{ lookup('ansible.utils.index_of', data, 'regex', expression, 'name') }}"
vars:
expression: '\.corp$' # ends with .corp
expression: '\.corp$' # ends with .corp
# TASK [Find the index of all devices with a .corp name] *********************
# ok: [nxos101] => (item=2) =>
@ -118,7 +117,6 @@
# ok: [nxos101] => (item=3) =>
# msg: The device named fw02.example.corp is a firewall
#### Working with complex structures from resource modules
# - name: Retrieve the current L3 interface configuration
@ -169,7 +167,6 @@
# ok: [nxos101] => (item=[{'interface_idx': '128', 'address_idxs': [0]}, 0]) =>
# msg: mgmt0 has ip 192.168.101.14/24
#### Working with deeply nested data
- ansible.builtin.set_fact:
@ -217,7 +214,6 @@
index: 3
index: 3
- name: Find the description of loopback111, subinterface index 10
debug:
msg: |-

View File

@ -6,7 +6,7 @@
recurse: false
use_regex: true
patterns:
- '^(?!_|main).+$'
- "^(?!_|main).+$"
delegate_to: localhost
register: found

View File

@ -57,7 +57,6 @@
- test: "{{ lookup('ansible.utils.index_of', complex.d, 'match', '.*d$') }}"
result: [0, 1]
- ansible.builtin.set_fact:
complex:
a:

View File

@ -7,7 +7,6 @@
assert:
that: "{{ result1 == '1a:2b:3c:4d:5e:6f' }}"
- name: hwaddr filter test2
ansible.builtin.set_fact:
result1: "{{ '1a:2b:3c:4d:5e:6f'|ansible.utils.hwaddr('cisco') }}"

View File

@ -26,7 +26,6 @@
assert:
that: "{{ result2 == ipaddr_result2 }}"
- name: ipaddr filter with public network query
ansible.builtin.set_fact:
result3: "{{ value|ansible.utils.ipaddr('public') }}"

View File

@ -31,7 +31,6 @@
assert:
that: "{{ result1 == '192.168.1.1' }}"
- name: Get the next tenth address in IPv6 with Ipmath filter
ansible.builtin.set_fact:
result1: "{{ '2001::1'|ansible.utils.ipmath('10') }}"

View File

@ -4,7 +4,7 @@
value:
- 192.24.2.1
- ::ffff:192.168.32.0/120
- ''
- ""
- ::ffff:192.24.2.1/128
- 192.168.32.0/24
- fe80::100/10

View File

@ -7,7 +7,6 @@
assert:
that: "{{ result1 == '1a:2b:3c:4d:5e:6f' }}"
- name: macaddr filter test2
ansible.builtin.set_fact:
result1: "{{ '1a:2b:3c:4d:5e:6f'|ansible.utils.macaddr('cisco') }}"

View File

@ -6,7 +6,7 @@
recurse: false
use_regex: true
patterns:
- '^(?!_|main).+$'
- "^(?!_|main).+$"
delegate_to: localhost
register: found

View File

@ -15,7 +15,6 @@
assert:
that: "{{ result1 == False }}"
- name: network_in_network filter test3
ansible.builtin.set_fact:
result1: "{{ '192.168.0.0/16'|ansible.utils.network_in_network('192.168.0.0/24') }}"

View File

@ -15,7 +15,6 @@
assert:
that: "{{ result1 == False }}"
- name: network_in_usable filter test3
ansible.builtin.set_fact:
result1: "{{ '192.168.0.0/16'|ansible.utils.network_in_usable('192.168.0.255') }}"

View File

@ -1,23 +1,23 @@
---
address: '192.168.144.5'
subnet: '192.168.0.0/16'
address: "192.168.144.5"
subnet: "192.168.0.0/16"
result1_val:
- "192.24.2.1"
- "192.168.32.0/24"
- "192.24.2.1"
- "192.168.32.0/24"
result2_val:
- "::ffff:192.24.2.1/128"
- "::ffff:192.168.32.0/120"
- "::ffff:192.24.2.1/128"
- "::ffff:192.168.32.0/120"
result3_val:
- "192.24.2.1"
- "192.24.2.1"
ipaddr_result1:
- 192.24.2.1
- ::1
- 192.168.32.0/24
- fe80::100/10
- 2001:db8:32c:faad::/64
- 192.24.2.1
- ::1
- 192.168.32.0/24
- fe80::100/10
- 2001:db8:32c:faad::/64
ipaddr_result2:
- 192.24.2.1/32
@ -33,29 +33,29 @@ ipaddr_result4:
- 2001:db8:32c:faad::/64
ipwrap_result1:
- "192.24.2.1"
- "host.fqdn"
- "[::1]"
- "192.168.32.0/24"
- "[fe80::100]/10"
- "[2001:db8:32c:faad::]/64"
- True
- "192.24.2.1"
- "host.fqdn"
- "[::1]"
- "192.168.32.0/24"
- "[fe80::100]/10"
- "[2001:db8:32c:faad::]/64"
- True
ipv6_result1:
- "::ffff:192.168.32.0/120"
- "::ffff:192.24.2.1/128"
- "fe80::100/10"
- "::ffff:192.168.32.0/120"
- "::ffff:192.24.2.1/128"
- "fe80::100/10"
ipv6_result2:
- "192.168.32.0/24"
- "192.24.2.1/32"
- "192.168.32.0/24"
- "192.24.2.1/32"
ipv6_result3:
- "::ffff:192.168.32.0"
- "::ffff:192.24.2.1"
- "fe80::100"
- "::ffff:192.168.32.0"
- "::ffff:192.24.2.1"
- "fe80::100"
cidr_result1:
- 192.168.0.0/16
- 192.168.0.0/16
cidr_result2: 192.168.1.0/29

View File

@ -6,7 +6,7 @@
recurse: false
use_regex: true
patterns:
- '^(?!_|main).+$'
- "^(?!_|main).+$"
delegate_to: localhost
register: found

View File

@ -13,20 +13,20 @@
duplex: auto
is_enabled: true
vifs:
- vlan_id: 100
description: Eth1 - VIF 100
mtu: 400
is_enabled: true
- vlan_id: 101
description: Eth1 - VIF 101
is_enabled: true
- vlan_id: 100
description: Eth1 - VIF 100
mtu: 400
is_enabled: true
- vlan_id: 101
description: Eth1 - VIF 101
is_enabled: true
- interface_name: eth2
description: Configured by Ansible - Interface 2 (ADMIN DOWN)
mtu: 600
is_enabled: false
- debug:
msg: "{{ data|ansible.utils.keep_keys(target=['desc', 'interface_'], matching_parameter= 'starts_with') }}"
msg: "{{ data|ansible.utils.keep_keys(target=['desc', 'interface_'], matching_parameter= 'starts_with') }}"
register: result
- name: Assert result dicts
@ -48,20 +48,20 @@
duplex: auto
is_enabled: true
vifs:
- vlan_id: 100
description: Eth1 - VIF 100
mtu: 400
is_enabled: true
- vlan_id: 101
description: Eth1 - VIF 101
is_enabled: true
- vlan_id: 100
description: Eth1 - VIF 100
mtu: 400
is_enabled: true
- vlan_id: 101
description: Eth1 - VIF 101
is_enabled: true
- interface_name: eth2
description: Configured by Ansible - Interface 2 (ADMIN DOWN)
mtu: 600
is_enabled: false
- debug:
msg: "{{ data|ansible.utils.keep_keys(target=['interface_name', 'is_enabled', 'vlan_id']) }}"
msg: "{{ data|ansible.utils.keep_keys(target=['interface_name', 'is_enabled', 'vlan_id']) }}"
register: result
- name: Assert result dicts

View File

@ -5,8 +5,8 @@ keep:
- interface_name: eth1
description: Configured by Ansible - Interface 1
vifs:
- description: Eth1 - VIF 100
- description: Eth1 - VIF 101
- description: Eth1 - VIF 100
- description: Eth1 - VIF 101
- interface_name: eth2
description: Configured by Ansible - Interface 2 (ADMIN DOWN)
@ -16,9 +16,9 @@ keep_default:
- interface_name: eth1
is_enabled: true
vifs:
- vlan_id: 100
is_enabled: true
- vlan_id: 101
is_enabled: true
- vlan_id: 100
is_enabled: true
- vlan_id: 101
is_enabled: true
- interface_name: eth2
is_enabled: false

View File

@ -6,7 +6,7 @@
recurse: false
use_regex: true
patterns:
- '^(?!_|main).+$'
- "^(?!_|main).+$"
delegate_to: localhost
register: found

View File

@ -6,7 +6,7 @@
recurse: false
use_regex: true
patterns:
- '^(?!_|main).+$'
- "^(?!_|main).+$"
delegate_to: localhost
register: found

View File

@ -6,42 +6,42 @@
ansible.builtin.set_fact:
network_resources:
modules:
- 'acl_interfaces'
- 'acls'
- 'bgp_address_family'
- 'bgp_global'
- 'interfaces'
- 'l2_interfaces'
- 'l3_interfaces'
- 'lacp'
- 'lacp_interfaces'
- 'lag_interfaces'
- 'lldp_global'
- 'lldp_interfaces'
- 'logging_global'
- 'ospf_interfaces'
- 'ospfv2'
- 'ospfv3'
- 'prefix_lists'
- 'route_maps'
- 'static_routes'
- 'vlans'
- "acl_interfaces"
- "acls"
- "bgp_address_family"
- "bgp_global"
- "interfaces"
- "l2_interfaces"
- "l3_interfaces"
- "lacp"
- "lacp_interfaces"
- "lag_interfaces"
- "lldp_global"
- "lldp_interfaces"
- "logging_global"
- "ospf_interfaces"
- "ospfv2"
- "ospfv3"
- "prefix_lists"
- "route_maps"
- "static_routes"
- "vlans"
- name: Setup target resources with bangs
ansible.builtin.set_fact:
provided_resources:
- '!all'
- '!acl_interfaces'
- 'acls'
- 'bgp_address_family'
- 'bgp_global'
- "!all"
- "!acl_interfaces"
- "acls"
- "bgp_address_family"
- "bgp_global"
- name: Setup target resources with bangs
ansible.builtin.set_fact:
expected_network_resources:
- 'acls'
- 'bgp_address_family'
- 'bgp_global'
- "acls"
- "bgp_address_family"
- "bgp_global"
- name: Get the final list of resources
set_fact:
@ -51,6 +51,6 @@
assert:
that:
- "{{ expected_network_resources | symmetric_difference(final_network_resources['actionable']) |length\
\ == 0 }}"
\ == 0 }}"
- debug:
msg: "END param_list_compare integration tests on connection={{ ansible_connection }}"

View File

@ -6,7 +6,7 @@
recurse: false
use_regex: true
patterns:
- '^(?!_|main).+$'
- "^(?!_|main).+$"
delegate_to: localhost
register: found

View File

@ -14,23 +14,23 @@
duplex: auto
enabled: true
vifs:
- vlan_id: 100
description: Eth1 - VIF 100
mtu: 400
enabled: true
notes:
- note 1
- note 2
- vlan_id: 101
description: Eth1 - VIF 101
enabled: true
- vlan_id: 100
description: Eth1 - VIF 100
mtu: 400
enabled: true
notes:
- note 1
- note 2
- vlan_id: 101
description: Eth1 - VIF 101
enabled: true
- name: eth2
description: Configured by Ansible - Interface 2 (ADMIN DOWN)
mtu: 600
enabled: false
- debug:
msg: "{{ data|ansible.utils.remove_keys(target=['notes', 'comment']) }}"
msg: "{{ data|ansible.utils.remove_keys(target=['notes', 'comment']) }}"
register: result
- name: Assert result dicts

View File

@ -1,25 +1,25 @@
---
remove:
default:
- name: eth0
enabled: true
duplex: auto
speed: auto
- name: eth1
description: Configured by Ansible - Interface 1
mtu: 1500
speed: auto
duplex: auto
enabled: true
vifs:
- vlan_id: 100
description: Eth1 - VIF 100
mtu: 400
- name: eth0
enabled: true
- vlan_id: 101
description: Eth1 - VIF 101
duplex: auto
speed: auto
- name: eth1
description: Configured by Ansible - Interface 1
mtu: 1500
speed: auto
duplex: auto
enabled: true
- name: eth2
description: Configured by Ansible - Interface 2 (ADMIN DOWN)
mtu: 600
enabled: false
vifs:
- vlan_id: 100
description: Eth1 - VIF 100
mtu: 400
enabled: true
- vlan_id: 101
description: Eth1 - VIF 101
enabled: true
- name: eth2
description: Configured by Ansible - Interface 2 (ADMIN DOWN)
mtu: 600
enabled: false

View File

@ -6,7 +6,7 @@
recurse: false
use_regex: true
patterns:
- '^(?!_|main).+$'
- "^(?!_|main).+$"
delegate_to: localhost
register: found

View File

@ -13,20 +13,20 @@
duplex: auto
enabled: true
vifs:
- vlan_id: 100
description: Eth1 - VIF 100
mtu: 400
enabled: true
- vlan_id: 101
description: Eth1 - VIF 101
enabled: true
- vlan_id: 100
description: Eth1 - VIF 100
mtu: 400
enabled: true
- vlan_id: 101
description: Eth1 - VIF 101
enabled: true
- interface_name: eth2
description: Configured by Ansible - Interface 2 (ADMIN DOWN)
mtu: 600
enabled: false
- debug:
msg: "{{ data|ansible.utils.replace_keys(target=[{'before':'interface_name', 'after':'name'}]) }}"
msg: "{{ data|ansible.utils.replace_keys(target=[{'before':'interface_name', 'after':'name'}]) }}"
register: result
- name: Assert result dicts

View File

@ -1,25 +1,25 @@
---
replace:
default:
- name: eth0
enabled: true
duplex: auto
speed: auto
- name: eth1
description: Configured by Ansible - Interface 1
mtu: 1500
speed: auto
duplex: auto
enabled: true
vifs:
- vlan_id: 100
description: Eth1 - VIF 100
mtu: 400
- name: eth0
enabled: true
- vlan_id: 101
description: Eth1 - VIF 101
duplex: auto
speed: auto
- name: eth1
description: Configured by Ansible - Interface 1
mtu: 1500
speed: auto
duplex: auto
enabled: true
- name: eth2
description: Configured by Ansible - Interface 2 (ADMIN DOWN)
mtu: 600
enabled: false
vifs:
- vlan_id: 100
description: Eth1 - VIF 100
mtu: 400
enabled: true
- vlan_id: 101
description: Eth1 - VIF 101
enabled: true
- name: eth2
description: Configured by Ansible - Interface 2 (ADMIN DOWN)
mtu: 600
enabled: false

View File

@ -19,7 +19,6 @@
vars:
msg: "'5' is not a valid boolean"
- name: Check argspec validation with lookup
ansible.builtin.set_fact:
_result: "{{ lookup('ansible.utils.to_paths') }}"

View File

@ -26,7 +26,6 @@
- name: Use prepend to add the initial variable name
ansible.builtin.set_fact:
paths: "{{ a|ansible.utils.to_paths(prepend='a') }}"
# TASK [Use prepend to add the initial variable name] **************************
# ok: [nxos101] => changed=false
# ansible_facts:
@ -36,7 +35,6 @@
# a.b.c.e[0]: true
# a.b.c.e[1]: false
#### Using a complex object
# - name: Make an API call

View File

@ -26,7 +26,6 @@
- name: Use prepend to add the initial variable name
ansible.builtin.set_fact:
paths: "{{ lookup('ansible.utils.to_paths', a, prepend='a') }}"
# TASK [Use prepend to add the initial variable name] **************************
# ok: [nxos101] => changed=false
# ansible_facts:
@ -36,7 +35,6 @@
# a.b.c.e[0]: true
# a.b.c.e[1]: false
#### Using a complex object
# - name: Make an API call

View File

@ -6,7 +6,7 @@
recurse: false
use_regex: true
patterns:
- '^(?!_|main).+$'
- "^(?!_|main).+$"
delegate_to: localhost
register: found

View File

@ -6,7 +6,7 @@
recurse: false
use_regex: true
patterns:
- '^(?!_|main).+$'
- "^(?!_|main).+$"
delegate_to: localhost
register: found

View File

@ -8,7 +8,7 @@
output: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<interface-configurations xmlns=\"http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg\">\n\t<interface-configuration></interface-configuration>\n</interface-configurations>"
- debug:
msg: "{{ data|ansible.utils.to_xml() }}"
msg: "{{ data|ansible.utils.to_xml() }}"
- name: Integration tests with and without default engine as xmltodict and
assert:

View File

@ -6,7 +6,7 @@
recurse: false
use_regex: true
patterns:
- '^(?!_|main).+$'
- "^(?!_|main).+$"
delegate_to: localhost
register: found

View File

@ -1,17 +1,15 @@
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://example.com/object1615264346.json",
"title": "Root",
"type": "array",
"default": [],
"items":{
"$id": "#root/items",
"title": "Items",
"type": "integer",
"examples": [
1
],
"default": 0
}
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://example.com/object1615264346.json",
"title": "Root",
"type": "array",
"default": [],
"items": {
"$id": "#root/items",
"title": "Items",
"type": "integer",
"examples": [1],
"default": 0
}
}

View File

@ -1,18 +1,18 @@
{
"type" : "object",
"patternProperties": {
"^.*": {
"type": "object",
"properties": {
"counters": {
"properties": {
"in_crc_errors": {
"type": "number",
"maximum": 0
}
}
}
}
}
}
"type": "object",
"patternProperties": {
"^.*": {
"type": "object",
"properties": {
"counters": {
"properties": {
"in_crc_errors": {
"type": "number",
"maximum": 0
}
}
}
}
}
}
}

View File

@ -1,13 +1,13 @@
{
"type" : "object",
"patternProperties": {
"^.*": {
"type": "object",
"properties": {
"enabled": {
"enum": [true]
}
}
}
}
"type": "object",
"patternProperties": {
"^.*": {
"type": "object",
"properties": {
"enabled": {
"enum": [true]
}
}
}
}
}

View File

@ -1,10 +1,10 @@
{
"$schema": "https://json-schema.org/schema#",
"$schema": "https://json-schema.org/schema#",
"type": "object",
"properties": {
"name": {"type": "string"},
"email": {"format": "email"}
},
"required": ["email"]
"type": "object",
"properties": {
"name": { "type": "string" },
"email": { "format": "email" }
},
"required": ["email"]
}

View File

@ -1,22 +1,22 @@
{
"type" : "object",
"patternProperties": {
"^.*": {
"type": "object",
"properties": {
"counters": {
"properties": {
"rate": {
"properties": {
"in_rate": {
"type": "number",
"maximum": 0
}
}
}
}
}
}
}
}
"type": "object",
"patternProperties": {
"^.*": {
"type": "object",
"properties": {
"counters": {
"properties": {
"rate": {
"properties": {
"in_rate": {
"type": "number",
"maximum": 0
}
}
}
}
}
}
}
}
}

View File

@ -1,14 +1,14 @@
{
"type" : "object",
"patternProperties": {
"^.*": {
"type": "object",
"properties": {
"oper_status": {
"type": "string",
"pattern": "up"
}
}
}
}
"type": "object",
"patternProperties": {
"^.*": {
"type": "object",
"properties": {
"oper_status": {
"type": "string",
"pattern": "up"
}
}
}
}
}

View File

@ -1,4 +1,4 @@
{
"name": "ansible",
"email": "ansible@redhat.com"
"name": "ansible",
"email": "ansible@redhat.com"
}

View File

@ -1,20 +1,20 @@
---
- name: Set up data and criteria
ansible.builtin.set_fact:
fail_config: "{{ lookup('ansible.builtin.file', 'data/fail.cfg') }}"
warn_config: "{{ lookup('ansible.builtin.file', 'data/warn.cfg') }}"
pass_config: "{{ lookup('ansible.builtin.file', 'data/pass.cfg') }}"
rules: "{{ lookup('ansible.builtin.file', 'criteria/rules.yaml') }}"
bad_rules:
- name: Invalid action
action: flunge
rule: Flunge it!
- name: No action
rule: Rule
- name: No rule
action: fail
- rule: No name
action: fail
fail_config: "{{ lookup('ansible.builtin.file', 'data/fail.cfg') }}"
warn_config: "{{ lookup('ansible.builtin.file', 'data/warn.cfg') }}"
pass_config: "{{ lookup('ansible.builtin.file', 'data/pass.cfg') }}"
rules: "{{ lookup('ansible.builtin.file', 'criteria/rules.yaml') }}"
bad_rules:
- name: Invalid action
action: flunge
rule: Flunge it!
- name: No action
rule: Rule
- name: No rule
action: fail
- rule: No name
action: fail
- name: validate configuration using config (with errors)
ansible.builtin.set_fact:

View File

@ -1,20 +1,20 @@
---
- name: Set up data and criteria
ansible.builtin.set_fact:
fail_config: "{{ lookup('ansible.builtin.file', 'data/fail.cfg') }}"
warn_config: "{{ lookup('ansible.builtin.file', 'data/warn.cfg') }}"
pass_config: "{{ lookup('ansible.builtin.file', 'data/pass.cfg') }}"
rules: "{{ lookup('ansible.builtin.file', 'criteria/rules.yaml') }}"
bad_rules:
- name: Invalid action
action: flunge
rule: Flunge it!
- name: No action
rule: Rule
- name: No rule
action: fail
- rule: No name
action: fail
fail_config: "{{ lookup('ansible.builtin.file', 'data/fail.cfg') }}"
warn_config: "{{ lookup('ansible.builtin.file', 'data/warn.cfg') }}"
pass_config: "{{ lookup('ansible.builtin.file', 'data/pass.cfg') }}"
rules: "{{ lookup('ansible.builtin.file', 'criteria/rules.yaml') }}"
bad_rules:
- name: Invalid action
action: flunge
rule: Flunge it!
- name: No action
rule: Rule
- name: No rule
action: fail
- rule: No name
action: fail
- name: validate configuration using config (with errors)
ansible.builtin.set_fact:

View File

@ -1,20 +1,20 @@
---
- name: Set up data and criteria
ansible.builtin.set_fact:
fail_config: "{{ lookup('ansible.builtin.file', 'data/fail.cfg') }}"
warn_config: "{{ lookup('ansible.builtin.file', 'data/warn.cfg') }}"
pass_config: "{{ lookup('ansible.builtin.file', 'data/pass.cfg') }}"
rules: "{{ lookup('ansible.builtin.file', 'criteria/rules.yaml') }}"
bad_rules:
- name: Invalid action
action: flunge
rule: Flunge it!
- name: No action
rule: Rule
- name: No rule
action: fail
- rule: No name
action: fail
fail_config: "{{ lookup('ansible.builtin.file', 'data/fail.cfg') }}"
warn_config: "{{ lookup('ansible.builtin.file', 'data/warn.cfg') }}"
pass_config: "{{ lookup('ansible.builtin.file', 'data/pass.cfg') }}"
rules: "{{ lookup('ansible.builtin.file', 'criteria/rules.yaml') }}"
bad_rules:
- name: Invalid action
action: flunge
rule: Flunge it!
- name: No action
rule: Rule
- name: No rule
action: fail
- rule: No name
action: fail
- name: validate configuration using config (with errors)
ansible.utils.validate:

View File

@ -1,20 +1,20 @@
---
- name: Set up data and criteria
ansible.builtin.set_fact:
fail_config: "{{ lookup('ansible.builtin.file', 'data/fail.cfg') }}"
warn_config: "{{ lookup('ansible.builtin.file', 'data/warn.cfg') }}"
pass_config: "{{ lookup('ansible.builtin.file', 'data/pass.cfg') }}"
rules: "{{ lookup('ansible.builtin.file', 'criteria/rules.yaml') }}"
bad_rules:
- name: Invalid action
action: flunge
rule: Flunge it!
- name: No action
rule: Rule
- name: No rule
action: fail
- rule: No name
action: fail
fail_config: "{{ lookup('ansible.builtin.file', 'data/fail.cfg') }}"
warn_config: "{{ lookup('ansible.builtin.file', 'data/warn.cfg') }}"
pass_config: "{{ lookup('ansible.builtin.file', 'data/pass.cfg') }}"
rules: "{{ lookup('ansible.builtin.file', 'criteria/rules.yaml') }}"
bad_rules:
- name: Invalid action
action: flunge
rule: Flunge it!
- name: No action
rule: Rule
- name: No rule
action: fail
- rule: No name
action: fail
- name: validate configuration using config (with errors)
ansible.builtin.set_fact:

View File

@ -63,11 +63,11 @@
- name: read data and criteria from file
ansible.builtin.set_fact:
data: "{{ lookup('ansible.builtin.file', 'data/show_interface.json') }}"
oper_status_up_criteria: "{{ lookup('ansible.builtin.file', 'criteria/oper_status_up.json') }}"
enabled_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/enabled_check.json') }}"
crc_error_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/crc_error_check.json') }}"
in_rate_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/in_rate_check.json') }}"
data: "{{ lookup('ansible.builtin.file', 'data/show_interface.json') }}"
oper_status_up_criteria: "{{ lookup('ansible.builtin.file', 'criteria/oper_status_up.json') }}"
enabled_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/enabled_check.json') }}"
crc_error_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/crc_error_check.json') }}"
in_rate_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/in_rate_check.json') }}"
- name: validate data using jsonschema engine (invalid data read from file)
ansible.builtin.set_fact:

View File

@ -81,11 +81,11 @@
- name: read data and criteria from file
ansible.builtin.set_fact:
data: "{{ lookup('ansible.builtin.file', 'data/show_interface.json') }}"
oper_status_up_criteria: "{{ lookup('ansible.builtin.file', 'criteria/oper_status_up.json') }}"
enabled_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/enabled_check.json') }}"
crc_error_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/crc_error_check.json') }}"
in_rate_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/in_rate_check.json') }}"
data: "{{ lookup('ansible.builtin.file', 'data/show_interface.json') }}"
oper_status_up_criteria: "{{ lookup('ansible.builtin.file', 'criteria/oper_status_up.json') }}"
enabled_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/enabled_check.json') }}"
crc_error_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/crc_error_check.json') }}"
in_rate_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/in_rate_check.json') }}"
- name: validate data using jsonschema engine (invalid data read from file)
ansible.builtin.set_fact:

View File

@ -61,11 +61,11 @@
- name: read data and criteria from file
ansible.builtin.set_fact:
data: "{{ lookup('ansible.builtin.file', 'data/show_interface.json') }}"
oper_status_up_criteria: "{{ lookup('ansible.builtin.file', 'criteria/oper_status_up.json') }}"
enabled_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/enabled_check.json') }}"
crc_error_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/crc_error_check.json') }}"
in_rate_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/in_rate_check.json') }}"
data: "{{ lookup('ansible.builtin.file', 'data/show_interface.json') }}"
oper_status_up_criteria: "{{ lookup('ansible.builtin.file', 'criteria/oper_status_up.json') }}"
enabled_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/enabled_check.json') }}"
crc_error_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/crc_error_check.json') }}"
in_rate_check_criteria: "{{ lookup('ansible.builtin.file', 'criteria/in_rate_check.json') }}"
- name: validate data using jsonschema engine (invalid data read from file)
ansible.builtin.set_fact:
@ -79,7 +79,6 @@
ansible.builtin.set_fact:
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)
ansible.builtin.set_fact:
data_criteria_checks: "{{ data|ansible.utils.validate(in_rate_check_criteria) }}"

View File

@ -23,7 +23,7 @@ show_interfaces:
rate:
in_rate: 0
out_rate: 0
description: '# interface is configures with Ansible'
description: "# interface is configures with Ansible"
duplex_mode: full
enabled: false
line_protocol: up

File diff suppressed because one or more lines are too long