Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMI status check wait issue #250

Closed
suresh-kumarp opened this issue Jan 27, 2021 · 4 comments
Closed

AMI status check wait issue #250

suresh-kumarp opened this issue Jan 27, 2021 · 4 comments
Labels
module module plugins plugin (any type) priority/low python3 traceback waiting_on_contributor Needs help. Feel free to engage to get things unblocked

Comments

@suresh-kumarp
Copy link

suresh-kumarp commented Jan 27, 2021

SUMMARY

We are using CodeBuild service to build our product. In that process, we are using Ansible module to create an AMI image from AppServer instance. Since the AMI creation taking more time the AMI status check API request getting expire after 15 minutes.

ISSUE TYPE
COMPONENT NAME

/root/.pyenv/versions/3.8.3/lib/python3.8/site-packages/ansible_collections/amazon/aws/plugins/modules/ec2_ami.py

ANSIBLE VERSION

ansible 2.10.5
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /root/.pyenv/versions/3.8.3/lib/python3.8/site-packages/ansible
executable location = /root/.pyenv/versions/3.8.3/bin/ansible
python version = 3.8.3


##### CONFIGURATION


##### OS / ENVIRONMENT
Linux(Ubuntu 18.04.5 LTS)


##### STEPS TO REPRODUCE
If the AMI creation steps taking more than 15 mins this error occurs.


##### EXPECTED RESULTS
It should wait until the AMI gets created and once the AMI status is available then it should proceed further.


##### ACTUAL RESULTS
TASK [Create AMI snapshot of app host] *****************************************
task path: /make_ami/ansible/snapshot-ec2-ami.yml:36
redirecting (type: modules) ansible.builtin.ec2_ami to amazon.aws.ec2_ami
Using module file /root/.pyenv/versions/3.8.3/lib/python3.8/site-packages/ansible_collections/amazon/aws/plugins/modules/ec2_ami.py
Pipelining is enabled.
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c '/root/.pyenv/versions/3.8.3/bin/python && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "<stdin>", line 102, in <module>
  File "<stdin>", line 94, in _ansiballz_main
  File "<stdin>", line 40, in invoke_module
  File "/root/.pyenv/versions/3.8.3/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/root/.pyenv/versions/3.8.3/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/root/.pyenv/versions/3.8.3/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_ec2_ami_payload_qno0haa5/ansible_ec2_ami_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_ami.py", line 761, in <module>
  File "/tmp/ansible_ec2_ami_payload_qno0haa5/ansible_ec2_ami_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_ami.py", line 757, in main
  File "/tmp/ansible_ec2_ami_payload_qno0haa5/ansible_ec2_ami_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_ami.py", line 511, in create_image
  File "/root/.pyenv/versions/3.8.3/lib/python3.8/site-packages/botocore/waiter.py", line 310, in wait
    raise WaiterError(
botocore.exceptions.WaiterError: Waiter image_available failed: Request has expired.
fatal: [localhost]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"<stdin>\", line 102, in <module>\n  File \"<stdin>\", line 94, in _ansiballz_main\n  File \"<stdin>\", line 40, in invoke_module\n  File \"/root/.pyenv/versions/3.8.3/lib/python3.8/runpy.py\", line 207, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/root/.pyenv/versions/3.8.3/lib/python3.8/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/root/.pyenv/versions/3.8.3/lib/python3.8/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_ec2_ami_payload_qno0haa5/ansible_ec2_ami_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_ami.py\", line 761, in <module>\n  File \"/tmp/ansible_ec2_ami_payload_qno0haa5/ansible_ec2_ami_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_ami.py\", line 757, in main\n  File \"/tmp/ansible_ec2_ami_payload_qno0haa5/ansible_ec2_ami_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_ami.py\", line 511, in create_image\n  File \"/root/.pyenv/versions/3.8.3/lib/python3.8/site-packages/botocore/waiter.py\", line 310, in wait\n    raise WaiterError(\nbotocore.exceptions.WaiterError: Waiter image_available failed: Request has expired.\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}
@ansibullbot
Copy link

Files identified in the description:

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

@gravesm gravesm added waiting_on_contributor Needs help. Feel free to engage to get things unblocked priority/low and removed needs_triage labels Jan 29, 2021
@gravesm
Copy link
Member

gravesm commented Jan 29, 2021

@sureshkumarp0 Could you confirm if you are using a wait_timeout in your task, and if so, how long?

@tremble
Copy link
Contributor

tremble commented May 5, 2021

A quick search using Google seems to imply that the most common cause of this error is expired session tokens. The alternative would be the botocore waiter code not updating the timestamp on the requests it makes, and would be a bug in botocore, not this module.

See for example hashicorp/packer#8299

Since neither of these scenarios are something we can/should realistically handle, and we've heard nothing from you since January I'm going to close this issue.

@tremble tremble closed this as completed May 5, 2021
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
Add lightsail_static_ip module

SUMMARY
Adds a module to manage AWS Lightsail Static IP addresses
Fixes ansible-collections#250
ISSUE TYPE

New Module Pull Request

COMPONENT NAME
community.aws.lightsail_static_ip
ADDITIONAL INFORMATION
As per my earlier pull request, this is part of larger work to add functionality to this module in terms of managing AWS Lightsail.
Apologies if there are any issues/I have missed anything. I am new to Ansible development, but have tried to follow the contribution docs as best as I can.
Example playbook:
    - name: create static IP
      community.aws.lightsail_static_ip:
        name: "test_static"
        state: present
        region: ap-southeast-2

Reviewed-by: Jill R <None>
Reviewed-by: Mark Chappell <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Sep 18, 2023
Add lightsail_static_ip module

SUMMARY
Adds a module to manage AWS Lightsail Static IP addresses
Fixes ansible-collections#250
ISSUE TYPE

New Module Pull Request

COMPONENT NAME
community.aws.lightsail_static_ip
ADDITIONAL INFORMATION
As per my earlier pull request, this is part of larger work to add functionality to this module in terms of managing AWS Lightsail.
Apologies if there are any issues/I have missed anything. I am new to Ansible development, but have tried to follow the contribution docs as best as I can.
Example playbook:
    - name: create static IP
      community.aws.lightsail_static_ip:
        name: "test_static"
        state: present
        region: ap-southeast-2

Reviewed-by: Jill R <None>
Reviewed-by: Mark Chappell <None>
abikouo pushed a commit to abikouo/amazon.aws that referenced this issue Oct 24, 2023
Add lightsail_static_ip module

SUMMARY
Adds a module to manage AWS Lightsail Static IP addresses
Fixes ansible-collections#250
ISSUE TYPE

New Module Pull Request

COMPONENT NAME
community.aws.lightsail_static_ip
ADDITIONAL INFORMATION
As per my earlier pull request, this is part of larger work to add functionality to this module in terms of managing AWS Lightsail.
Apologies if there are any issues/I have missed anything. I am new to Ansible development, but have tried to follow the contribution docs as best as I can.
Example playbook:
    - name: create static IP
      community.aws.lightsail_static_ip:
        name: "test_static"
        state: present
        region: ap-southeast-2

Reviewed-by: Jill R <None>
Reviewed-by: Mark Chappell <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module module plugins plugin (any type) priority/low python3 traceback waiting_on_contributor Needs help. Feel free to engage to get things unblocked
Projects
None yet
Development

No branches or pull requests

4 participants