I need to get the speed of the default ipv4 address; unfortunately, this information is contained within multiple facts.
The default ipv4 address can be found in the “ansible_default__ipv4.interface” fact. The speed is then gathered from the “ansible_.speed” fact.
I have tried a single variable and multiple variables to gather this info. I keep getting errors.
Am I approaching this right? Do I have a syntax issue?
vars:
`
default_eth: “{{ (ansible_default_ipv4.interface) }}”
bitrate: “{{ (ansible.{{ default_eth }}.speed)|int|abs }}”
`
Also tried:
`
bitrate: “{{ (ansible.{{ansible_default_ipv4.interface}}.speed)|int|abs }}”
`
Sample Failure:
`
fatal: [ansibletest-oel6]: FAILED! => {“failed”: true, “msg”: “{{ (ansible.{{default_eth}}.speed)|int|abs }}: template error while templating string: expected name or number. String: {{ (ansible.{{default_eth}}.speed)|int|abs }}”}
`