BlockinFile module help

Hi Guys ,

I am using the below block for writing a variable values into a file

  • name: Add output of task for getting content to the local
    local_action:
    module: blockinfile
    path: “{{ File }}”
    marker: " "
    state: present
    block: |
    {{ item }}:
    {{ hostvars[item][‘CronOutput’].stdout | default([‘No Cron Entries’]) }}
    insertafter: EOF
    run_once: true
    with_items:
  • “{{ play_hosts }}”

In this for a host when there is not value in “CronOutput” variable , i want Default string to be printed into file for that host but it is not working , anyonw have an idea about the same?

I tried this also :
{{ hostvars[item][‘CronOutput’].stdout | default(‘No Cron Entries’) }}

{{ hostvars[item][‘CronOutput’].stdout | default(“No Cron Entries”) }}

Thanks in advance.