ansible-roles/networkd-to-ifconfig/tasks/set_facts_from_systemd.yml
Jérémy Lecour ee21973371
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2777|524|2253|2462|:+1: Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/223//ansiblelint">Evolix » ansible-roles » unstable #223</a>
gitea/ansible-roles/pipeline/head This commit looks good
Use FQCN
Fully Qualified Collection Name
2023-03-20 23:33:19 +01:00

21 lines
740 B
YAML

---
- name: "Parse addresses"
ansible.builtin.shell:
cmd: "grep Address= /etc/systemd/network/50-default.network | cut -d'=' -f2"
register: network_address_grep
check_mode: no
- name: "Parse gateways"
ansible.builtin.shell:
cmd: "grep Gateway= /etc/systemd/network/50-default.network | cut -d'=' -f2"
register: network_gateway_grep
check_mode: no
- name: Prepare variables
ansible.builtin.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 }}"