Comments (4)
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.
The module returns detailed information about all of the services, not just a simple list.
- service:
state: stopped
name: ntpd.service
when: ansible_facts['services']['ntpd.service']['status'] | default('not-found') != 'not-found'
from ansible.
As flowerysong already stated (while i was about to post this), you have all the info to filter it already:
vars:
existing_systemd_services: '{{ ansible_facts['services'].values()|selectattr('status', 'equalto', 'systemd')|rejectattr('status', 'equalto', 'not-found')}'
from ansible.
Yes, but why force all users and every playbook to do that kind of filtering? What are the use cases where these non-existent services would be needed?
I would at the very least make an option available to either include or exclude non-existent services. Thanks.
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
- 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.