Issue 1:
From @telbizov on 2016-09-06T18:02:16Z

ISSUE TYPE

Feature Idea

COMPONENT NAME

apt

ANSIBLE VERSION

Any, but most likely 2.x branch

CONFIGURATION

N/A

OS / ENVIRONMENT

Debian family Linux running apt package management

SUMMARY

This is a feature request but also works around a problem that is very common when manipulating apt packages/repositories on a given host from multiple instances of apt.

Currently if there is an instance working with apt (via ansible apt module or not) there is a lock which is being held exclusively and as such no other apt instance can get a hold of. The result is that if there's a second instance of apt which tries to acquire the lock it gets an instant failure. In the case of doing this via ansible the result is:

msg: Failed to lock apt for exclusive operation

This is the default apt behavior and as far as I can tell there is not way to pass a flag to apt command line, or apt configuraion, to tell it to wait for the lock to be released and then only timeout after a certain period of time.

It would be very useful if ansible's apt module itself was to provide such a feature. Say an optional flag - for example lock_wait=60 which would make ansible try to acquire the lock every second for X seconds and eventually timing out. This way if two ansible playbooks running at the same time are trying to use the apt repository they will have much higher chance of succeeding.

Currently one of them errors out only so that the user retry the entire playbook .

STEPS TO REPRODUCE

Run two ansible instances each utilizing the apt module at the very same time - one of them will fail with the above error.

EXPECTED RESULTS

If we have this feature in ansible then we don't need to wrap each individual playbook's apt calls with retries and have it built-in the apt module itself.

Copied from original issue: ansible/ansible-modules-core#4717

Issue 2:
ISSUE TYPE

Feature Idea

This is a copy of the issue on the old repository: ansible/ansible-modules-core#4717

There was some work on it, I don't know why it's not added: ansible/ansible-modules-core#4842

COMPONENT NAME

apt

SUMMARY

This is a feature request but also works around a problem that is very common when manipulating apt packages/repositories on a given host from multiple instances of apt.

Currently if there is an instance working with apt (via ansible apt module or not) there is a lock which is being held exclusively and as such no other apt instance can get a hold of. The result is that if there's a second instance of apt which tries to acquire the lock it gets an instant failure. In the case of doing this via ansible the result is:

msg: Failed to lock apt for exclusive operation

This is the default apt behavior and as far as I can tell there is not way to pass a flag to apt command line, or apt configuraion, to tell it to wait for the lock to be released and then only timeout after a certain period of time.

It would be very useful if ansible's apt module itself was to provide such a feature. Say an optional flag - for example lock_wait=60 which would make ansible try to acquire the lock every second for X seconds and eventually timing out. This way if two ansible playbooks running at the same time are trying to use the apt repository they will have much higher chance of succeeding.

Currently one of them errors out only so that the user retry the entire playbook .

STEPS TO REPRODUCE

Run two ansible instances each utilizing the apt module at the very same time - one of them will fail with the above error.

EXPECTED RESULTS

If we have this feature in ansible then we don't need to wrap each individual playbook's apt calls with retries and have it built-in the apt module itself.