def create_extra_var_str(vars_dict):
    """
    This method encodes variables into an --extra-vars string
    :param vars_dict:
    :return: a string that can be added to the ansible-playbook exe
    """
    if len(vars_dict) < 1:
        return ''

    out_val = "--extra-vars='{"
    for key, value in vars_dict.items():
        out_val = '{}"{}":"{}",'.format(out_val, key, value)

    out_val = "{}{}".format(out_val[:-1], "}'")
    return out_val