diff --git a/changelogs/fragments/1394-lint.yml b/changelogs/fragments/1394-lint.yml new file mode 100644 index 00000000000..237689c0ca5 --- /dev/null +++ b/changelogs/fragments/1394-lint.yml @@ -0,0 +1,3 @@ +trivial: +- inventory tests - move tasks out of playbook director (https://github.com/ansible-collections/amazon.aws/pull/1394). +- ec2_vpc_net - remove unused import (https://github.com/ansible-collections/amazon.aws/pull/1394). diff --git a/plugins/modules/ec2_vpc_net.py b/plugins/modules/ec2_vpc_net.py index 54cfbf7d772..7ab4f02b93c 100644 --- a/plugins/modules/ec2_vpc_net.py +++ b/plugins/modules/ec2_vpc_net.py @@ -209,7 +209,6 @@ from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict from ansible_collections.amazon.aws.plugins.module_utils.modules import AnsibleAWSModule -from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_message from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry from ansible_collections.amazon.aws.plugins.module_utils.transformation import ansible_dict_to_boto3_filter_list from ansible_collections.amazon.aws.plugins.module_utils.tagging import ansible_dict_to_boto3_tag_list diff --git a/tests/integration/targets/inventory_aws_ec2/playbooks/manage_ec2_instances.yml b/tests/integration/targets/inventory_aws_ec2/playbooks/manage_ec2_instances.yml index 8150ce33d05..acef915cbb0 100644 --- a/tests/integration/targets/inventory_aws_ec2/playbooks/manage_ec2_instances.yml +++ b/tests/integration/targets/inventory_aws_ec2/playbooks/manage_ec2_instances.yml @@ -18,4 +18,4 @@ region: '{{ aws_region }}' tasks: - - include_tasks: "{{ task }}.yml" + - include_tasks: "tasks/{{ task }}.yml" diff --git a/tests/integration/targets/inventory_aws_ec2/playbooks/populate_cache.yml b/tests/integration/targets/inventory_aws_ec2/playbooks/populate_cache.yml index 8a074c50629..13c3ad14712 100644 --- a/tests/integration/targets/inventory_aws_ec2/playbooks/populate_cache.yml +++ b/tests/integration/targets/inventory_aws_ec2/playbooks/populate_cache.yml @@ -16,4 +16,4 @@ - debug: var: groups - - include_tasks: tear_down.yml + - include_tasks: tasks/tear_down.yml diff --git a/tests/integration/targets/inventory_aws_ec2/playbooks/tasks b/tests/integration/targets/inventory_aws_ec2/playbooks/tasks new file mode 120000 index 00000000000..93c76d61977 --- /dev/null +++ b/tests/integration/targets/inventory_aws_ec2/playbooks/tasks @@ -0,0 +1 @@ +../tasks/ \ No newline at end of file diff --git a/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_concatenation.yml b/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_concatenation.yml index 247b68af48a..9678ba4ff49 100644 --- a/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_concatenation.yml +++ b/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_concatenation.yml @@ -14,7 +14,7 @@ block: # Create VPC, subnet, security group, and find image_id to create instance - - include_tasks: setup.yml + - include_tasks: tasks/setup.yml # Create new host, refresh inventory - name: create a new host diff --git a/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_constructed.yml b/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_constructed.yml index 02cd86b0e4e..e7d4c654d16 100644 --- a/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_constructed.yml +++ b/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_constructed.yml @@ -15,7 +15,7 @@ # Create VPC, subnet, security group, and find image_id to create instance - - include_tasks: setup.yml + - include_tasks: tasks/setup.yml # Create new host, refresh inventory diff --git a/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_hostnames_using_tags.yml b/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_hostnames_using_tags.yml index 0fab4a023f7..b71beb4ba6f 100644 --- a/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_hostnames_using_tags.yml +++ b/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_hostnames_using_tags.yml @@ -14,7 +14,7 @@ block: # Create VPC, subnet, security group, and find image_id to create instance - - include_tasks: setup.yml + - include_tasks: tasks/setup.yml # Create new host - name: create a new host diff --git a/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_hostnames_using_tags_classic.yml b/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_hostnames_using_tags_classic.yml index 860acc7e99d..df29ebf14d5 100644 --- a/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_hostnames_using_tags_classic.yml +++ b/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_hostnames_using_tags_classic.yml @@ -14,7 +14,7 @@ block: # Create VPC, subnet, security group, and find image_id to create instance - - include_tasks: setup.yml + - include_tasks: tasks/setup.yml # Create new host - name: create a new host diff --git a/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_hostvars_prefix_suffix.yml b/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_hostvars_prefix_suffix.yml index da16f6cd643..f91b820b48a 100644 --- a/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_hostvars_prefix_suffix.yml +++ b/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_hostvars_prefix_suffix.yml @@ -15,7 +15,7 @@ # Create VPC, subnet, security group, and find image_id to create instance - - include_tasks: setup.yml + - include_tasks: tasks/setup.yml # Create new host, refresh inventory - name: create a new host diff --git a/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_include_or_exclude_filters.yml b/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_include_or_exclude_filters.yml index 0931335646f..2f063837c5c 100644 --- a/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_include_or_exclude_filters.yml +++ b/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_include_or_exclude_filters.yml @@ -15,7 +15,7 @@ # Create VPC, subnet, security group, and find image_id to create instance - - include_tasks: setup.yml + - include_tasks: tasks/setup.yml # Create new host, refresh inventory - name: create a new host (1/3) diff --git a/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_literal_string.yml b/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_literal_string.yml index bacd38c6e97..a897de8cb4d 100644 --- a/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_literal_string.yml +++ b/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_literal_string.yml @@ -14,7 +14,7 @@ block: # Create VPC, subnet, security group, and find image_id to create instance - - include_tasks: setup.yml + - include_tasks: tasks/setup.yml # Create new host, refresh inventory - name: create a new host diff --git a/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_use_contrib_script_keys.yml b/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_use_contrib_script_keys.yml index c8054b50a90..9d71994c114 100644 --- a/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_use_contrib_script_keys.yml +++ b/tests/integration/targets/inventory_aws_ec2/playbooks/test_populating_inventory_with_use_contrib_script_keys.yml @@ -14,7 +14,7 @@ block: # Create VPC, subnet, security group, and find image_id to create instance - - include_tasks: setup.yml + - include_tasks: tasks/setup.yml # Create new host, refresh inventory - name: create a new host diff --git a/tests/integration/targets/inventory_aws_ec2/playbooks/setup.yml b/tests/integration/targets/inventory_aws_ec2/tasks/setup.yml similarity index 100% rename from tests/integration/targets/inventory_aws_ec2/playbooks/setup.yml rename to tests/integration/targets/inventory_aws_ec2/tasks/setup.yml diff --git a/tests/integration/targets/inventory_aws_ec2/playbooks/tear_down.yml b/tests/integration/targets/inventory_aws_ec2/tasks/tear_down.yml similarity index 100% rename from tests/integration/targets/inventory_aws_ec2/playbooks/tear_down.yml rename to tests/integration/targets/inventory_aws_ec2/tasks/tear_down.yml diff --git a/tests/integration/targets/inventory_aws_ec2/playbooks/test_refresh_inventory.yml b/tests/integration/targets/inventory_aws_ec2/tasks/test_refresh_inventory.yml similarity index 100% rename from tests/integration/targets/inventory_aws_ec2/playbooks/test_refresh_inventory.yml rename to tests/integration/targets/inventory_aws_ec2/tasks/test_refresh_inventory.yml diff --git a/tests/integration/targets/inventory_aws_rds/playbooks/test_refresh_inventory.yml b/tests/integration/targets/inventory_aws_rds/playbooks/test_refresh_inventory.yml deleted file mode 100644 index 519aa5b285b..00000000000 --- a/tests/integration/targets/inventory_aws_rds/playbooks/test_refresh_inventory.yml +++ /dev/null @@ -1,67 +0,0 @@ -- name: test updating inventory - module_defaults: - group/aws: - aws_access_key: '{{ aws_access_key }}' - aws_secret_key: '{{ aws_secret_key }}' - security_token: '{{ security_token | default(omit) }}' - region: '{{ aws_region }}' - collections: - - amazon.aws - - community.aws - block: - - set_fact: - instance_id: "{{ resource_prefix }}update" - - - name: assert group was populated with inventory but is empty - assert: - that: - - "'aws_rds' in groups" - - "not groups.aws_rds" - - - name: create minimal mariadb instance in default VPC and default subnet group - rds_instance: - state: present - engine: mariadb - db_instance_class: db.t2.micro - allocated_storage: 20 - instance_id: 'rds-mariadb-{{ resource_prefix }}' - master_username: 'ansibletestuser' - master_user_password: 'password-{{ resource_prefix | regex_findall(".{8}$") | first }}' - tags: - workload_type: other - register: setup_instance - - - meta: refresh_inventory - - - name: assert group was populated with inventory and is no longer empty - assert: - that: - - "'aws_rds' in groups" - - "groups.aws_rds | length == 1" - - "groups.aws_rds.0 == '{{ resource_prefix }}'" - - - name: remove mariadb instance - rds_instance: - state: absent - engine: mariadb - skip_final_snapshot: yes - instance_id: ansible-rds-mariadb-example - - - meta: refresh_inventory - - - name: assert group was populated with inventory but is empty - assert: - that: - - "'aws_rds' in groups" - - "not groups.aws_rds" - - always: - - - name: remove mariadb instance - rds_instance: - state: absent - engine: mariadb - skip_final_snapshot: yes - instance_id: ansible-rds-mariadb-example - ignore_errors: yes - when: setup_instance is defined