Skip to content

Conversation

@sivakasi-cisco
Copy link
Collaborator

No description provided.

@sivakasi-cisco sivakasi-cisco force-pushed the lint_changes branch 12 times, most recently from e2f2b08 to 5cb44ab Compare November 18, 2025 18:08
@sivakasi-cisco sivakasi-cisco marked this pull request as ready for review November 19, 2025 10:45
@sivakasi-cisco
Copy link
Collaborator Author

This is for the initial set of review. All ansible-lint errors are resolved with this changes.

There are some to-dos

  1. Self- review
  2. UT and IT after changes

- Fixed galaxy.yml license format (string to array)
- Replaced deprecated include with include_tasks
- Removed trailing spaces from all YAML files
- Converted truthy values (yes/no to true/false)
- Added space after # in comments
- Fixed sanity ignore files (removed invalid patterns)
- Added missing task names (179 files)
- Added FQCN prefix to builtin modules
- Fixed free-form set_fact statements
- Applied automated YAML formatting fixes
  1. Schema Violations
    - Replaced deprecated include with ansible.builtin.include_tasks
    - Fixed old-style include directives
  2. Naming Violations
    - Capitalized task names that started with lowercase letters
    - Added names to plays and tasks that were missing them
    - Fixed naming issues
  3. YAML Truthy Violations
    - Converted True/False to lowercase true/false
  4. Indentation Violations
    - Corrected wrong indentation
    - Fixed expected vs found indentation mismatches
  5. YAML Formatting Issues
    - Fixed trailing spaces
    - Removed excessive empty lines
    - Corrected colon spacing
    - Fixed bracket spacing
  6. FQCN Violations
    - Added ansible.builtin prefix to core module calls
    - Applied to include_tasks, set_fact, debug, etc.
  7. Module Docstring YAML Errors
    - Fixed syntax errors
    - Removed excess blank lines in documentation strings
    - Corrected YAML formatting in EXAMPLES sections
  8. Miscellaneous Fixes
    - Fixed no-free-form violations in set_fact calls
    - Corrected var-naming pattern
    - Fixed jinja2 spacing
- Fixed playbooks/roles/dcnm_inventory/dcnm_tests.yml (duplicate name key)
- Fixed dcnm_bootflash tests (filepath list indentation, set_fact indentation, assert indentation)
- Fixed dcnm_image_policy_query.yaml (assert that: block indentation)

Reduced load-failure errors from 127 to 122.
- Fixed playbooks/roles/dcnm_inventory/dcnm_tests.yml (duplicate name key, list format)
- Fixed dcnm_bootflash tests (3 files: filepath indentation, set_fact indentation, assert blocks)
- Fixed dcnm_image_policy_query.yaml (partial: assert that: block indentation)
- Restored dcnm_service_node/tasks/main.yaml (45 lines of version detection logic)

Reduced load-failure errors from 127 to 122.
…nment, config structures - reduced errors 122→111
…ert blocks, and duplicate asserts

- Fixed GitHub workflow indentation (7 errors)
- Fixed 31 files with list item indentation issues
- Fixed 72 files with inline 'that:' after 'assert:'
- Fixed 39 files with malformed assert blocks
- Fixed 39 files with duplicate assert declarations
- Fixed 41 files with tasks wrongly nested under assert blocks
- Manually fixed 7 files (dcnm_image_upgrade, dcnm_inventory, dcnm_links)
- Created 6 automation scripts for systematic fixes
- Progress: Fixed ~200+ errors out of 361 total
- Fixed 22 files with inconsistent assert condition list indentation
- Created fix_assert_condition_indent.py script
- Conditions in assert blocks now have consistent indentation throughout
- Fixes 'did not find expected key' errors in dcnm_vrf, dcnm_service_node, and module_integration tests
- Progress: dcnm_vrf errors reduced from 6 to 2
@sivakasi-cisco sivakasi-cisco force-pushed the lint_changes branch 2 times, most recently from a867a8d to 6b12e22 Compare December 5, 2025 08:26
state: overridden # only choose form [merged, replaced, deleted, overridden, query]
register: result
state: overridden # only choose from [merged, replaced, deleted, overridden, query]
register: initial_override
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variables in this file changed in some cases. For instance, this line result changes to initial_override. Are these fixes you made for this test?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like all of the dcnm_aa_fex* tests changed in a similar way

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it was executed through a generated script, it had been changed from repetitive variable called 'result' to a different one for different responses. Would you like this to be addressed and move to the original?

# "policyNames": [
# "KR5M"
# ],
# ],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, I am fine with these kinds of changes because it's removing extraneous whitespace.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall include this in our conversation

state: overridden # only choose form [merged, replaced, deleted, overridden, query]
register: result
state: overridden
register: setup_result
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More changes to variable names here. Just trying to understand the background on why this was needed.

src: "{{ test_data_interfaces[item ~ '_conf_template'] }}"
dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}"
with_items:
loop:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking but I would feel better if we run one of the test files where you changed to using the loop construct to make sure it works as intended.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@@ -343,13 +343,13 @@
register: result
ignore_errors: yes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran ansible lint locally and still see a few failures. For example it picked up this needing to be a truthy value. Here is the full list I see (not too many left) just a handful

WARNING  Listing 20 violation(s) that are fatal
syntax-check[specific]: the role 'dcnm_bootflash' was not found in cisco.dcnm_collections:ansible.legacy:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_bootflash/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/.ansible/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm/tests/integration/targets:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_bootflash
playbooks/roles/dcnm_bootflash/dcnm_tests.yaml:38:7

syntax-check[specific]: the role 'dcnm_fabric' was not found in cisco.dcnm_collections:ansible.legacy:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_fabric/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/.ansible/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm/tests/integration/targets:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_fabric
playbooks/roles/dcnm_fabric/dcnm_tests.yaml:59:7

syntax-check[specific]: the role 'dcnm_image_policy' was not found in cisco.dcnm_collections:ansible.legacy:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_image_policy/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/.ansible/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm/tests/integration/targets:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_image_policy
playbooks/roles/dcnm_image_policy/dcnm_tests.yaml:41:7

syntax-check[specific]: the role 'dcnm_image_upgrade' was not found in cisco.dcnm_collections:ansible.legacy:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_image_upgrade/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/.ansible/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm/tests/integration/targets:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_image_upgrade
playbooks/roles/dcnm_image_upgrade/dcnm_tests.yaml:47:7

syntax-check[specific]: the role 'dcnm_interface' was not found in cisco.dcnm_collections:ansible.legacy:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_interface/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/.ansible/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm/tests/integration/targets:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_interface
playbooks/roles/dcnm_interface/dcnm_tests.yaml:56:7

syntax-check[specific]: the role 'dcnm_inventory' was not found in cisco.dcnm_collections:ansible.legacy:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_inventory/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/.ansible/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm/tests/integration/targets:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_inventory
playbooks/roles/dcnm_inventory/dcnm_tests.yml:17:7

syntax-check[specific]: the role 'dcnm_maintenance_mode' was not found in cisco.dcnm_collections:ansible.legacy:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_maintenance_mode/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/.ansible/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm/tests/integration/targets:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_maintenance_mode
playbooks/roles/dcnm_maintenance_mode/dcnm_tests.yaml:43:7

syntax-check[specific]: the role 'dcnm_network' was not found in cisco.dcnm_collections:ansible.legacy:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_network/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/.ansible/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm/tests/integration/targets:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_network
playbooks/roles/dcnm_network/dcnm_tests.yaml:78:7

syntax-check[specific]: the role 'dcnm_policy' was not found in cisco.dcnm_collections:ansible.legacy:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_policy/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/.ansible/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm/tests/integration/targets:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_policy
playbooks/roles/dcnm_policy/dcnm_tests.yaml:24:7

syntax-check[specific]: the role 'dcnm_vpc_pair' was not found in cisco.dcnm_collections:ansible.legacy:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_vpc_pair/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/.ansible/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm/tests/integration/targets:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_vpc_pair
playbooks/roles/dcnm_vpc_pair/dcnm_tests.yaml:29:7

syntax-check[specific]: the role 'dcnm_vrf' was not found in cisco.dcnm_collections:ansible.legacy:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_vrf/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/.ansible/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm/tests/integration/targets:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/dcnm_vrf
playbooks/roles/dcnm_vrf/dcnm_tests.yaml:52:7

syntax-check[specific]: the role 'ndfc_interface' was not found in cisco.dcnm_collections:ansible.legacy:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/ndfc_interface/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/.ansible/roles:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm/tests/integration/targets:/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/playbooks/roles/ndfc_interface
playbooks/roles/ndfc_interface/ndfc_tests.yaml:46:7

yaml[line-length]: Line too long (191 > 160 characters)
tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_deleted_specific.yaml:175

yaml[line-length]: Line too long (191 > 160 characters)
tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_deleted_wildcard.yaml:175

yaml[truthy]: Truthy value should be one of [false, true]
tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_merge.yaml:249

yaml[truthy]: Truthy value should be one of [false, true]
tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_merge.yaml:268

yaml[truthy]: Truthy value should be one of [false, true]
tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_merge.yaml:287

yaml[truthy]: Truthy value should be one of [false, true]
tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_merge.yaml:306

yaml[truthy]: Truthy value should be one of [false, true]
tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_merge.yaml:325

yaml[truthy]: Truthy value should be one of [false, true]
tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_merge.yaml:344

Read documentation for instructions on how to ignore specific rule violations.

# Rule Violation Summary

 12 syntax-check profile:min tags:core,unskippable
  2 yaml profile:min tags:formatting,yaml
  6 yaml profile:min tags:formatting,yaml

Failed: 20 failure(s), 0 warning(s) in 843 files processed of 1031 encountered. Profile 'production' was required.
A new release of ansible-lint is available: 25.9.2 → 25.12.0[/] Upgrade by running: pip install --upgrade ansible-lint

Copy link
Collaborator

@mikewiebe mikewiebe Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, all of the syntax-check[specific]: the role 'dcnm_fabric' was not found go away if you set the ANSIBLE_ROLES_PATH environment variable properly.

For example, I set it to

export ANSIBLE_ROLES_PATH=/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/tests/integration/targets

And the tests pass.

We can probably set the environment variable in github actions so it finds the roles properly

My run after setting the env var:

WARNING  Listing 8 violation(s) that are fatal
yaml[line-length]: Line too long (191 > 160 characters)
tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_deleted_specific.yaml:175

yaml[line-length]: Line too long (191 > 160 characters)
tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_deleted_wildcard.yaml:175

yaml[truthy]: Truthy value should be one of [false, true]
tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_merge.yaml:249

yaml[truthy]: Truthy value should be one of [false, true]
tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_merge.yaml:268

yaml[truthy]: Truthy value should be one of [false, true]
tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_merge.yaml:287

yaml[truthy]: Truthy value should be one of [false, true]
tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_merge.yaml:306

yaml[truthy]: Truthy value should be one of [false, true]
tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_merge.yaml:325

yaml[truthy]: Truthy value should be one of [false, true]
tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_merge.yaml:344

Read documentation for instructions on how to ignore specific rule violations.

# Rule Violation Summary

  2 yaml profile:basic tags:formatting,yaml
  6 yaml profile:basic tags:formatting,yaml

Failed: 8 failure(s), 0 warning(s) in 843 files processed of 1031 encountered. Profile 'production' was required, but 'min' profile passed.
A new release of ansible-lint is available: 25.9.2 → 25.12.0[/] Upgrade by running: pip install --upgrade ansible-lint
➜  dcnm_siva git:(lint_changes) ✗ export ANSIBLE_ROLES_PATH=/Users/mwiebe/Projects/Ansible/nac-vxlan/collections/ansible_collections/cisco/dcnm_collections/dcnm_siva/tests/integration/targets

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was surprised to notice this as I had checked all the files but missed this boolean value. It was not flagged probably as you pointed because of the env variable setting. I shall address them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved the boolean requirements with ignore_errors across all files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added a seperate commit on this. And added git action to export the env variable

@mikewiebe
Copy link
Collaborator

@sivakasi-cisco there are conflicts again that need to be resolved in .github/workflows/main.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants