Created
May 20, 2021 00:23
-
-
Save joejulian/488061e57a8496469af63b72e76eb2be to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- 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