-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
Implement 'pathglob' filter plugin and lookup plugin #17483
Conversation
@bcoca I noticed you closed the issues referenced in this PR today - is there any movement on accepting this? |
@bcoca @charlienewey would definitely be nice to have a Example here: - name: List all currently configured nodes in nodes directory
command: find /var/lib/jenkins/nodes -mindepth 1 -maxdepth 1 -type d -exec basename {} \;
register: existing_nodes
changed_when: False
- name: Remove all unmanaged slave nodes from the plugins directory
shell: rm -rf /var/lib/jenkins/nodes/{{ item }}
with_items: "{{ existing_nodes.stdout_lines }}"
when: item not in "{{ jenkins_slave_nodes | default([]) | map(attribute='name') | list }}" Where I'd rather like to write simply: - name: Remove all unmanaged slave nodes from the plugins directory
shell: rm -rf /var/lib/jenkins/nodes/{{ item | basename }}
with_dirglob:
- /var/lib/jenkins/nodes/*
when: "{{ item | basename }}" not in "{{ jenkins_slave_nodes | default([]) | map(attribute='name') | list }}" |
@charlienewey is there any reason you can't execute a shell command to find the dirs and files, register the output, and reference the registered in the next task? |
@calfonso That would be inconsistent behaviour, no? The |
I would prefer each plugin in it's own PR, mostly cause filter is much easier/saner to merge. filter:
lookup:
|
@calfonso thatcs really awkward to do, and |
Hi! Thanks very much for your submission to Ansible. It sincerely means a lot to us that you've taken time to contribute. Unfortunately, we're not sure if we want this feature in the program, and I don't want this to seem confrontational. Our reasons for this are because we already have the https://docs.ansible.com/ansible/latest/plugins/lookup/filetree.html However, we're absolutely always up for discussion. Since this is a really busy project, we don't always see comments on closed tickets, but want to encourage In the future, sometimes starting a discussion on the development list prior to implementing a feature can make getting things included a little easier, but it's not always necessary. Thank you once again for this and your interest in Ansible! |
ISSUE TYPE
Feature Pull Request
COMPONENT NAME
pathglob
filter pluginpathglob
lookup pluginSUMMARY
In response to comments in #17136 and #17269, alternative
pathglob
filter and lookup plugins to match both files and directories, or directories only (if specified in glob, e.g.{{ "/some/path/*/" | pathglob}}
).. This feature is suggested in #17480.