def print_ansible_conf(parser, prefix, namespace):
    values = parser.values

    for section in values:
        print '\n## [{0}] ##\n'.format(section)

        if len(values[section]['comments']) > 0:
            print_comments(values[section]['comments'], newline=2)

        for name, entry in values[section]['entries'].iteritems():
            if len(entry['comments']) > 0:
                print_comments(entry['comments'])

            val = value_to_yaml(entry)

            section = format_var_name(section)

            if section.lower() != 'default':
                name = "{0}_{1}".format(section.lower(), name)

            if namespace and not name.startswith(namespace):
                name = "{0}_{1}".format(namespace, name)

            if prefix:
                name = "{0}_{1}".format(prefix, name)

            name = format_var_name(name)

            if val is not None:
                conf_line = yaml.dump(dict([(name, val)]), indent=2,
                                      default_flow_style=False)
            else:
                conf_line = "{0}: \n".format(name)

            deprecated = False
            if not deprecated:
                print conf_line
            else:
                print "#{0}".format(conf_line)

    print """
## [CUSTOM] ##
#
# This is a hash of custom value configs to append to conf file
# Format: (json)
# {
#     'section': {
#         'name': 'value'
#     }
# }
    """
    print "{0}_{1}: {2}".format(prefix, namespace, '{}')
def print_ini_jinja(parser, prefix, namespace):
    values = parser.values

    for section in values:
        print '\n[{0}]\n'.format(section)

        if len(values[section]['comments']) > 0:
            print_comments(values[section]['comments'], newline=1)

        for name, entry in values[section]['entries'].iteritems():
            if len(entry['comments']) > 0:
                print_comments(entry['comments'])

            value = value_to_yaml(entry)
            value_type = infer_type(entry['comments'])

            var_name = name

            section = format_var_name(section)

            if section.lower() != 'default':
                var_name = "{0}_{1}".format(section.lower(), var_name)

            if namespace and not var_name.startswith(namespace):
                var_name = "{0}_{1}".format(namespace, var_name)

            if prefix:
                var_name = "{0}_{1}".format(prefix, var_name)

            var_name = format_var_name(var_name)

            if value_type == 'multi':
                print ("{{% if {1} is not string and {1} is sequence %}}\n"
                       "{{% for val in {1} %}}\n"
                       "{0}={{{{ val }}}}\n"
                       "{{% endfor %}}\n"
                       "{{% else %}}\n"
                       "{{% if {1} is none -%}}#{{%- endif -%}}\n"
                       "{0}={{{{ {1} }}}}\n"
                       "{{% endif %}}\n".format(name, var_name))
            else:
                if value_type in ['int', 'bool']:
                    print "{{% if {0} is none -%}}#{{%- endif -%}}".format(var_name)
                elif value_type in ['str', 'list', None] or value is None:
                    print "{{% if not {0} -%}}#{{%- endif -%}}".format(var_name)

                print "{0}={{{{ {1} }}}}\n".format(name, var_name)

    # custom section configs
    print """
#
# Custom section configs
#
{%% for section, keypair in %s | dictsort %%}
[{{ section }}]
{%% if keypair is not string %%}
{%% for name, value in keypair | dictsort %%}
{{ name }}={{ value }}
{%% endfor %%}
{%% endif %%}
{%% endfor %%}""" % "{0}_{1}".format(prefix, namespace)