I am writing ansible template and I want that the template will create ntp.conf while keeping the lines after the ip address with the same amount of space To keep the lines straight and nice, the ntp.conf should look like:
server 10.13.1.1 restrict 10.13.1.1 mask 255.255.255.255 nomodify notrap noquery server 10.13.21.91 restrict 10.13.21.91 mask 255.255.255.224 nomodify notrap noquery server 10.13.16.26 restrict 10.13.16.26 mask 255.255.255.224 nomodify notrap noquery As you see the lines starting with 'mask' are organized with the same spacing but with my existing code on the template it not getting be aligned
Here is my code on the template:
note: restrict='mask 255.255.255.224 nomodify notrap noquery' {% for ns in default_ntpservers %} server {{ ns }} restrict {{ ns }}{{ restrict | indent( width=2, indentfirst=True) }} {% endfor %} I am getting on the client:
server 10.13.1.1 restrict 10.13.1.1 mask 255.255.255.255 nomodify notrap noquery server 10.13.21.91 restrict 10.13.21.91 mask 255.255.255.224 nomodify notrap noquery server 10.13.16.26 restrict 10.13.16.26 mask 255.255.255.224 nomodify notrap noquery