diff --git a/lib/ansible/inventory/ini.py b/lib/ansible/inventory/ini.py index 2c05253bb3..7d3f1636d7 100644 --- a/lib/ansible/inventory/ini.py +++ b/lib/ansible/inventory/ini.py @@ -54,7 +54,11 @@ class InventoryParser(object): def _parse_value(v): if "#" not in v: try: - return ast.literal_eval(v) + ret = ast.literal_eval(v) + if type(ret) == float: + # Do not trim floats. Eg: "1.20" to 1.2 + return v + return ret # Using explicit exceptions. # Likely a string that literal_eval does not like. We wil then just set it. except ValueError: