ret = []
for item0 in terms:
    if not isinstance(terms[item0], dict):
        raise errors.AnsibleError(
            "inidata lookup expects a dictionary, got '%s'" % terms[item0])
for item1 in terms[item0]:
    ret.append((item0, item1, terms[item0][item1]))
return ret
Как написать задачу Ansible, используя with_dict в цикле (with_items)