'How to get shell command output to ansible variables file
I need to set variable in defaults\main.yml to something like:
eth1_ipaddress: {% /sbin/ifconfig eth0 | awk -F ' *|:' '/inet addr/{print $4}' %}
Is there a way to achieve this? I know this can be achived using shell and register module. But that is not what I am looking at since I need to add certain conditions before setting the variable value.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
