title: ERROR! failed at splitting arguments, either an unbalanced jinja2 block or quotes:
body: <p>I have a script that works in a bash shell.  I put it in Ansible and it causes the playbook to have an exception.</p>
  
  <pre><code>- name: add mnt to ignore_filesystems
    shell: |
      grep ignore_filesystem {{ cdm_path }} | awk -F'=' '{print $2}' | egrep '\^\\/mnt\*'
      if [ $? -eq 0 ]; then
          echo 'do nothing';
       else
          echo 'no';
          items=$(grep ignore_filesystem {{ cdm_path }} | awk -F'=' '{print $2}')
          if [ ${#items} -gt 1 ]; then
              echo 'making the change'
              sed -ie  '/ignore_filesystem/ s~$~|^\\/mnt*~' {{ cdm_path }}
          else
              echo 'making the change'
              sed -ie '/ignore_filesystem/ s~ignore_filesystem = *~ignore_filesystem = ^\\/mnt*~' {{ cdm_path }}
          fi
      fi
    register: ignore_filesystems
    changed_when: '"making the change" in ignore_filesystems.stdout'
  </code></pre>
  
  <p>I am getting the following message when trying to execute the playbook:</p>
  
  <pre><code>ERROR! failed at splitting arguments, either an unbalanced jinja2 block or quotes: grep ignore_filesystem {{ cdm_path }} | awk -F'=' '{print $2}' | egrep '\^\\/mnt\*'
  if [ $? -eq 0 ]; then
      echo 'do nothing';
  else
      echo 'no';
      items=$(grep ignore_filesystem {{ cdm_path }} | awk -F'=' '{print $2}')
      if [ ${#items} -gt 1 ]; then
          echo 'making the change'
          sed -ie  '/ignore_filesystem/ s~$~|^\\/mnt*~' {{ cdm_path }}
      else
          echo 'making the change'
          sed -ie '/ignore_filesystem/ s~ignore_filesystem = *~ignore_filesystem = ^\\/mnt*~' {{ cdm_path }}
      fi
  fi
  
  The error appears to have been in '/home/username/provisioning/provisioning/edit_nimbus.yml': 
  line 179, column 5, but may be elsewhere in the file depending on the exact syntax problem.
  
  The offending line appears to be:
  
  
    - name: add mnt to ignore_filesystems
      ^ here
  </code></pre>
  
  <p>Any thoughts on why this might be failing?</p>
  
  <p>=========================================================================</p>
  
  <p>UPDATE:</p>
  
  <p>Tried > as well as | and made all lines the same indentation level.  Still the same error</p>
  
  <pre><code>  - name: add mnt to ignore_filesystems
      shell: |
        grep 'ignore_filesystem' {{ cdm_path }}| awk -F'=' '{print $2}' | egrep '\^\\/mnt\*';
        if [ $? -eq 0 ]; then
        echo 'do nothing';
        else
        echo 'no';
        items=$(grep ignore_filesystem {{ cdm_path }} | awk -F'=' '{print $2}');
        if [ ${#items} -gt 1 ]; then
        echo 'making the change';
        sed -ie  '/ignore_filesystem/ s~$~|^\\/mnt*~' {{ cdm_path }};
        else
        echo 'making the change';
        sed -ie '/ignore_filesystem/ s~ignore_filesystem = *~ignore_filesystem = ^\\/mnt*~' {{ cdm_path }};
        fi;
        fi
  register: ignore_filesystems
  changed_when: '"making the change" in ignore_filesystems.stdout'
  </code></pre>