Skip to content

Instantly share code, notes, and snippets.

Created August 22, 2023 09:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Regex Filter playbook to process patterns for hostnames
- name: Regex Processing for hostnames
hosts: localhost
connection: local
gather_facts: false
eda_input: "{{ ansible_eda.event.payload.text }}" # access event payload
regex_pattern: '\b(\w+\.mydomain\.com)\b' # can supply via vars.yml
- name: Extract switch name from text
cacheable: yes
switch_devices: "{{ eda_input | regex_findall(regex_pattern) }}"
regex_proc: done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment