ansible/base: Use map + join rather than a complicated loop
[noc.git] / ansible / roles / base / tasks / 07grub.yml
index d413ff6..a52f542 100644 (file)
@@ -3,6 +3,6 @@
   lineinfile:
     path: /etc/default/grub
     regexp: '^#?GRUB_CMDLINE_LINUX='
-    line: 'GRUB_CMDLINE_LINUX="{% for opt,val in (install.kernel_cmdline | default({})).items() %}{{ opt }}={{ val }}{% if not loop.last %} {% endif %}{% endfor %}"'
+    line: 'GRUB_CMDLINE_LINUX="{{ map(lambda opt, val: opt + "=" + val, (install.kernel_cmdline or {}).items()).join(" ") }}"'
   when: install is defined and install.kernel_cmdline is defined
   notify: update grub