ansible-collections / community.aws

Ansible Collection for Community AWS
GNU General Public License v3.0
190 stars 398 forks source link

List of community modules without integration tests #988

Open alinabuzachis opened 2 years ago

alinabuzachis commented 2 years ago

Summary

The following modules do not have integrations tests:

Issue Type

Feature Idea

Component Name

Several modules

Additional Information

Code of Conduct

ansibullbot commented 2 years ago

Files identified in the description: None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

marknet15 commented 2 years ago

*_info can be linked to the non info counterparts on most occasions I think, so that shouldn't be too hard to cover

alinabuzachis commented 2 years ago

@marknet15 Yes, exactly. At the moment, I didn't link them because the _info modules were not really used by the non info counterparts. I think we should have a couple of tasks using the _info module at least.

markuman commented 2 years ago

aws_sgw_info

this is a very hard one, because there is no module to create a storage gateway yet.

markuman commented 2 years ago

aws_sgw_info

this is a very hard one, because there is no module to create a storage gateway yet.

a few words more about the storage gateway (sgw).

To deploy a storage gateway, you'll need to deploy an EC2 instance with a special ami. easy.
Now it comes to the registration process. This is how we handle this.

- name: init sgw
  block:

    - name: get activation code
      uri:
        url: "http://{{ sgw_instance.instances[0].private_ip_address }}/?activationRegion={{ region }}"
        method: GET
        return_content: yes
      register: ACTICATION_TOKEN
      retries: 10
      delay: 30
      until: ACTICATION_TOKEN is not failed

    - name: register new sgw
      command: aws storagegateway activate-gateway \
        --activation-key {{ ACTICATION_TOKEN.url.split('activationKey=')[-1] }} \
        --gateway-name {{ sgw_name }} \
        --gateway-timezone GMT+1:00 \
        --gateway-region {{ region }} \
        --gateway-type FILE_S3

    - name: "list sgw: retries until gateway_operational_state is connected"
      aws_sgw_info:
        region: "{{ region }}"
        gather_file_shares: yes
        gather_local_disks: yes
        gather_tapes: no
        gather_volumes: no
      register: sgwfacts
      retries: 10
      delay: 30
      until: sgwfacts is not failed

After the instance has bootet, it took 1-3 minutes until you can curl the registration code. For this the node that runs the integration test must be

To archive idempotent here, this block is only executed if the sgw isn't connected/available already

- name: list sgw
  aws_sgw_info:
    region: "{{ region }}"
    gather_file_shares: yes
    gather_local_disks: yes
    gather_tapes: no
    gather_volumes: no
  register: sgwfacts

- name: merge sgw names
  set_fact:
    sgws: "{{ sgwfacts.gateways |  map(attribute='gateway_name') | list }}"

- include_tasks: init_sgw.yml
  when: sgw_name not in sgws

So at the end, to test aws_sgw_info module, we'll need at least a sgw_activate_gateway (or some similar name, when it should also be used to delete the sgw) module, where this modules include also fetch of the registration code

- community.aws.sgw_activate_gateway:
    name: "{{ sgw_name }}"
    state: ['present','absent']
    ip: 1.2.3.4

...but it's also possible to glue everything with other modules together 😎