Comments (7)
I might have been a bit premature since my debian based distros are pretty updated and there is no Python2 available, so its 'non existant', but i kept testing other cases, of which i've found 4:
- package exists, is in dpkg cache and selections are available, action works fine, matches dpkg
- package does not exist anywhere, action works fine, matches dpkg
- package exists in repository, but dpkg cache was not updated, so action reacts as if it didnt exist, i think this is still correct and matches dpkg
- package exists in repo and dpkg cache, but was never in selections, in this case action incorrectly treats as non existant but dpkg itself does work.
I'll push a fix for this last case.
from ansible.
This would also be fairly trivial to implement with just running apt-mark
:
- name: Get list of packages on hold
command: apt-mark showhold
register: apt_mark_hold
changed_when: false
- name: Set hold for python2.7-minimal
command: apt-mark hold python2.7-minimal
when: '"python2.7-minimal" not in apt_mark_hold.stdout'
from ansible.
i've been testing this and sadly i get different results on different versions of Debian and Debian derivatives. Some allow any package name to be held w/o error, so it won't catch misspellings, other versions ONLY allow packages they recognize so they need to be in the local cache. I'm not sure we should bypass this behavior as it opens up many doors to user error and complexity in tracking the different underlying responses from the tool.
from ansible.
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the component bot command.
from ansible.
I'm not sure this is true, in my tests dpkg --set-selections
fails to hold a package if the name is for an unknown package. I think you are confusing an 'existing' package vs an installed one.
https://wiki.debian.org/Teams/Dpkg/FAQ#set-selections
from ansible.
@bcoca Thank you for your quick reply! I haven't tried using dpkg --set-selections
, only apt-mark hold
, which works. If this module uses dpkg
, and it can't do this task, then is there a way to accomplish this with the apt
module?
from ansible.
Same problem with the elasticsearch ansible role (yes, I know, old one, but afaik there isn't another better, so...):
- name: Debian - unhold elasticsearch version
become: yes
dpkg_selections:
name: "{{ es_package_name }}"
selection: "install"
when: not es_version_lock or (installed_es_version.stdout and installed_es_version.stdout != es_version)
this fails too with "Failed to find package 'elasticsearch' to perform selection 'install'." when no elasticsearch package is installed
(debian 12 / ansible-core 2.16.5-1ppa)
because initial install (some years ago) was flawless and since then was only "checked", probably it's an old "bug/feature" in ansible, glad that at least one person had the same issue.
I agree that it's kind of unusual to hold/unhold a non-existent package, but it worked (not sure that the package name should be a t least a debian package or any string would match ok).
from ansible.
Related Issues (20)
- Changes to linux.py for setup module to return more relevant information for s390 HOT 2
- `ansible.builtin.package_facts` returns an empty list when `manager=auto` HOT 7
- with_items using jinja2 no longer working after Ansible 2.16.4(and 6) upgrade. HOT 3
- `git` module: `Failed to init/update submodules: warning: could not look up configuration 'remote.origin.url'` HOT 9
- "Expecting value: line 1 column 1 (char 0)" -- JSONDecodeError("Expecting value", s, err.value) from None HOT 4
- ansilbe become user with rootsh support HOT 2
- Group var not correctly cast to integer HOT 9
- task timeout failure should indicate timeout for programatic use HOT 3
- When fatal: happens when using iteration, all results are lost even if ignore_errors is true HOT 2
- Enable Logdna callback plugin to pass in custom log ingestion url HOT 1
- template module doesn't return a backup file HOT 7
- I cannot connect to a single server from the provider hetzner when the servers are in recovery mode HOT 1
- ansible.builtin.command not passing args to useradd correctly with argv parameter HOT 2
- handlers not fired when using roles HOT 8
- become_method "ansible.builtin.sudo" is not supported HOT 3
- Displaying file information for include_tasks when using the ansible-playbook command with the --list-tasks option HOT 5
- ansible-galaxy collection updates leave old dirs behind HOT 1
- service_facts returns non-existent services HOT 5
- Can ansible produce friendly messages? HOT 4
- Unable to do systemd (ansible module) restart for the tasks with pbrun. HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible.