ansible-collections / amazon.aws

Ansible Collection for Amazon AWS
GNU General Public License v3.0
308 stars 336 forks source link

Unable to launch ec2 instance on snowball edge device #1878

Open dmc5179 opened 10 months ago

dmc5179 commented 10 months ago

Summary

Unable to use the ec2_instance module to deploy a new instance on an AWS snowball device.

Issue Type

Bug Report

Component Name

ec2_instance

Ansible Version

ansible [core 2.14.9]
  config file = /home/ec2-user/openshift4-snowball/playbooks/ansible.cfg
  configured module search path = ['/home/ec2-user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.9/site-packages/ansible
  ansible collection location = /home/ec2-user/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.9.18 (main, Sep  7 2023, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True

Collection Versions

$ ansible-galaxy collection list

AWS SDK versions

Collection        Version
----------------- -------
amazon.aws        7.0.0  
ansible.netcommon 5.3.0  
ansible.posix     1.5.4  
ansible.utils     2.11.0 
community.aws     7.0.0  
community.crypto  2.16.0 
community.general 8.0.2  
kubernetes.core   2.4.0 

Configuration

CACHE_PLUGIN(/home/ec2-user/openshift4-snowball/playbooks/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/home/ec2-user/openshift4-snowball/playbooks/ansible.cfg) = /tmp/ansiblecachedir
CONFIG_FILE() = /home/ec2-user/openshift4-snowball/playbooks/ansible.cfg
DEFAULT_FORKS(/home/ec2-user/openshift4-snowball/playbooks/ansible.cfg) = 5
DEFAULT_HOST_LIST(/home/ec2-user/openshift4-snowball/playbooks/ansible.cfg) = ['/home/ec2-user/openshift4-snowball/playbooks/>
DEFAULT_LOG_PATH(/home/ec2-user/openshift4-snowball/playbooks/ansible.cfg) = /home/ec2-user/openshift4-snowball/playbooks/ans>
DEFAULT_STDOUT_CALLBACK(/home/ec2-user/openshift4-snowball/playbooks/ansible.cfg) = debug
HOST_KEY_CHECKING(/home/ec2-user/openshift4-snowball/playbooks/ansible.cfg) = False
RETRY_FILES_ENABLED(/home/ec2-user/openshift4-snowball/playbooks/ansible.cfg) = False

OS / Environment

RHEL 9

Steps to Reproduce

---

- hosts: localhost
  gather_facts: true
  become: false
  tasks:

    - name: Deploy EC2 instance to snowball device
      amazon.aws.ec2_instance:
        region: snow
        profile: snowballEdge
        ec2_url: "https://192.168.1.30:8243"
        validate_certs: false
        name: "test-instance"
        instance_type: sbe-c.2xlarge
        security_group: default
        image_id: s.ami-81f9adb9946bd8506

Expected Results

An EC2 instance is launched on the snowball device

Actual Results

TASK [Deploy EC2 instance to snowball device] ********************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: botocore.exceptions.ClientError: An error occurred (InvalidAction) when calling the DescribeVpcs operation: Could not find operation DescribeVpcs
[DEPRECATION WARNING]: Alias 'ec2_url' is deprecated. See the module docs for more information. This feature will be removed 
from amazon.aws in a release after 2024-12-01. Deprecation warnings can be disabled by setting deprecation_warnings=False in 
ansible.cfg.
fatal: [localhost]: FAILED! => {
    "boto3_version": "1.29.1",
    "botocore_version": "1.32.1",
    "changed": false,
    "error": {
        "code": "InvalidAction",
        "message": "Could not find operation DescribeVpcs"
    },
    "response_metadata": {
        "http_headers": {
            "connection": "close",
            "content-length": "229",
            "content-type": "text/xml",
            "date": "Thu, 23 Nov 2023 18:33:16 GMT",
            "x-amzn-requestid": "18162771-6a3f-4205-85a6-8cb3ce9fd4ea"
        },
        "http_status_code": 400,
        "request_id": "18162771-6a3f-4205-85a6-8cb3ce9fd4ea",
        "retry_attempts": 0
    }
}

MSG:

Could not describe default VPC: An error occurred (InvalidAction) when calling the DescribeVpcs operation: Could not find operation DescribeVpcs

Code of Conduct

dmc5179 commented 10 months ago

If I understand correctly, snowball devices are considered non-VPC based environments. VPC based commands or options in any command will fail. Perhaps using the region as "snow" can be used to skip some of the module actions that cannot be done without a VPC.