[Solved] ansible, jinja template with loops, losing newlines [duplicate]

And this little change actually made the problem go away in the end. #jinja2: trim_blocks:False { “Users”: [ {% for username,user in _vpn_user_accounts.items() %} { “Name” : “{{ user.name }}”, “Hash” : “{{ user.hash }}”, “Cns” : [ {%- for cn in user.cns.get(server_name, []) %} “{{ cn }}”{% if not loop.last -%},{% endif %} {%- … Read more

[Solved] how to start the forloop.counter from a different index

I’m not comfortable with Django, so I show a couple of option in plain Python, given the collections: something1 = [1,2,3,4] something2 = [1,2,3,4,5,6,7,8,9,10] You can access objects by index (not the same as database index): i = 1 for e1 in something1: print(e1) i += 1 for i2 in range(i,len(something2)): print(something2[i2]) Or slice the … Read more