oopen-server/scripts/test.yml
2019-06-28 02:28:50 +02:00

20 lines
687 B
YAML

---
- hosts: o25.oopen.de
tasks:
- name: debug print all interface ipv4 data
when: "hostvars[ansible_fqdn]['ansible_'~item]['ipv4'] is defined"
debug:
msg="{{ hostvars[ansible_fqdn]['ansible_'~item]['ipv4'] | pprint }}"
with_items:
- "{{ ansible_interfaces | map('replace', '-','_') | list }}"
- name: define traditional ethernet facts
set_fact:
ansible_eth: "{% set ansible_eth = ansible_eth|default([]) + [hostvars[inventory_hostname]['ansible_' + item]] %}{{ ansible_eth|list }}"
when: hostvars[inventory_hostname]['ansible_' + item]['type'] == 'ether'
with_items:
- "{{ hostvars[inventory_hostname]['ansible_interfaces'] }}"