mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
systemd_info - add wildcards support (#9821)
* systemd_info - add wildcards support * systemd_info - add wildcards fragments * systemd_info - improved dedicated functions * systemd_info - improved code and functions for better maintenance and timing * fix unitname description * removed redundancies and keys() in lists, replaced fnmatch with filter and run_command with cmdrunner * systemd_info - add new cmdrunner * systemd_info - fix runner * systemd_info - fix env in runner * systemd_info - rename runner and get_version * systemd_info - change args runner, fix fragment, add botmeta * systemd_info - merge type args
This commit is contained in:
parent
abe4e5ce95
commit
3bd0ab4a49
5 changed files with 221 additions and 109 deletions
|
@ -104,4 +104,36 @@
|
|||
- journal_extra.units['systemd-journald.service'].restart is defined
|
||||
- journal_extra.units['systemd-journald.service'].description == journald_shell.Description
|
||||
- journal_extra.units['systemd-journald.service'].restart == journald_shell.Restart
|
||||
success_msg: "Success: Extra property values are correct."
|
||||
success_msg: "Success: Extra property values are correct."
|
||||
|
||||
- name: Gather info using wildcard pattern for services
|
||||
community.general.systemd_info:
|
||||
unitname:
|
||||
- '*.service'
|
||||
extra_properties:
|
||||
- Description
|
||||
register: result_wildcards
|
||||
|
||||
- name: Assert that at least one service unit was returned
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- result_wildcards.units | length > 0
|
||||
|
||||
- name: Gather info using multiple wildcard patterns
|
||||
community.general.systemd_info:
|
||||
unitname:
|
||||
- '*.service'
|
||||
- 'ssh*'
|
||||
register: result_multi
|
||||
|
||||
- name: Debug multi-wildcard results
|
||||
ansible.builtin.debug:
|
||||
var: result_multi.units
|
||||
|
||||
- name: Assert deduplication of units
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- unique_keys | length == all_keys | length
|
||||
vars:
|
||||
all_keys: "{{ result_multi.units | dict2items | map(attribute='key') | list }}"
|
||||
unique_keys: "{{ all_keys | unique }}"
|
Loading…
Add table
Add a link
Reference in a new issue