theforeman / foreman_ansible_inventory

Foreman dynamic inventory script for ansible - Now merged into Ansible itself
GNU General Public License v3.0
70 stars 31 forks source link

Support for complex types (JSON & YAML) without prefix #20

Closed arielsalvo closed 5 years ago

arielsalvo commented 8 years ago

Hi,

In case you want more options....

This is the same as #19 but without the prefix, also in reference to issue #17 .

Setting complex_types in the ini file to True (defaults to False) will parse all parameters, first as YAML and then JSON, and if any succeeds it is inserted into the inventory. If both fail, the string is inserted as-is.

This one needs much more testing in the "real world" to ensure it doesn't break existing functionality.

agx commented 8 years ago

On Wed, Aug 03, 2016 at 10:12:38AM -0700, Ariel Salvo wrote:

Hi,

In case you want more options....

This is the same as #19 but without the prefix, also in reference to issue #17 .

Setting complex_types in the ini file to True (defaults to False) will parse all parameters, first as YAML and then JSON, and if any succeeds it is inserted into the inventory. If both fail, the string is inserted as-is.

This should be JSON, YAML, string since JSON is a subset of YAML.

I'm still undecided if this is a good idea after all (especially if we're the only consumer that tries to interpret the data).

Cheers, -- Guido