Repository: bridgecrewio/checkov

Issue:
Error when trying to check some ansible files
**Describe the issue**
I have an ansible collection with some roles which I want to inspect using checkov. I found that some ansible files cause checkov to fail. 

**Examples**

The minimal example of such task file is the following:
```yaml
---
- name: This is block
  block:
    - name: This is subblock
      block:
        - name: A task
          debug:
            msg: "Hello"
```

**Exception Trace**
Please share the trace for the exception and all relevant output by checkov.
To maximize the understanding, please run checkov with LOG_LEVEL set to debug
as follows:
```sh
LOG_LEVEL=DEBUG checkov -f ./tasks.yml

2023-02-09 17:04:56,922 [MainThread  ] [DEBUG]  Leveraging the bundled IAM Definition.
2023-02-09 17:04:56,922 [MainThread  ] [DEBUG]  Leveraging the IAM definition at /usr/local/lib/python3.10/site-packages/policy_sentry/shared/data/iam-definition.json
2023-02-09 17:04:57,341 [MainThread  ] [DEBUG]  Adding the IntegrationFeatureRegistry <checkov.common.bridgecrew.integration_features.features.policy_metadata_integration.PolicyMetadataIntegration object at 0x7fd963b691b0> with order 0
2023-02-09 17:04:57,341 [MainThread  ] [DEBUG]  self.features after the sort:
2023-02-09 17:04:57,341 [MainThread  ] [DEBUG]  [<checkov.common.bridgecrew.integration_features.features.policy_metadata_integration.PolicyMetadataIntegration object at 0x7fd963b691b0>]
2023-02-09 17:04:57,341 [MainThread  ] [DEBUG]  Adding the IntegrationFeatureRegistry <checkov.common.bridgecrew.integration_features.features.suppressions_integration.SuppressionsIntegration object at 0x7fd96347c1f0> with order 2
2023-02-09 17:04:57,342 [MainThread  ] [DEBUG]  self.features after the sort:
2023-02-09 17:04:57,342 [MainThread  ] [DEBUG]  [<checkov.common.bridgecrew.integration_features.features.policy_metadata_integration.PolicyMetadataIntegration object at 0x7fd963b691b0>, <checkov.common.bridgecrew.integration_features.features.suppressions_integration.SuppressionsIntegration object at 0x7fd96347c1f0>]
2023-02-09 17:04:57,342 [MainThread  ] [DEBUG]  Adding the IntegrationFeatureRegistry <checkov.common.bridgecrew.integration_features.features.licensing_integration.LicensingIntegration object at 0x7fd96347c730> with order 6
2023-02-09 17:04:57,342 [MainThread  ] [DEBUG]  self.features after the sort:
2023-02-09 17:04:57,342 [MainThread  ] [DEBUG]  [<checkov.common.bridgecrew.integration_features.features.policy_metadata_integration.PolicyMetadataIntegration object at 0x7fd963b691b0>, <checkov.common.bridgecrew.integration_features.features.suppressions_integration.SuppressionsIntegration object at 0x7fd96347c1f0>, <checkov.common.bridgecrew.integration_features.features.licensing_integration.LicensingIntegration object at 0x7fd96347c730>]
2023-02-09 17:04:57,343 [MainThread  ] [DEBUG]  Adding the IntegrationFeatureRegistry <checkov.common.bridgecrew.integration_features.features.custom_policies_integration.CustomPoliciesIntegration object at 0x7fd96347cbe0> with order 1
2023-02-09 17:04:57,343 [MainThread  ] [DEBUG]  self.features after the sort:
2023-02-09 17:04:57,343 [MainThread  ] [DEBUG]  [<checkov.common.bridgecrew.integration_features.features.policy_metadata_integration.PolicyMetadataIntegration object at 0x7fd963b691b0>, <checkov.common.bridgecrew.integration_features.features.custom_policies_integration.CustomPoliciesIntegration object at 0x7fd96347cbe0>, <checkov.common.bridgecrew.integration_features.features.suppressions_integration.SuppressionsIntegration object at 0x7fd96347c1f0>, <checkov.common.bridgecrew.integration_features.features.licensing_integration.LicensingIntegration object at 0x7fd96347c730>]
2023-02-09 17:04:57,343 [MainThread  ] [DEBUG]  Adding the IntegrationFeatureRegistry <checkov.common.bridgecrew.integration_features.features.fixes_integration.FixesIntegration object at 0x7fd96347d0f0> with order 10
2023-02-09 17:04:57,343 [MainThread  ] [DEBUG]  self.features after the sort:
2023-02-09 17:04:57,343 [MainThread  ] [DEBUG]  [<checkov.common.bridgecrew.integration_features.features.policy_metadata_integration.PolicyMetadataIntegration object at 0x7fd963b691b0>, <checkov.common.bridgecrew.integration_features.features.custom_policies_integration.CustomPoliciesIntegration object at 0x7fd96347cbe0>, <checkov.common.bridgecrew.integration_features.features.suppressions_integration.SuppressionsIntegration object at 0x7fd96347c1f0>, <checkov.common.bridgecrew.integration_features.features.licensing_integration.LicensingIntegration object at 0x7fd96347c730>, <checkov.common.bridgecrew.integration_features.features.fixes_integration.FixesIntegration object at 0x7fd96347d0f0>]
2023-02-09 17:04:57,343 [MainThread  ] [DEBUG]  Adding the IntegrationFeatureRegistry <checkov.common.bridgecrew.integration_features.features.repo_config_integration.RepoConfigIntegration object at 0x7fd96347d570> with order 0
2023-02-09 17:04:57,343 [MainThread  ] [DEBUG]  self.features after the sort:
2023-02-09 17:04:57,343 [MainThread  ] [DEBUG]  [<checkov.common.bridgecrew.integration_features.features.policy_metadata_integration.PolicyMetadataIntegration object at 0x7fd963b691b0>, <checkov.common.bridgecrew.integration_features.features.repo_config_integration.RepoConfigIntegration object at 0x7fd96347d570>, <checkov.common.bridgecrew.integration_features.features.custom_policies_integration.CustomPoliciesIntegration object at 0x7fd96347cbe0>, <checkov.common.bridgecrew.integration_features.features.suppressions_integration.SuppressionsIntegration object at 0x7fd96347c1f0>, <checkov.common.bridgecrew.integration_features.features.licensing_integration.LicensingIntegration object at 0x7fd96347c730>, <checkov.common.bridgecrew.integration_features.features.fixes_integration.FixesIntegration object at 0x7fd96347d0f0>]
2023-02-09 17:04:57,344 [MainThread  ] [DEBUG]  Adding the IntegrationFeatureRegistry <checkov.common.bridgecrew.integration_features.features.policies_3d_integration.Policies3DIntegration object at 0x7fd96347da80> with order 11
2023-02-09 17:04:57,344 [MainThread  ] [DEBUG]  self.features after the sort:
2023-02-09 17:04:57,344 [MainThread  ] [DEBUG]  [<checkov.common.bridgecrew.integration_features.features.policy_metadata_integration.PolicyMetadataIntegration object at 0x7fd963b691b0>, <checkov.common.bridgecrew.integration_features.features.repo_config_integration.RepoConfigIntegration object at 0x7fd96347d570>, <checkov.common.bridgecrew.integration_features.features.custom_policies_integration.CustomPoliciesIntegration object at 0x7fd96347cbe0>, <checkov.common.bridgecrew.integration_features.features.suppressions_integration.SuppressionsIntegration object at 0x7fd96347c1f0>, <checkov.common.bridgecrew.integration_features.features.licensing_integration.LicensingIntegration object at 0x7fd96347c730>, <checkov.common.bridgecrew.integration_features.features.fixes_integration.FixesIntegration object at 0x7fd96347d0f0>, <checkov.common.bridgecrew.integration_features.features.policies_3d_integration.Policies3DIntegration object at 0x7fd96347da80>]
2023-02-09 17:04:57,364 [MainThread  ] [DEBUG]  Loading external checks from /usr/local/lib/python3.10/site-packages/checkov/bicep/checks/graph_checks
2023-02-09 17:04:57,364 [MainThread  ] [DEBUG]  Searching through ['__pycache__'] and ['__init__.py', 'SQLServerAuditingEnabled.yaml']
2023-02-09 17:04:57,367 [MainThread  ] [DEBUG]  Searching through [] and ['__init__.cpython-310.pyc']
2023-02-09 17:04:57,437 [MainThread  ] [DEBUG]  Popen(['git', 'version'], cwd=/src, universal_newlines=False, shell=None, istream=None)
2023-02-09 17:04:57,438 [MainThread  ] [DEBUG]  Popen(['git', 'version'], cwd=/src, universal_newlines=False, shell=None, istream=None)
2023-02-09 17:04:57,976 [MainThread  ] [DEBUG]  No API key present; setting include_all_checkov_policies to True
2023-02-09 17:04:57,977 [MainThread  ] [DEBUG]  Run metadata: {
  "checkov_version": "2.3.2",
  "python_executable": "/usr/local/bin/python",
  "python_version": "3.10.10 (main, Feb  9 2023, 05:30:13) [GCC 10.2.1 20210110]",
  "checkov_executable": "/usr/local/bin/checkov",
  "args": [
    "Command Line Args:   -f ./tasks.yml",
    "Defaults:",
    "  --framework:       ['all']",
    "  --branch:          master",
    "  --download-external-modules:False",
    "  --external-modules-download-path:.external_modules",
    "  --evaluate-variables:True",
    "  --secrets-scan-file-type:[]",
    "  --block-list-secret-scan:[]",
    "  --summary-position:top",
    "  --mask:            []",
    ""
  ],
  "OS_system_info": "Linux-6.1.10-arch1-1-x86_64-with-glibc2.31",
  "CPU_architecture": "",
  "Python_implementation": "CPython"
}
2023-02-09 17:04:57,977 [MainThread  ] [DEBUG]  Resultant set of frameworks (removing skipped frameworks): all
2023-02-09 17:04:57,977 [MainThread  ] [DEBUG]  BC_SOURCE = cli, version = 2.3.2
2023-02-09 17:04:57,977 [MainThread  ] [DEBUG]  terraform_runner declares no system dependency checks required.
2023-02-09 17:04:57,977 [MainThread  ] [DEBUG]  cloudformation_runner declares no system dependency checks required.
2023-02-09 17:04:57,978 [MainThread  ] [DEBUG]  kubernetes_runner declares no system dependency checks required.
2023-02-09 17:04:57,978 [MainThread  ] [DEBUG]  serverless_runner declares no system dependency checks required.
2023-02-09 17:04:57,978 [MainThread  ] [DEBUG]  arm_runner declares no system dependency checks required.
2023-02-09 17:04:57,978 [MainThread  ] [DEBUG]  terraform_plan_runner declares no system dependency checks required.
2023-02-09 17:04:57,978 [MainThread  ] [INFO ]  Checking necessary system dependancies for helm checks.
2023-02-09 17:04:57,993 [MainThread  ] [INFO ]  Found working version of helm dependancies: v3.11.1
2023-02-09 17:04:57,993 [MainThread  ] [DEBUG]  dockerfile_runner declares no system dependency checks required.
2023-02-09 17:04:57,993 [MainThread  ] [DEBUG]  secrets_runner declares no system dependency checks required.
2023-02-09 17:04:57,993 [MainThread  ] [DEBUG]  json_runner declares no system dependency checks required.
2023-02-09 17:04:57,993 [MainThread  ] [DEBUG]  yaml_runner declares no system dependency checks required.
2023-02-09 17:04:57,993 [MainThread  ] [DEBUG]  github_configuration_runner declares no system dependency checks required.
2023-02-09 17:04:57,993 [MainThread  ] [DEBUG]  gitlab_configuration_runner declares no system dependency checks required.
2023-02-09 17:04:57,993 [MainThread  ] [DEBUG]  gitlab_ci_runner declares no system dependency checks required.
2023-02-09 17:04:57,993 [MainThread  ] [DEBUG]  bitbucket_configuration_runner declares no system dependency checks required.
2023-02-09 17:04:57,993 [MainThread  ] [DEBUG]  bitbucket_pipelines_runner declares no system dependency checks required.
2023-02-09 17:04:57,993 [MainThread  ] [INFO ]  Checking necessary system dependancies for kustomize checks.
2023-02-09 17:04:57,996 [MainThread  ] [INFO ]  Found working version of kustomize dependency kustomize: v5.0.0
2023-02-09 17:04:57,996 [MainThread  ] [DEBUG]  github_actions_runner declares no system dependency checks required.
2023-02-09 17:04:57,996 [MainThread  ] [DEBUG]  bicep_runner declares no system dependency checks required.
2023-02-09 17:04:57,996 [MainThread  ] [DEBUG]  openapi_runner declares no system dependency checks required.
2023-02-09 17:04:57,996 [MainThread  ] [DEBUG]  sca_image_runner declares no system dependency checks required.
2023-02-09 17:04:57,997 [MainThread  ] [DEBUG]  argo_workflows_runner declares no system dependency checks required.
2023-02-09 17:04:57,997 [MainThread  ] [DEBUG]  circleci_pipelines_runner declares no system dependency checks required.
2023-02-09 17:04:57,997 [MainThread  ] [DEBUG]  azure_pipelines_runner declares no system dependency checks required.
2023-02-09 17:04:57,997 [MainThread  ] [DEBUG]  ansible_runner declares no system dependency checks required.
2023-02-09 17:04:57,997 [MainThread  ] [DEBUG]  sca_package_runner declares no system dependency checks required.
2023-02-09 17:04:57,997 [MainThread  ] [DEBUG]  No API key found. Scanning locally only.
2023-02-09 17:05:02,565 [MainThread  ] [DEBUG]  Got checkov mappings and guidelines from Bridgecrew platform
2023-02-09 17:05:02,567 [MainThread  ] [DEBUG]  Loading external checks from /usr/local/lib/python3.10/site-packages/checkov/terraform/checks/graph_checks
2023-02-09 17:05:02,567 [MainThread  ] [DEBUG]  Searching through ['gcp', 'aws', '__pycache__', 'azure'] and ['__init__.py']
2023-02-09 17:05:02,568 [MainThread  ] [DEBUG]  Searching through [] and ['CloudFunctionSecureHTTPTrigger.yaml', 'DisableAccessToSqlDBInstanceForRootUsersWithoutPassword.yaml', 'GCPKMSCryptoKeysAreNotPubliclyAccessible.yaml', 'GKEClustersAreNotUsingDefaultServiceAccount.yaml', 'GCPContainerRegistryReposAreNotPubliclyAccessible.yaml', 'GCRContainerVulnerabilityScanningEnabled.yaml', 'GCPPostgreSQLDatabaseFlaglog_parser_statsIsSetToOFF.yaml', 'GCPComputeFirewallOverlyPermissiveToAllTraffic.yaml', 'GCPPostgreSQLDatabaseFlaglog_durationIsSetToON.yaml', 'GCPNetworkDoesNotUseDefaultFirewall.yaml', 'GCPKMSKeyRingsAreNotPubliclyAccessible.yaml', 'GCPPostgreSQLDatabaseFlaglog_planner_statsIsSetToOFF.yaml', 'GCPPostgreSQLDatabaseFlaglog_executor_statsIsSetToOFF.yaml', 'GCPAuditLogsConfiguredForAllServicesAndUsers.yaml', 'GCPProjectHasNoLegacyNetworks.yaml', 'GCPLogBucketsConfiguredUsingLock.yaml', 'GCPPostgreSQLDatabaseFlaglog_statement_statsIsSetToOFF.yaml', 'ServiceAccountHasGCPmanagedKey.yaml']
2023-02-09 17:05:02,601 [MainThread  ] [DEBUG]  Searching through [] and ['S3BucketEncryption.yaml', 'PostgresDBHasQueryLoggingEnabled.yaml', 'VPCHasRestrictedSG.yaml', 'EBSAddedBackup.yaml', 'IAMManagedIAMFullAccessPolicy.yaml', 'GuardDutyIsEnabled.yaml', 'CloudFrontUsesSecureProtocolsForHTTPS.yaml', 'AutoScalingEnableOnDynamoDBTables.yaml', 'IAMUsersAreMembersAtLeastOneGroup.yaml', 'IAMPolicyNotAllowFullIAMAccess.yaml', 'AppLoadBalancerTLS12.yaml', 'DMSEndpointHaveSSLConfigured.yaml', 'CloudFrontHasCustomSSLCertificate.yaml', 'EncryptedEBSVolumeOnlyConnectedToEC2s.yaml', 'ElastiCacheRedisConfiguredAutomaticFailOver.yaml', 'ALBRedirectsHTTPToHTTPS.yaml', 'S3BucketHasPublicAccessBlock.yaml', 'HTTPNotSendingPasswords.yaml', 'S3BucketVersioning.yaml', 'WAF2HasLogs.yaml', 'S3BucketLogging.yaml', 'Route53ZoneEnableDNSSECSigning.yaml', 'APIGatewayEndpointsUsesCertificateForAuthentication.yaml', 'EMRClusterHasSecurityConfiguration.yaml', 'SubnetHasACL.yaml', 'Route53ZoneHasMatchingQueryLog.yaml', 'VPCHasFlowLog.yaml', 'AWSNATGatewaysshouldbeutilized.yaml', 'PostgresRDSHasQueryLoggingEnabled.yaml', 'RDSClusterHasBackupPlan.yaml', 'ALBProtectedByWAF.yaml', 'S3NotAllowAccessToAllAuthenticatedUsers.yaml', 'APIGatewayRequestParameterValidationEnabled.yaml', 'S3PublicACLWrite.yaml', 'AutoScallingEnabledELB.yaml', 'CloudFrontHasResponseHeadersPolicy.yaml', 'S3PublicACLRead.yaml', 'EIPAllocatedToVPCAttachedEC2.yaml', 'CLoudFrontS3OriginConfigWithOAI.yaml', 'SGAttachedToResource.yaml', 'IAMGroupHasAtLeastOneUser.yaml', 'CloudFrontWebACLConfiguredWIthLog4jVulnerability.yaml', 'IAMUserHasNoConsoleAccess.yaml', 'AWSConfigRecorderEnabled.yaml', 'OpenSearchDomainHasFineGrainedControl.yaml', 'NeptuneDeletionProtectionEnabled.yaml', 'AppSyncProtectedByWAF.yaml', 'EC2InstanceHasIAMRoleAttached.yaml', 'CloudtrailHasCloudwatch.yaml', 'EFSAddedBackup.yaml', 'ConfigRecorderRecordsAllGlobalResources.yaml', 'APIProtectedByWAF.yaml', 'Route53ARecordAttachedResource.yaml', 'S3BucketReplicationConfiguration.yaml', 'CodecommitApprovalRulesAttached.yaml', 'S3KMSEncryptedByDefault.yaml', 'AMRClustersNotOpenToInternet.yaml', 'APIGWLoggingLevelsDefinedProperly.yaml', 'AWSSSMParameterShouldBeEncrypted.yaml', 'VPCPeeringRouteTableOverlyPermissive.yaml']
2023-02-09 17:05:02,698 [MainThread  ] [DEBUG]  Searching through [] and ['__init__.cpython-310.pyc']
2023-02-09 17:05:02,698 [MainThread  ] [DEBUG]  Searching through [] and ['VirtualMachinesUtilizingManagedDisks.yaml', 'VAconfiguredToSendReports.yaml', 'StorageCriticalDataEncryptedCMK.yaml', 'StorageLoggingIsEnabledForTableService.yaml', 'CognitiveServicesCustomerManagedKey.yaml', 'AccessToPostgreSQLFromAzureServicesIsDisabled.yaml', 'VAsetPeriodicScansOnSQL.yaml', 'ApplicationGatewayEnablesWAF.yaml', 'VAconfiguredToSendReportsToAdmins.yaml', 'MSQLenablesCustomerManagedKey.yaml', 'AzureNetworkInterfacePublicIPAddressId.yaml', 'AzureActiveDirectoryAdminIsConfigured.yaml', 'StorageContainerActivityLogsNotPublic.yaml', 'AzureAntimalwareIsConfiguredWithAutoUpdatesForVMs.yaml', 'VMHasBackUpMachine.yaml', 'AzureUnattachedDisksAreEncrypted.yaml', 'StorageLoggingIsEnabledForBlobService.yaml', 'SQLServerAuditingRetention90Days.yaml', 'DataExplorerEncryptionUsesCustomKey.yaml', 'SQLServerAuditingEnabled.yaml', 'AzureStorageAccountsUseCustomerManagedKeyForEncryption.yaml', 'AzureDataFactoriesEncryptedWithCustomerManagedKey.yaml', 'PGSQLenablesCustomerManagedKey.yaml', 'AzureMSSQLServerHasSecurityAlertPolicy.yaml', 'AzureSynapseWorkspacesHaveNoIPFirewallRulesAttached.yaml', 'VAisEnabledInStorageAccount.yaml']
2023-02-09 17:05:02,733 [MainThread  ] [DEBUG]  Loading external checks from /usr/local/lib/python3.10/site-packages/checkov/cloudformation/checks/graph_checks
2023-02-09 17:05:02,733 [MainThread  ] [DEBUG]  Searching through ['__pycache__'] and ['__init__.py']
2023-02-09 17:05:02,734 [MainThread  ] [DEBUG]  Searching through [] and ['__init__.cpython-310.pyc']
2023-02-09 17:05:02,734 [MainThread  ] [DEBUG]  Loading external checks from /usr/local/lib/python3.10/site-packages/checkov/kubernetes/checks/graph_checks
2023-02-09 17:05:02,734 [MainThread  ] [DEBUG]  Searching through ['__pycache__'] and ['__init__.py', 'NoCreateNodesProxyOrPodsExec.yaml', 'ReadAllSecrets.yaml', 'ModifyServicesStatus.yaml', 'RoleBindingPE.yaml', 'RequireAllPodsToHaveNetworkPolicy.yaml', 'ImpersonatePermissions.yaml']
2023-02-09 17:05:02,748 [MainThread  ] [DEBUG]  Searching through [] and ['__init__.cpython-310.pyc']
2023-02-09 17:05:02,748 [MainThread  ] [DEBUG]  Loading external checks from /usr/local/lib/python3.10/site-packages/checkov/bicep/checks/graph_checks
2023-02-09 17:05:02,748 [MainThread  ] [DEBUG]  Searching through ['__pycache__'] and ['__init__.py', 'SQLServerAuditingEnabled.yaml']
2023-02-09 17:05:02,750 [MainThread  ] [DEBUG]  Searching through [] and ['__init__.cpython-310.pyc']
2023-02-09 17:05:02,750 [MainThread  ] [DEBUG]  Loading external checks from /usr/local/lib/python3.10/site-packages/checkov/terraform_plan/checks/graph_checks
2023-02-09 17:05:02,752 [MainThread  ] [DEBUG]  Running without API key, so only open source runners will be enabled
2023-02-09 17:05:02,752 [MainThread  ] [DEBUG]  Filtered list of policies: []
2023-02-09 17:05:02,752 [MainThread  ] [DEBUG]  Received the following policy-level suppressions, that will be skipped from running: []
2023-02-09 17:05:02,752 [MainThread  ] [DEBUG]  Filtered runners based on file type(s). Result: ['cloudformation', 'kubernetes', 'secrets', 'yaml', 'gitlab_ci', 'bitbucket_pipelines', 'github_actions', 'openapi', 'argo_workflows', 'circleci_pipelines', 'azure_pipelines', 'ansible']
2023-02-09 17:05:02,752 [MainThread  ] [DEBUG]  Checking if cloudformation is valid for license
2023-02-09 17:05:02,752 [MainThread  ] [DEBUG]  Open source mode - the runner is enabled
2023-02-09 17:05:02,752 [MainThread  ] [DEBUG]  Checking if kubernetes is valid for license
2023-02-09 17:05:02,752 [MainThread  ] [DEBUG]  Open source mode - the runner is enabled
2023-02-09 17:05:02,752 [MainThread  ] [DEBUG]  Checking if secrets is valid for license
2023-02-09 17:05:02,752 [MainThread  ] [DEBUG]  Open source mode - the runner is enabled
2023-02-09 17:05:02,752 [MainThread  ] [DEBUG]  Checking if yaml is valid for license
2023-02-09 17:05:02,753 [MainThread  ] [DEBUG]  Open source mode - the runner is enabled
2023-02-09 17:05:02,753 [MainThread  ] [DEBUG]  Checking if gitlab_ci is valid for license
2023-02-09 17:05:02,753 [MainThread  ] [DEBUG]  Open source mode - the runner is enabled
2023-02-09 17:05:02,753 [MainThread  ] [DEBUG]  Checking if bitbucket_pipelines is valid for license
2023-02-09 17:05:02,753 [MainThread  ] [DEBUG]  Open source mode - the runner is enabled
2023-02-09 17:05:02,753 [MainThread  ] [DEBUG]  Checking if github_actions is valid for license
2023-02-09 17:05:02,753 [MainThread  ] [DEBUG]  Open source mode - the runner is enabled
2023-02-09 17:05:02,753 [MainThread  ] [DEBUG]  Checking if openapi is valid for license
2023-02-09 17:05:02,753 [MainThread  ] [DEBUG]  Open source mode - the runner is enabled
2023-02-09 17:05:02,753 [MainThread  ] [DEBUG]  Checking if argo_workflows is valid for license
2023-02-09 17:05:02,753 [MainThread  ] [DEBUG]  Open source mode - the runner is enabled
2023-02-09 17:05:02,753 [MainThread  ] [DEBUG]  Checking if circleci_pipelines is valid for license
2023-02-09 17:05:02,753 [MainThread  ] [DEBUG]  Open source mode - the runner is enabled
2023-02-09 17:05:02,753 [MainThread  ] [DEBUG]  Checking if azure_pipelines is valid for license
2023-02-09 17:05:02,753 [MainThread  ] [DEBUG]  Open source mode - the runner is enabled
2023-02-09 17:05:02,753 [MainThread  ] [DEBUG]  Checking if ansible is valid for license
2023-02-09 17:05:02,754 [MainThread  ] [DEBUG]  Open source mode - the runner is enabled
2023-02-09 17:05:02,765 [MainThread  ] [DEBUG]  File tasks.yml is expected to be a CFN template but has no Resources attribute
2023-02-09 17:05:02,765 [MainThread  ] [DEBUG]  Parsed file ./tasks.yml incorrectly {}
2023-02-09 17:05:02,766 [MainThread  ] [INFO ]  creating CloudFormation graph
2023-02-09 17:05:02,766 [MainThread  ] [INFO ]  [CloudformationLocalGraph] created 0 vertices
2023-02-09 17:05:02,766 [MainThread  ] [INFO ]  [CloudformationLocalGraph] created 0 edges
2023-02-09 17:05:02,766 [MainThread  ] [INFO ]  Rendering variables, graph has 0 vertices and 0 edges
2023-02-09 17:05:02,766 [MainThread  ] [DEBUG]  done evaluating edges
2023-02-09 17:05:02,766 [MainThread  ] [DEBUG]  done evaluate_non_rendered_values
2023-02-09 17:05:02,766 [MainThread  ] [INFO ]  Successfully created CloudFormation graph
2023-02-09 17:05:02,767 [MainThread  ] [DEBUG]  Loading external checks from /usr/local/lib/python3.10/site-packages/checkov/cloudformation/checks/graph_checks
2023-02-09 17:05:02,767 [MainThread  ] [DEBUG]  Searching through ['__pycache__'] and ['__init__.py']
2023-02-09 17:05:02,767 [MainThread  ] [INFO ]  Custom detector found at /usr/local/lib/python3.10/site-packages/checkov/secrets/plugins/custom_regex_detector.py. Loading...
2023-02-09 17:05:02,767 [MainThread  ] [DEBUG]  Searching through [] and ['__init__.cpython-310.pyc']
2023-02-09 17:05:02,768 [MainThread  ] [INFO ]  creating Kubernetes graph
2023-02-09 17:05:02,768 [MainThread  ] [INFO ]  Successfully created Kubernetes graph
2023-02-09 17:05:02,768 [MainThread  ] [INFO ]  Secrets scanning will scan 1 files
2023-02-09 17:05:02,769 [MainThread  ] [DEBUG]  Loading external checks from /usr/local/lib/python3.10/site-packages/checkov/kubernetes/checks/graph_checks
2023-02-09 17:05:02,769 [MainThread  ] [DEBUG]  Searching through ['__pycache__'] and ['__init__.py', 'NoCreateNodesProxyOrPodsExec.yaml', 'ReadAllSecrets.yaml', 'ModifyServicesStatus.yaml', 'RoleBindingPE.yaml', 'RequireAllPodsToHaveNetworkPolicy.yaml', 'ImpersonatePermissions.yaml']
2023-02-09 17:05:02,769 [MainThread  ] [DEBUG]  The runner requires that external checks are defined.
2023-02-09 17:05:02,782 [MainThread  ] [INFO ]  Creating GitHubActions graph
2023-02-09 17:05:02,782 [MainThread  ] [DEBUG]  [GitHubActionsLocalGraph] created 0 vertices
2023-02-09 17:05:02,782 [MainThread  ] [DEBUG]  [GitHubActionsLocalGraph] created 0 edges
2023-02-09 17:05:02,782 [MainThread  ] [INFO ]  Successfully created GitHubActions graph
2023-02-09 17:05:02,783 [MainThread  ] [DEBUG]  Loading external checks from /usr/local/lib/python3.10/site-packages/checkov/github_actions/checks/graph_checks
2023-02-09 17:05:02,783 [MainThread  ] [DEBUG]  Searching through ['__pycache__'] and ['__init__.py', 'ReadOnlyTopLevelPermissions.yaml']
2023-02-09 17:05:02,785 [MainThread  ] [DEBUG]  Searching through [] and ['__init__.cpython-310.pyc']
2023-02-09 17:05:02,785 [MainThread  ] [DEBUG]  skip_severity = None, explicit_skip = [], regex_match = False, suppressed_policies: []
2023-02-09 17:05:02,785 [MainThread  ] [DEBUG]  bc_check_id = None, include_all_checkov_policies = True, is_external = False, explicit_run: []
2023-02-09 17:05:02,785 [MainThread  ] [DEBUG]  should_run_check CKV2_GHA_1: True
2023-02-09 17:05:02,789 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_GHA_1
2023-02-09 17:05:02,790 [MainThread  ] [DEBUG]  Searching through [] and ['__init__.cpython-310.pyc']
2023-02-09 17:05:02,791 [MainThread  ] [DEBUG]  skip_severity = None, explicit_skip = [], regex_match = False, suppressed_policies: []
2023-02-09 17:05:02,791 [MainThread  ] [DEBUG]  bc_check_id = BC_K8S_116, include_all_checkov_policies = True, is_external = False, explicit_run: []
2023-02-09 17:05:02,791 [MainThread  ] [DEBUG]  should_run_check CKV2_K8S_2: True
2023-02-09 17:05:02,791 [MainThread  ] [DEBUG]  skip_severity = None, explicit_skip = [], regex_match = False, suppressed_policies: []
2023-02-09 17:05:02,791 [MainThread  ] [DEBUG]  bc_check_id = BC_K8S_119, include_all_checkov_policies = True, is_external = False, explicit_run: []
2023-02-09 17:05:02,791 [MainThread  ] [DEBUG]  should_run_check CKV2_K8S_5: True
2023-02-09 17:05:02,791 [MainThread  ] [DEBUG]  skip_severity = None, explicit_skip = [], regex_match = False, suppressed_policies: []
2023-02-09 17:05:02,791 [MainThread  ] [DEBUG]  bc_check_id = BC_K8S_118, include_all_checkov_policies = True, is_external = False, explicit_run: []
2023-02-09 17:05:02,791 [MainThread  ] [DEBUG]  should_run_check CKV2_K8S_4: True
2023-02-09 17:05:02,791 [MainThread  ] [DEBUG]  skip_severity = None, explicit_skip = [], regex_match = False, suppressed_policies: []
2023-02-09 17:05:02,791 [MainThread  ] [DEBUG]  bc_check_id = BC_K8S_115, include_all_checkov_policies = True, is_external = False, explicit_run: []
2023-02-09 17:05:02,791 [MainThread  ] [DEBUG]  should_run_check CKV2_K8S_1: True
2023-02-09 17:05:02,791 [MainThread  ] [DEBUG]  skip_severity = None, explicit_skip = [], regex_match = False, suppressed_policies: []
2023-02-09 17:05:02,791 [MainThread  ] [DEBUG]  bc_check_id = None, include_all_checkov_policies = True, is_external = False, explicit_run: []
2023-02-09 17:05:02,791 [MainThread  ] [DEBUG]  should_run_check CKV2_K8S_6: True
2023-02-09 17:05:02,791 [MainThread  ] [DEBUG]  skip_severity = None, explicit_skip = [], regex_match = False, suppressed_policies: []
2023-02-09 17:05:02,792 [MainThread  ] [DEBUG]  bc_check_id = BC_K8S_117, include_all_checkov_policies = True, is_external = False, explicit_run: []
2023-02-09 17:05:02,792 [MainThread  ] [DEBUG]  should_run_check CKV2_K8S_3: True
2023-02-09 17:05:02,792 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_K8S_2
2023-02-09 17:05:02,793 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_K8S_5
2023-02-09 17:05:02,793 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_K8S_4
2023-02-09 17:05:02,793 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_K8S_3
2023-02-09 17:05:02,793 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_K8S_1
2023-02-09 17:05:02,793 [ThreadPoolEx] [DEBUG]  Running graph check: CKV2_K8S_6
2023-02-09 17:05:02,802 [MainThread  ] [INFO ]  Creating Ansible graph
2023-02-09 17:05:02,803 [MainThread  ] [ERROR]  Failed to invoke function /usr/local/lib/python3.10/site-packages/checkov/common/runners/runner_registry._parallel_run with <checkov.ansible.runner.Runner object at 0x7fd96276ee60>
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/checkov/common/parallelizer/parallel_runner.py", line 39, in func_wrapper
    result = original_func(item)
  File "/usr/local/lib/python3.10/site-packages/checkov/common/runners/runner_registry.py", line 103, in _parallel_run
    report = runner.run(
  File "/usr/local/lib/python3.10/site-packages/checkov/common/runners/object_runner.py", line 136, in run
    local_graph = self.graph_manager.build_graph_from_definitions(
  File "/usr/local/lib/python3.10/site-packages/checkov/common/runners/graph_manager.py", line 39, in build_graph_from_definitions
    local_graph.build_graph(render_variables)
  File "/usr/local/lib/python3.10/site-packages/checkov/common/runners/graph_builder/local_graph.py", line 21, in build_graph
    self._create_vertices()
  File "/usr/local/lib/python3.10/site-packages/checkov/ansible/graph_builder/local_graph.py", line 37, in _create_vertices
    self._process_blocks(file_path=file_path, task=code_block)
  File "/usr/local/lib/python3.10/site-packages/checkov/ansible/graph_builder/local_graph.py", line 49, in _process_blocks
    self._create_tasks_vertices(file_path=file_path, task=block_task)
  File "/usr/local/lib/python3.10/site-packages/checkov/ansible/graph_builder/local_graph.py", line 77, in _create_tasks_vertices
    attributes[CustomAttributes.RESOURCE_TYPE] = resource_type
TypeError: list indices must be integers or slices, not str
2023-02-09 17:05:02,811 [MainThread  ] [INFO ]  file ./tasks.yml results len 0
2023-02-09 17:05:02,812 [MainThread  ] [DEBUG]  One of enriched secrets, repo path, or bucket are empty, aborting. values:enriched_secrets=Empty, repo_path=None, bucket=None
2023-02-09 17:05:02,812 [MainThread  ] [DEBUG]  report fail checks len: 0
2023-02-09 17:05:02,813 [MainThread  ] [DEBUG]  Getting exit code for report cloudformation
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Soft fail severity threshold: None
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Soft fail checks: []
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Hard fail severity threshold: None
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Hard fail checks: []
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Use enforcement rules is FALSE
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  In get_exit_code; exit code thresholds: {'soft_fail': False, 'soft_fail_checks': [], 'soft_fail_threshold': None, 'hard_fail_checks': [], 'hard_fail_threshold': None}, hard_fail_on_parsing_errors: False
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  No failed checks, or soft_fail is True and soft_fail_on and hard_fail_on are empty - returning 0
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Getting exit code for report kubernetes
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Soft fail severity threshold: None
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Soft fail checks: []
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Hard fail severity threshold: None
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Hard fail checks: []
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Use enforcement rules is FALSE
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  In get_exit_code; exit code thresholds: {'soft_fail': False, 'soft_fail_checks': [], 'soft_fail_threshold': None, 'hard_fail_checks': [], 'hard_fail_threshold': None}, hard_fail_on_parsing_errors: False
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  No failed checks, or soft_fail is True and soft_fail_on and hard_fail_on are empty - returning 0
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Getting exit code for report secrets
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Soft fail severity threshold: None
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Soft fail checks: []
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Hard fail severity threshold: None
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Hard fail checks: []
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Use enforcement rules is FALSE
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  In get_exit_code; exit code thresholds: {'soft_fail': False, 'soft_fail_checks': [], 'soft_fail_threshold': None, 'hard_fail_checks': [], 'hard_fail_threshold': None}, hard_fail_on_parsing_errors: False
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  No failed checks, or soft_fail is True and soft_fail_on and hard_fail_on are empty - returning 0
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Getting exit code for report yaml
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Soft fail severity threshold: None
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Soft fail checks: []
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Hard fail severity threshold: None
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Hard fail checks: []
2023-02-09 17:05:02,814 [MainThread  ] [DEBUG]  Use enforcement rules is FALSE
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  In get_exit_code; exit code thresholds: {'soft_fail': False, 'soft_fail_checks': [], 'soft_fail_threshold': None, 'hard_fail_checks': [], 'hard_fail_threshold': None}, hard_fail_on_parsing_errors: False
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  No failed checks, or soft_fail is True and soft_fail_on and hard_fail_on are empty - returning 0
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Getting exit code for report gitlab_ci
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Soft fail severity threshold: None
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Soft fail checks: []
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Hard fail severity threshold: None
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Hard fail checks: []
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Use enforcement rules is FALSE
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  In get_exit_code; exit code thresholds: {'soft_fail': False, 'soft_fail_checks': [], 'soft_fail_threshold': None, 'hard_fail_checks': [], 'hard_fail_threshold': None}, hard_fail_on_parsing_errors: False
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  No failed checks, or soft_fail is True and soft_fail_on and hard_fail_on are empty - returning 0
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Getting exit code for report bitbucket_pipelines
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Soft fail severity threshold: None
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Soft fail checks: []
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Hard fail severity threshold: None
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Hard fail checks: []
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Use enforcement rules is FALSE
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  In get_exit_code; exit code thresholds: {'soft_fail': False, 'soft_fail_checks': [], 'soft_fail_threshold': None, 'hard_fail_checks': [], 'hard_fail_threshold': None}, hard_fail_on_parsing_errors: False
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  No failed checks, or soft_fail is True and soft_fail_on and hard_fail_on are empty - returning 0
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Getting exit code for report github_actions
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Soft fail severity threshold: None
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Soft fail checks: []
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Hard fail severity threshold: None
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Hard fail checks: []
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Use enforcement rules is FALSE
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  In get_exit_code; exit code thresholds: {'soft_fail': False, 'soft_fail_checks': [], 'soft_fail_threshold': None, 'hard_fail_checks': [], 'hard_fail_threshold': None}, hard_fail_on_parsing_errors: False
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  No failed checks, or soft_fail is True and soft_fail_on and hard_fail_on are empty - returning 0
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Getting exit code for report openapi
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Soft fail severity threshold: None
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Soft fail checks: []
2023-02-09 17:05:02,815 [MainThread  ] [DEBUG]  Hard fail severity threshold: None
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Hard fail checks: []
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Use enforcement rules is FALSE
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  In get_exit_code; exit code thresholds: {'soft_fail': False, 'soft_fail_checks': [], 'soft_fail_threshold': None, 'hard_fail_checks': [], 'hard_fail_threshold': None}, hard_fail_on_parsing_errors: False
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  No failed checks, or soft_fail is True and soft_fail_on and hard_fail_on are empty - returning 0
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Getting exit code for report argo_workflows
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Soft fail severity threshold: None
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Soft fail checks: []
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Hard fail severity threshold: None
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Hard fail checks: []
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Use enforcement rules is FALSE
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  In get_exit_code; exit code thresholds: {'soft_fail': False, 'soft_fail_checks': [], 'soft_fail_threshold': None, 'hard_fail_checks': [], 'hard_fail_threshold': None}, hard_fail_on_parsing_errors: False
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  No failed checks, or soft_fail is True and soft_fail_on and hard_fail_on are empty - returning 0
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Getting exit code for report circleci_pipelines
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Soft fail severity threshold: None
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Soft fail checks: []
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Hard fail severity threshold: None
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Hard fail checks: []
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Use enforcement rules is FALSE
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  In get_exit_code; exit code thresholds: {'soft_fail': False, 'soft_fail_checks': [], 'soft_fail_threshold': None, 'hard_fail_checks': [], 'hard_fail_threshold': None}, hard_fail_on_parsing_errors: False
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  No failed checks, or soft_fail is True and soft_fail_on and hard_fail_on are empty - returning 0
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Getting exit code for report azure_pipelines
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Soft fail severity threshold: None
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Soft fail checks: []
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Hard fail severity threshold: None
2023-02-09 17:05:02,816 [MainThread  ] [DEBUG]  Hard fail checks: []
2023-02-09 17:05:02,817 [MainThread  ] [DEBUG]  Use enforcement rules is FALSE
2023-02-09 17:05:02,817 [MainThread  ] [DEBUG]  In get_exit_code; exit code thresholds: {'soft_fail': False, 'soft_fail_checks': [], 'soft_fail_threshold': None, 'hard_fail_checks': [], 'hard_fail_threshold': None}, hard_fail_on_parsing_errors: False
2023-02-09 17:05:02,817 [MainThread  ] [DEBUG]  No failed checks, or soft_fail is True and soft_fail_on and hard_fail_on are empty - returning 0
```

**Desktop (please complete the following information):**
 - OS: Arch Linux
 - Checkov Version 2.3.0

**Additional context**
Add any other context about the problem here (e.g. code snippets).



Discussion:
hey @Igorgro thanks for reaching out.

Yeah, sadly I didn't expect nested `block` usage, but it is valid 🙈 hopefully I can fix it today or tomorrow.
You should also expect that there can be much more levels of nested blocks 😃 

Resolving patch:
diff --git a/checkov/ansible/checks/base_ansible_task_check.py b/checkov/ansible/checks/base_ansible_task_check.py
--- a/checkov/ansible/checks/base_ansible_task_check.py
+++ b/checkov/ansible/checks/base_ansible_task_check.py
@@ -33,6 +33,12 @@ def __init__(
                 f'[?"{module}" != null][]',
                 f'[].tasks[].block[?"{module}" != null][]',
                 f'[].block[?"{module}" != null][]',
+                f'[].tasks[].block[].block[?"{module}" != null][]',
+                f'[].block[].block[?"{module}" != null][]',
+                # in theory, it can be more nested, but let's stop at 3 levels
+                # jmespath lib doesn't support recursive search https://github.com/jmespath/jmespath.py/issues/110
+                f'[].tasks[].block[].block[].block[?"{module}" != null][]',
+                f'[].block[].block[].block[?"{module}" != null][]',
             )
         ]
 
diff --git a/checkov/ansible/graph_builder/local_graph.py b/checkov/ansible/graph_builder/local_graph.py
--- a/checkov/ansible/graph_builder/local_graph.py
+++ b/checkov/ansible/graph_builder/local_graph.py
@@ -36,21 +36,22 @@ def _create_vertices(self) -> None:
                 else:
                     self._process_blocks(file_path=file_path, task=code_block)
 
-    def _process_blocks(self, file_path: str, task: Any) -> None:
+    def _process_blocks(self, file_path: str, task: Any, prefix: str = "") -> None:
         """Checks for possible block usage"""
 
         if not task or not isinstance(task, dict):
             return
 
         if "block" in task and isinstance(task["block"], list):
-            self._create_block_vertices(file_path=file_path, block=task)
+            prefix += f"{ResourceType.BLOCK}."  # with each nested level an extra block prefix is added
+            self._create_block_vertices(file_path=file_path, block=task, prefix=prefix)
 
             for block_task in task["block"]:
-                self._create_tasks_vertices(file_path=file_path, task=block_task)
+                self._process_blocks(file_path=file_path, task=block_task, prefix=prefix)
         else:
-            self._create_tasks_vertices(file_path=file_path, task=task)
+            self._create_tasks_vertices(file_path=file_path, task=task, prefix=prefix)
 
-    def _create_tasks_vertices(self, file_path: str, task: Any) -> None:
+    def _create_tasks_vertices(self, file_path: str, task: Any, prefix: str = "") -> None:
         """Creates tasks vertices"""
 
         if not task or not isinstance(task, dict):
@@ -66,12 +67,18 @@ def _create_tasks_vertices(self, file_path: str, task: Any) -> None:
                 continue
 
             resource_type = f"{ResourceType.TASKS}.{name}"
-            block_name = f"{resource_type}.{task_name}"
 
             if isinstance(config, str):
                 # this happens when modules have no parameters and are directly used with the user input
                 # ex. ansible.builtin.command: cat /etc/passwd
                 config = {SELF_REFERENCE: config}
+            elif config is None:
+                # this happens when modules have no parameters and are passed no value
+                # ex. amazon.aws.ec2_instance_info:
+                config = {
+                    START_LINE: task[START_LINE],
+                    END_LINE: task[END_LINE],
+                }
 
             attributes = deepcopy(config)
             attributes[CustomAttributes.RESOURCE_TYPE] = resource_type
@@ -83,12 +90,12 @@ def _create_tasks_vertices(self, file_path: str, task: Any) -> None:
 
             self.vertices.append(
                 Block(
-                    name=block_name,
+                    name=f"{resource_type}.{task_name}",
                     config=config,
                     path=file_path,
                     block_type=BlockType.RESOURCE,
                     attributes=attributes,
-                    id=block_name,
+                    id=f"{resource_type}.{prefix}{task_name}",
                     source=self.source,
                 )
             )
@@ -96,11 +103,11 @@ def _create_tasks_vertices(self, file_path: str, task: Any) -> None:
             # no need to further check
             break
 
-    def _create_block_vertices(self, file_path: str, block: dict[str, Any]) -> None:
+    def _create_block_vertices(self, file_path: str, block: dict[str, Any], prefix: str = "") -> None:
         """Creates block vertices"""
 
         # grab the block name, if it exists
-        block_name = f'{ResourceType.BLOCK}.{block.get("name") or "unknown"}'
+        block_name = block.get("name") or "unknown"
 
         config = block
         attributes = deepcopy(config)
@@ -109,12 +116,12 @@ def _create_block_vertices(self, file_path: str, block: dict[str, Any]) -> None:
 
         self.vertices.append(
             Block(
-                name=block_name,
+                name=f"{ResourceType.BLOCK}.{block_name}",
                 config=config,
                 path=file_path,
                 block_type=BlockType.RESOURCE,
                 attributes=attributes,
-                id=block_name,
+                id=f"{prefix}{block_name}",
                 source=self.source,
             )
         )
diff --git a/checkov/ansible/runner.py b/checkov/ansible/runner.py
--- a/checkov/ansible/runner.py
+++ b/checkov/ansible/runner.py
@@ -96,14 +96,26 @@ def generate_resource_name(
 
         return resource_key
 
-    def _handle_block_tasks(self, start_line: int, end_line: int, code_block: dict[str, Any]) -> str | None:
+    def _handle_block_tasks(
+        self, start_line: int, end_line: int, code_block: dict[str, Any], prefix: str = ""
+    ) -> str | None:
         for block_task in code_block[ResourceType.BLOCK]:
             if block_task[START_LINE] <= start_line <= end_line <= block_task[END_LINE]:
-                return self._generate_resource_name(task=block_task, in_block=True)
+                prefix += f"{ResourceType.BLOCK}."  # with each nested level an extra block prefix is added
+                if ResourceType.BLOCK in block_task:
+                    resource_name = self._handle_block_tasks(
+                        start_line=start_line,
+                        end_line=end_line,
+                        code_block=block_task,
+                        prefix=prefix,
+                    )
+                    if resource_name is not None:
+                        return resource_name
+                return self._generate_resource_name(task=block_task, prefix=prefix)
 
         return None
 
-    def _generate_resource_name(self, task: dict[str, Any], in_block: bool = False) -> str | None:
+    def _generate_resource_name(self, task: dict[str, Any], prefix: str = "") -> str | None:
         # grab the task name at the beginning before trying to find the actual module name
         task_name = task.get("name") or "unknown"
 
@@ -111,9 +123,9 @@ def _generate_resource_name(self, task: dict[str, Any], in_block: bool = False)
             if name in TASK_RESERVED_KEYWORDS:
                 continue
 
-            if in_block:
+            if prefix:
                 # if the task is found in a block, then prefix the module name with 'block'
-                name = f"block.{name}"
+                name = f"{prefix}{name}"
 
             return f"{ResourceType.TASKS}.{name}.{task_name}"
 


Test patch:
diff --git a/tests/ansible/examples/nested_blocks.yml b/tests/ansible/examples/nested_blocks.yml
new file mode 100644
--- /dev/null
+++ b/tests/ansible/examples/nested_blocks.yml
@@ -0,0 +1,34 @@
+---
+
+- name: Verify tests
+  hosts: all
+  gather_facts: False
+  tasks:
+    - name: 1st level block
+      block:
+        - name: 2nd level block
+          block:
+            - name: 3rd level block
+              block:
+                - name: 4th level block
+                  block:
+                    - name: 5th level block
+                      block:
+                        - name: 6th level uri
+                          ansible.builtin.uri:
+                            url: https://www.example.com
+                    - name: 5th level uri
+                      ansible.builtin.uri:
+                        url: https://www.example.com
+                - name: 4th level uri
+                  ansible.builtin.uri:
+                    url: https://www.example.com
+            - name: 3rd level uri
+              ansible.builtin.uri:
+                url: https://www.example.com
+        - name: 2nd level uri
+          ansible.builtin.uri:
+            url: https://www.example.com
+    - name: 1st level uri
+      ansible.builtin.uri:
+        url: https://www.example.com
diff --git a/tests/ansible/examples/site.yml b/tests/ansible/examples/site.yml
--- a/tests/ansible/examples/site.yml
+++ b/tests/ansible/examples/site.yml
@@ -4,6 +4,10 @@
   hosts: all
   gather_facts: False
   tasks:
+    - name: Get Running instance Info
+      amazon.aws.ec2_instance_info:
+      register: ec2info
+
     - name: enabled
       amazon.aws.ec2_instance:
         name: "public-compute-instance"
diff --git a/tests/ansible/graph_builder/test_local_graph.py b/tests/ansible/graph_builder/test_local_graph.py
--- a/tests/ansible/graph_builder/test_local_graph.py
+++ b/tests/ansible/graph_builder/test_local_graph.py
@@ -27,8 +27,8 @@ def test_build_graph():
     local_graph.build_graph(render_variables=False)
 
     # then
-    assert len(local_graph.vertices) == 3
-    assert len(local_graph.vertices_by_block_type[BlockType.RESOURCE]) == 3
+    assert len(local_graph.vertices) == 4
+    assert len(local_graph.vertices_by_block_type[BlockType.RESOURCE]) == 4
 
     tasks_ids = [
         vertex.id
@@ -36,6 +36,7 @@ def test_build_graph():
         if vertex.attributes.get(CustomAttributes.RESOURCE_TYPE).startswith(ResourceType.TASKS)
     ]
     assert tasks_ids == [
+        "tasks.amazon.aws.ec2_instance_info.Get Running instance Info",
         "tasks.amazon.aws.ec2_instance.enabled",
         "tasks.uri.Check that you can connect (GET) to a page",
         "tasks.ansible.builtin.get_url.Download foo.conf",
diff --git a/tests/ansible/test_graph_manager.py b/tests/ansible/test_graph_manager.py
--- a/tests/ansible/test_graph_manager.py
+++ b/tests/ansible/test_graph_manager.py
@@ -23,7 +23,7 @@ def test_build_graph_from_definitions():
     )
 
     # then
-    assert len(local_graph.vertices) == 1
+    assert len(local_graph.vertices) == 2
 
     task_idx = local_graph.vertices_by_path_and_name[(test_file, "tasks.amazon.aws.ec2_instance.enabled")]
     task = local_graph.vertices[task_idx]
@@ -32,17 +32,17 @@ def test_build_graph_from_definitions():
     assert task.id == "tasks.amazon.aws.ec2_instance.enabled"
     assert task.source == "Ansible"
     assert task.attributes[CustomAttributes.RESOURCE_TYPE] == "tasks.amazon.aws.ec2_instance"
-    assert task.attributes[START_LINE] == 7
-    assert task.attributes[END_LINE] == 18
+    assert task.attributes[START_LINE] == 11
+    assert task.attributes[END_LINE] == 22
     assert task.config == {
         "name": "public-compute-instance",
         "key_name": "prod-ssh-key",
         "vpc_subnet_id": "subnet-5ca1ab1e",
         "instance_type": "c5.large",
         "security_group": "default",
-        "network": {"assign_public_ip": True, "__startline__": 15, "__endline__": 16},
+        "network": {"assign_public_ip": True, "__startline__": 19, "__endline__": 20},
         "image_id": "ami-123456",
         "ebs_optimized": True,
-        "__startline__": 9,
-        "__endline__": 18,
+        "__startline__": 13,
+        "__endline__": 22,
     }
diff --git a/tests/ansible/test_runner.py b/tests/ansible/test_runner.py
--- a/tests/ansible/test_runner.py
+++ b/tests/ansible/test_runner.py
@@ -174,6 +174,54 @@ def test_runner_with_block(graph_connector):
     assert failing_resources == failed_check_resources
 
 
+@pytest.mark.parametrize(
+    "graph_connector",
+    [
+        NetworkxConnector,
+        IgraphConnector,
+    ],
+)
+def test_runner_with_nested_blocks(graph_connector):
+    # given
+    test_file = EXAMPLES_DIR / "nested_blocks.yml"
+    checks = ["CKV_ANSIBLE_1", "CKV2_ANSIBLE_3"]
+
+    # when
+    report = Runner(db_connector=graph_connector()).run(
+        root_folder="", files=[str(test_file)], runner_filter=RunnerFilter(checks=checks)
+    )
+
+    # then
+    summary = report.get_summary()
+
+    # if we increase the level of nested block levels for Python checks, then this goes up to 6
+    assert summary["passed"] == 4
+    assert summary["failed"] == 5
+    assert summary["skipped"] == 0
+    assert summary["parsing_errors"] == 0
+
+    passing_resources = {
+        "tasks.ansible.builtin.uri.1st level uri",
+        "tasks.block.ansible.builtin.uri.2nd level uri",
+        "tasks.block.block.ansible.builtin.uri.3rd level uri",
+        "tasks.block.block.block.ansible.builtin.uri.4th level uri",
+    }
+
+    failing_resources = {
+        "block.1st level block",
+        "block.block.2nd level block",
+        "block.block.block.3rd level block",
+        "block.block.block.block.4th level block",
+        "block.block.block.block.block.5th level block",
+    }
+
+    passed_check_resources = {check.resource for check in report.passed_checks}
+    failed_check_resources = {check.resource for check in report.failed_checks}
+
+    assert passing_resources == passed_check_resources
+    assert failing_resources == failed_check_resources
+
+
 @pytest.mark.parametrize(
     "graph_connector",
     [