Hi,

More indentation doesn't work. Maybe i should think of some other approach 
entirely.
Thanks for your help.

BR,
Ishan

On Tuesday, 27 February 2018 17:22:25 UTC+1, Kai Stian Olstad wrote:
>
> On Tuesday, 27 February 2018 16.54.17 CET ishan jain wrote: 
> > Hi, 
> > 
> > To add markers in all of them, i either have the option of lineinefile 
> with 
> > regex or this. Regex for such a case look almost impossible. So i have 
> to 
> > make this work. 
> > 
> > When i print the complete  *yamlVars*, it works perfectly fine. Can i 
> not 
> > append each key-value pair to a temporary dictionary and print that 
> > dictionary ? 
>
> Have you tried this for 2 space indentation 
>
> # BEGIN BLOCK {{ key }} 
> {{ key }}: 
>   {{ value | to_nice_yaml(indent=2) }} 
> # END BLOCK {{ key }} 
>
> for 4 space you can use this 
> # BEGIN BLOCK {{ key }} 
> {{ key }}: 
>     {{ value | to_nice_yaml(indent=4) }} 
> # END BLOCK {{ key }} 
>
> You will never managed to create this with to_nice_yaml 
> keyA: 
>   A1: 
>     - bla 
>     - bla 
>
> Since the correct 2 space indentation is 
> keyA: 
>   A1: 
>   - bla 
>   - bla 
>
> But if you can live with that the code above should work. 
>
> Another thing, dictionary is not sorted so you can get different order of 
> the keyX between subsequent runs. 
>
> -- 
> Kai Stian Olstad 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/57fcba9b-7a8f-4205-a1d0-3bce15c1eb24%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to