markdownjekyllansibleoctopress

Jekyll print {{ in markdown


I want to print {{ in markdown.

This is a sample ansible script that I want to display in my blog.

- hosts: all
  remote_user: ubuntu
  become: True
  become_method: sudo
  become_user: root

  tasks:
    - name: Add user
      user:
          name="{{ user }}"
          shell=/bin/bash
          state=present
          groups=staff
          append=yes
          createhome=yes

But when I render in browser, it shows

- hosts: all
  remote_user: ubuntu
  become: True
  become_method: sudo
  become_user: root

  tasks:
    - name: Add user
      user:
          name=""
          shell=/bin/bash
          state=present
          groups=staff
          append=yes
          createhome=yes

If you see that, the name is not printing with {{ user }} but just "". Is there a way to print {{ }} ?


Solution

  • In a code block, you mean? Yes, it does.

    "{% raw %} {{ user}} {% endraw %}"
    

    Should do the job.

    Hope to have helped! :)