Michael can correct me if I'm wrong but I believe we're moving more
and more to json for communicating between modules and ansible core.
So we probably wouldn't be adding additional use of ini at that level.
Note that for simple return values, (which is hopefully all you're
doing with ini ;-) json is only a little harder to generate in shell.
Substitute something like this:
# ini:
printf '[myfact]\n'
for key in foo bar ; do
for value in `seq 1 2` ; do
printf '%s%s=%s\n' $key $value $value
done
done
with this:
# json
output='{ "myfact": { '
for key in foo bar ; do
for value in `seq 1 2` ; do
output+=`printf '"%s%s":%s,' $key $value $value`
done
done
output=`echo $output | sed 's/,$//'`
printf '%s } }\n' "$output"
JSON has slightly more verbosity (the curly braces to mark where the
data structures begin and end) and you have to add a bit of logic to
make sure your sequence of values does not end with a comma but it's
not too bad. Nothing like *shudder* writing XML in shell ;-)
-Toshio
On Thu, Nov 13, 2014 at 11:37 PM, <[email protected]> wrote:
> Hi,
>
> I start learning Ansible with a Puppet background, so the concept of
> executable facts is well-known. Sometimes it is easier to write a little
> shell script for a custom fact, so my question is, is it planned to support
> INI format as output for executable facts? It would make easier writing
> custom facts in shell.
>
> Regards,
>
> Sandra
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/8476294d-e20f-4ab5-9277-0b18010413fd%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAG9juErWdxbyVOM9tcP6BHD0FY-Dt%2Bs3TMiY4G3QDjs4Q%3DOgXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.