Skip to content

Instantly share code, notes, and snippets.

@joejulian
Created May 20, 2021 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joejulian/488061e57a8496469af63b72e76eb2be to your computer and use it in GitHub Desktop.
Save joejulian/488061e57a8496469af63b72e76eb2be to your computer and use it in GitHub Desktop.
---
- name: a
hosts: localhost
become: yes
tasks:
- name: check passed data
debug:
msg: "Finding the interface assigned {{ keepalived.virtual_ip }}"
- name: set interface fact
set_fact:
interface: "{{ item }}"
when:
- ansible_facts[item].ipv4 is defined
- ansible_facts[item].ipv4.address == keepalived.virtual_ip
with_items:
- "{{ ansible_interfaces }}"
- name: result
debug:
var: interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment