ansible-roles/networkd-to-ifconfig/tasks/set_facts_from_systemd.yml
Jérémy Lecour 57e5791728
All checks were successful
continuous-integration/drone/push Build is passing
networkd-to-ifconfig: add variables for configuration by variables
2020-04-26 18:39:25 +02:00

19 lines
674 B
YAML

---
- name: "Parse addresses"
shell: "grep Address= /etc/systemd/network/50-default.network | cut -d'=' -f2"
register: network_address_grep
check_mode: no
- name: "Parse gateways"
shell: "grep Gateway= /etc/systemd/network/50-default.network | cut -d'=' -f2"
register: network_gateway_grep
check_mode: no
- name: Prepare variables
set_fact:
eni_ipv4_address: "{{ network_address_grep.stdout_lines | ipv4 | first }}"
eni_ipv4_gateway: "{{ network_gateway_grep.stdout_lines | ipv4 | first }}"
eni_ipv6_address: "{{ network_address_grep.stdout_lines | ipv6 | first }}"
eni_ipv6_gateway: "{{ network_gateway_grep.stdout_lines | ipv6 | first }}"