From bffd657d866258bced4ea5ec6cd800e2fb7054e5 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Tue, 24 Feb 2026 16:59:03 +0100 Subject: [PATCH 1/7] Add .ansible-lint Signed-off-by: Alina Buzachis --- .ansible-lint | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .ansible-lint diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 00000000..39b3f0ff --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,4 @@ +--- +profile: production +exclude_paths: + - tests/integration From 37fba3c627e97230db2457cfe69a703008851bdb Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Tue, 24 Feb 2026 18:38:06 +0100 Subject: [PATCH 2/7] Use the correct ansible-lint version Signed-off-by: Alina Buzachis --- .github/workflows/linters.yml | 4 +++- .github/workflows/sanity.yml | 20 ++++++++++++++++++++ tox.ini | 3 +-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 2aa8b9e5..877f7a42 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -17,4 +17,6 @@ jobs: - uses: ansible-network/github_actions/.github/actions/checkout_dependency@main - name: run-ansible-lint - uses: ansible/ansible-lint@v25.1.2 + uses: ansible/ansible-lint@main + with: + gh_action_ref: v25.5.0 diff --git a/.github/workflows/sanity.yml b/.github/workflows/sanity.yml index 75760b5d..06d885a4 100644 --- a/.github/workflows/sanity.yml +++ b/.github/workflows/sanity.yml @@ -33,18 +33,38 @@ jobs: "ansible-version": "milestone", "python-version": "3.10" }, + { + "ansible-version": "stable-2.20", + "python-version": "3.10" + }, + { + "ansible-version": "stable-2.20", + "python-version": "3.11" + }, { "ansible-version": "stable-2.19", "python-version": "3.10" }, + + "ansible-version": "stable-2.19", + "python-version": "3.14" + }, { "ansible-version": "stable-2.18", "python-version": "3.10" }, + { + "ansible-version": "stable-2.18", + "python-version": "3.14" + }, { "ansible-version": "stable-2.17", "python-version": "3.13" }, + { + "ansible-version": "stable-2.17", + "python-version": "3.14" + }, { "ansible-version": "stable-2.16" } diff --git a/tox.ini b/tox.ini index e10d8cc2..c7a1131c 100644 --- a/tox.ini +++ b/tox.ini @@ -3,8 +3,7 @@ minversion = 1.4.2 skipsdist = True [testenv] -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +deps = -r{toxinidir}/test-requirements.txt install_command = pip install {opts} {packages} [testenv:black] From 716089abad19e6d46e6cf9e52447b5a33721972f Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Wed, 25 Feb 2026 17:25:39 +0100 Subject: [PATCH 3/7] Switch to tox Signed-off-by: Alina Buzachis --- .config/ansible-lint.yml | 12 ------- .github/workflows/linters.yml | 8 ----- galaxy.yml | 4 +-- tox.ini | 66 +++++++++++++++++++++++++++-------- 4 files changed, 54 insertions(+), 36 deletions(-) delete mode 100644 .config/ansible-lint.yml diff --git a/.config/ansible-lint.yml b/.config/ansible-lint.yml deleted file mode 100644 index 879a5493..00000000 --- a/.config/ansible-lint.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -profile: production -strict: true -skip_list: - - ignore-errors # Use failed_when and specify error conditions instead of using ignore_errors. - - meta-no-info # meta/main.yml should contain relevant info. - - latest[git] # Result of the command may vary on subsequent runs. - - no-handler # Tasks that run when changed should likely be handlers. - - no-changed-when # Commands should not change things if nothing needs doing. -exclude_paths: - - .ansible/ - - tests/integration diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 877f7a42..093f93b2 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -11,12 +11,4 @@ on: jobs: linters: uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main - ansible-lint: - runs-on: ubuntu-latest - steps: - - uses: ansible-network/github_actions/.github/actions/checkout_dependency@main - - name: run-ansible-lint - uses: ansible/ansible-lint@main - with: - gh_action_ref: v25.5.0 diff --git a/galaxy.yml b/galaxy.yml index d41a243c..695d4a68 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -17,8 +17,8 @@ tags: - infrastructure - cluster dependencies: - amazon.aws: '>=5.1.0' - community.aws: '>=5.0.0' + amazon.aws: '>=10.0.0,<12.0.0-dev0' + community.aws: '>=10.0.0,<12.0.0-dev0' amazon.cloud: '>=0.4.0' community.libvirt: '>=1.2.0' version: 5.0.0-dev0 diff --git a/tox.ini b/tox.ini index c7a1131c..d7cde9fd 100644 --- a/tox.ini +++ b/tox.ini @@ -1,35 +1,73 @@ [tox] -minversion = 1.4.2 +minversion = 4.0 skipsdist = True +[common] +format_dirs = {toxinidir}/plugins {toxinidir}/tests + [testenv] -deps = -r{toxinidir}/test-requirements.txt +deps = -r {toxinidir}/test-requirements.txt install_command = pip install {opts} {packages} -[testenv:black] +[testenv:ansible-lint] +description = Run ansible-lint deps = - black >= 23.0, < 24.0 + ansible-lint == 25.1.2 +commands = ansible-lint +[testenv:black] +description = Lint against "black" formatting standards +deps = + black commands = - black {toxinidir}/plugins {toxinidir}/tests + black --check --diff {[common]format_dirs} -[testenv:ansible-lint] +[testenv:black_format] +description = Apply "black" formatting deps = - ansible-lint >= 25.1.2 -changedir = {toxinidir} + {[testenv:black]deps} commands = - ansible-lint + black -v {[common]format_dirs} -[testenv:linters] +[testenv:flake8] deps = - yamllint flake8 +commands = + flake8 {[common]format_dirs} + +[testenv:isort] +description = Lint for import sorting +deps = + isort +commands = + isort --check-only --diff {[common]format_dirs} + +[testenv:isort_format] +description = Sort imports +deps = + {[testenv:isort]deps} +commands = + isort -v {[common]format_dirs} + +[testenv:format] +deps = {[testenv:black]deps} + {[testenv:isort]deps} +commands = + {[testenv:black]commands} + {[testenv:isort]commands} +[testenv:linters] +deps = + {[testenv:black]deps} + {[testenv:flake8]deps} + {[testenv:isort]deps} + {[testenv:ansible-lint]deps} commands = - black -v --check --diff {toxinidir}/plugins {toxinidir}/tests - yamllint -s {toxinidir} - flake8 {toxinidir} + {[testenv:black]commands} + {[testenv:flake8]commands} + {[testenv:isort]commands} + {[testenv:ansible-lint]commands} [testenv:sanity] deps = ansible From 64a13704dc1a094293a98d930829435303e4b7c6 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Wed, 25 Feb 2026 17:29:28 +0100 Subject: [PATCH 4/7] Re-format using black Signed-off-by: Alina Buzachis --- plugins/modules/validate_network_acls.py | 4 ++-- plugins/modules/validate_route_tables.py | 2 +- plugins/modules/validate_security_group_rules.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/modules/validate_network_acls.py b/plugins/modules/validate_network_acls.py index 007c73ce..c02e6f8f 100644 --- a/plugins/modules/validate_network_acls.py +++ b/plugins/modules/validate_network_acls.py @@ -96,10 +96,10 @@ sample: 'Network ACL validation successful' """ -from ipaddress import ip_network, ip_address from collections import namedtuple -from ansible.module_utils.basic import AnsibleModule +from ipaddress import ip_address, ip_network +from ansible.module_utils.basic import AnsibleModule # NACL Entry format # [ diff --git a/plugins/modules/validate_route_tables.py b/plugins/modules/validate_route_tables.py index 7e8f8da0..a6dbc039 100644 --- a/plugins/modules/validate_route_tables.py +++ b/plugins/modules/validate_route_tables.py @@ -260,8 +260,8 @@ sample: 'Route table validation successful' """ -from ipaddress import ip_network import copy +from ipaddress import ip_network from ansible.module_utils.basic import AnsibleModule diff --git a/plugins/modules/validate_security_group_rules.py b/plugins/modules/validate_security_group_rules.py index fe858bcf..0819ab27 100644 --- a/plugins/modules/validate_security_group_rules.py +++ b/plugins/modules/validate_security_group_rules.py @@ -117,8 +117,8 @@ sample: 'Security Group validation successful' """ -from ipaddress import ip_network, ip_address import copy +from ipaddress import ip_address, ip_network from ansible.module_utils.basic import AnsibleModule From a5e084ab33d2001d00e5eec0fdf6600b15c882fc Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Wed, 25 Feb 2026 17:57:37 +0100 Subject: [PATCH 5/7] Update .ansible-lint --- .ansible-lint | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.ansible-lint b/.ansible-lint index 39b3f0ff..f8e45436 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,4 +1,10 @@ --- profile: production +skip_list: + - ignore-errors # Use failed_when and specify error conditions instead of using ignore_errors. + - meta-no-info # meta/main.yml should contain relevant info. + - latest[git] # Result of the command may vary on subsequent runs. + - no-handler # Tasks that run when changed should likely be handlers. + - no-changed-when # Commands should not change things if nothing needs doing. exclude_paths: - tests/integration From 0da424150d631f39e1ffeac4724832bbc1e605b9 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Wed, 25 Feb 2026 18:04:27 +0100 Subject: [PATCH 6/7] Update tox.ini --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index d7cde9fd..301b3d8b 100644 --- a/tox.ini +++ b/tox.ini @@ -18,7 +18,7 @@ commands = ansible-lint [testenv:black] description = Lint against "black" formatting standards deps = - black + black >= 23.0, < 24.0 commands = black --check --diff {[common]format_dirs} From e4df95360f6e71f483b2708d84e76df8d5e44d04 Mon Sep 17 00:00:00 2001 From: Alina Buzachis Date: Wed, 25 Feb 2026 18:06:26 +0100 Subject: [PATCH 7/7] Update tox.ini --- .ansible-lint | 1 + .github/workflows/linters.yml | 1 - plugins/modules/validate_route_tables.py | 6 +++--- tox.ini | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index f8e45436..6f224691 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -7,4 +7,5 @@ skip_list: - no-handler # Tasks that run when changed should likely be handlers. - no-changed-when # Commands should not change things if nothing needs doing. exclude_paths: + - .ansible/ - tests/integration diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 093f93b2..bf13c4d5 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -11,4 +11,3 @@ on: jobs: linters: uses: ansible-network/github_actions/.github/workflows/tox-linters.yml@main - diff --git a/plugins/modules/validate_route_tables.py b/plugins/modules/validate_route_tables.py index a6dbc039..1438ce5f 100644 --- a/plugins/modules/validate_route_tables.py +++ b/plugins/modules/validate_route_tables.py @@ -137,7 +137,7 @@ interface_id: null network_interface_id: null origin: "CreateRoute" - state": "active" + state: "active" vpc_id: "vpc-0bee28efef41e1de4" dest_vpc_route_tables: - associations: @@ -166,7 +166,7 @@ interface_id: null network_interface_id: null origin: "CreateRoute" - state": "active" + state: "active" vpc_id: "vpc-0bee28efef41e1de4" src_subnets: - assign_ipv6_address_on_creation: false @@ -184,7 +184,7 @@ owner_id: "00000000000" private_dns_name_options_on_launch: enable_resource_name_dns_a_record: false - enable_resource_name_dns_aaaa_record": false + enable_resource_name_dns_aaaa_record: false hostname_type: "ip-name" state: "available" subnet_arn: "arn:aws:ec2:eu-west-2:721066863947:subnet/subnet-0af56e0d353f88cb8" diff --git a/tox.ini b/tox.ini index 301b3d8b..a3b64527 100644 --- a/tox.ini +++ b/tox.ini @@ -12,13 +12,13 @@ install_command = pip install {opts} {packages} [testenv:ansible-lint] description = Run ansible-lint deps = - ansible-lint == 25.1.2 + ansible-lint >= 25.1.2 commands = ansible-lint [testenv:black] description = Lint against "black" formatting standards deps = - black >= 23.0, < 24.0 + black >= 24.0, < 25.0 commands = black --check --diff {[common]format_dirs}