Async issues in ansible

Hi All,

I’m trying to take snapshots of aws ebs volumes using ansible. But my playbook fails when the volume size is big ( >1024 GB) with the below error. Unable to figure out if it is an async issue or if something else causing it. Looking forward to any suggestions or alternatives to achieve the same.

Ansible playbook:

tasks:

  • block:

  • name: Snapshot the EBS volume.
    amazon.aws.ec2_snapshot:
    profile: “{{ aws_profile_name }}”
    region: “{{ aws_region }}”
    volume_id: “{{ item }}”
    snapshot_tags:
    Name: “snapshot_test”
    date: “{{ ansible_date_time.date }}”
    with_items:

  • “vol-0dc6e684fcd5f82d3”

  • “vol-0c5f08c0dcb53a1e2”

  • “vol-06cbff0337132054b”
    async: 1800
    poll: 0
    register: snapshot_jobs

  • name: Print out all the snapshot jobs
    debug:
    msg: “{{ item }}”
    with_items: “{{ snapshot_jobs.results }}”

  • name: Check the status of snapshot jobs
    async_status: jid={{ item.ansible_job_id }}
    register: job_result
    until: job_result.finished
    retries: 45
    delay: 120
    with_items: “{{ snapshot_jobs.results }}”

The error I’m getting is on the last task (Check the status of snapshot jobs) -

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: botocore.exceptions.WaiterError: Waiter snapshot_completed failed: Max attempts exceeded
failed: [localhost] (item={‘failed’: 0, ‘started’: 1, ‘finished’: 0, ‘ansible_job_id’: ‘562261181848.42040’, ‘results_file’: ‘/users/shivania/.ansible_async/562261181848.42040’, ‘changed’: True, ‘item’: ‘vol-0dc6e684fcd5f82d3’, ‘ansible_loop_var’: ‘item’}) => {“ansible_job_id”: “562261181848.42040”, “ansible_loop_var”: “item”, “attempts”: 7, “boto3_version”: “1.20.24”, “botocore_version”: “1.23.24”, “changed”: false, “finished”: 1, “item”: {“ansible_job_id”: “562261181848.42040”, “ansible_loop_var”: “item”, “changed”: true, “failed”: 0, “finished”: 0, “item”: “vol-0dc6e684fcd5f82d3”, “results_file”: “/users/shivania/.ansible_async/562261181848.42040”, “started”: 1}, “msg”: “Timed out while creating snapshot: Waiter snapshot_completed failed: Max attempts exceeded”, “results_file”: “/users/shivania/.ansible_async/562261181848.42040”, “started”: 1, “stderr”: “”, “stderr_lines”: , “stdout”: “”, “stdout_lines”: }

-bash-4.2$ ansible --version
ansible [core 2.12.1]

Any help will be appreciated!

Thanks.

Have you tried increasing the wait_timeout of the module?

https://docs.ansible.com/ansible/latest/collections/amazon/aws/ec2_snapshot_module.html#parameter-wait_timeout