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
apt: Packages were downgraded and -y was used without --allow-downgrades #29451
Comments
From @ansibot on 2016-12-01T11:08:05Z @ansible ping, this issue is waiting for your response. |
From @davidak on 2016-12-01T11:08:05Z Workaround: Remove Packages manually and let Ansible reinstall it. |
This can be resolved by using the |
@Tasqa 's answer worked for me. Can we close this? |
Why not to add the allow_downgrade option to the apt module? |
I'm running into the same problem while trying to correct a software update that shouldn't have happened. The version of docker-ce is pinned in the APT preferences so despite this saying
|
Note: Allow apt downgrades (#33677) |
From the apt module's docs (https://docs.ansible.com/ansible/latest/modules/apt_module.html):
I'm with @agenosov on this for adding allow_downgrade parameter |
We are currently using the following code to delete the package when we want to enforce a specific version. Of course an option to allow downgrades somehow would be appreciated. Just wanted to share this.
|
In our environment we need to install specific kernels. ignore_errors is not an option for us because we want the package installed - ignore_errors will ignore errors, and we don't want to ignore errors, we want packages installed. Adding a allow_downgrade paramenter that adds the --allow-downgrades flag to apt would fix this. What's the fast way to add this simple code to the apt module? I'm happy to test and make the pull request, but I'm not an ansible developer and don't currently have time to browse the source code to find the apt module to do this. If someone can point me at it I can try adding the code. |
Please note: with the KERNEL the option to remove the newer package is NOT an option. On install, a newer kernel version that the one we might want is likely to be installed, and if we need to test different versions, we're likely to have a system running a kernel version newer than the package we want installed. In either case, we cannot remove the currenly running kernel, and we cannot install the older kernel as a downgrade without the allow-downgrades flag. |
The way this issue has been handled is disappointing, to phrase it nicely. Please urgently consider fixing the documentation, which has been updated many times in the 3 years since this issue was filed. The APT module states you CAN declare specific package versions: There's even an example. No limitations mentioned. But the example only works if nothing is installed. I spent half a day testing, and digging through posts where folks had this question (but never solved it). I even tried injecting In an effort to spare the next person, I suggest:
Hopefully this does not sound too cranky. I love Ansible. But this experience... ouch! |
This can't be closed because apt says this:
|
Hi guys,
- name: Update package list
package_facts:
manager: auto
- name: Check Docker-CE versions
set_fact:
ce_version: "{{ ansible_facts.packages['docker-ce'] | default(none) | map(attribute='version') | list }}"
cli_version: "{{ ansible_facts.packages['docker-ce-cli'] | default(none) | map(attribute='version') | list }}"
- name: Uninstall non-validated docker-ce
apt:
name:
- docker-ce
- docker-ce-cli
state: absent
update_cache: yes
when: docker_version not in ce_version or docker_version not in cli_version
- name: Downgrade package
command: "apt install docker-ce={{ docker_version }} docker-cli={{ docker_version }} -y --allow-downgrades" Hope I will have time to add the option to |
I've opened a new PR providing an |
From @davidak on 2016-12-01T11:08:05Z
ISSUE TYPE
COMPONENT NAME
apt
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Controller: elementary OS 0.4 Loki (based on Ubuntu 16.04 LTS)
Host: Ubuntu Server 16.04 LTS
SUMMARY
apt module don't downgrade package
STEPS TO REPRODUCE
Deploy this playbook:
EXPECTED RESULTS
Ansible instruct apt to downgrade the package to the specified version.
(It currently is 7.0 on the server)
ACTUAL RESULTS
Copied from original issue: ansible/ansible-modules-core#5781
The text was updated successfully, but these errors were encountered: