New stuffs again
This commit is contained in:
43
ifcfg_find.yml
Normal file
43
ifcfg_find.yml
Normal file
@ -0,0 +1,43 @@
|
||||
---
|
||||
- name: Ifcfg Find
|
||||
hosts: ifcfg
|
||||
become: false
|
||||
gather_facts: false
|
||||
|
||||
vars:
|
||||
find_search_path: /etc/sysconfig/network-scripts
|
||||
|
||||
|
||||
tasks:
|
||||
- name: "Find ifcfg alias files under {{ find_search_path }}"
|
||||
ansible.builtin.find:
|
||||
paths: "{{ find_search_path }}"
|
||||
use_regex: true
|
||||
patterns:
|
||||
- '.*ifcfg-.*$'
|
||||
excludes:
|
||||
- '^.*:\d+$'
|
||||
register: r_find_ifcfg
|
||||
|
||||
- name: Append results to list
|
||||
ansible.builtin.set_fact:
|
||||
find_res: "{{ find_res | default([]) + [item['path']] }}"
|
||||
loop: "{{ r_find_ifcfg['files'] }}"
|
||||
|
||||
- name: Debug r_find_ifcfg
|
||||
ansible.builtin.debug:
|
||||
var: r_find_ifcfg
|
||||
verbosity: 1
|
||||
|
||||
- name: Debug find_res
|
||||
ansible.builtin.debug:
|
||||
var: find_res
|
||||
verbosity: 1
|
||||
|
||||
- name: Find Results
|
||||
ansible.builtin.debug:
|
||||
msg: >
|
||||
Searched files: {{ r_find_ifcfg['examined'] }}
|
||||
Matches Found: {{ r_find_ifcfg['matched'] }}
|
||||
Files:
|
||||
{{ find_res | join(', ') }}
|
Reference in New Issue
Block a user