Initial project commit

This commit is contained in:
2024-12-16 19:59:57 -05:00
commit fa1b5cce00
3409 changed files with 460909 additions and 0 deletions

27
Untitled-1.yml Normal file
View File

@ -0,0 +1,27 @@
---
- name: Determine network interface name from IP address
hosts: localhost
tasks:
- name: Gather all facts
ansible.builtin.setup:
- name: Find the interface for a given IP address
set_fact:
interface_name: "{{ ansible_interfaces | map('regex_replace', '^', 'ansible_') | map('extract', ansible_facts) | selectattr('ipv4.address', 'equalto', '192.168.1.150') | map(attribute='device') | first }}"
- name: Display the interface name
debug:
msg: "The interface for IP address 192.168.1.150 is {{ interface_name }}"
---
- name: Count matches in a file
hosts: localhost
tasks:
- name: Search for the pattern in the file
shell: "grep -o 'pattern' /path/to/file | wc -l"
register: match_count
- name: Display the number of matches
debug:
msg: "Number of matches: {{ match_count.stdout }}"