Ansible: multi line over playbook
<p>I have a question about multi line and Ansible playbook:</p>

<p>I have created a playbook with a line very large, I need to cut this line for better reading. How I can doing it?</p>

<pre><code>  - name: 'Create VM Azure :-P '
    shell: if ! grep {{ item }} /tmp/vm_{{ rgName }}; then azure vm create --vm-size {{ groups['item'][vmsize] }} --resource-group {{ rgName }} --name {{ item }} --location {{ location }} --admin-username {{ username }} --ssh-publickey-file {{ sshfile }} --storage-account-name {{ rgName | lower }} --os-type {{ groups['item'][type_os] }} --image-urn {{ image }} --data-disk-size {{ disksize }} --subnet-id {{ subnetid_key }} --nic-names {{ item }}; fi
    with_items: groups['test']
</code></pre>

<p>I would like to make it as follows way, but I have some errors when execute the playbook</p>

<pre><code>      - name: 'Create VM Azure :-P '
        shell: if ! grep {{ item }} /tmp/vm_{{ rgName }}; then 
                azure vm create --vm-size {{ groups['item'][vmsize] }} 
                --resource-group {{ rgName }} --name {{ item }} 
                --location {{ location }} --admin-username {{ username }} 
                --ssh-publickey-file {{ sshfile }} --storage-account-name {{ rgName | lower }} 
                --os-type {{ groups['item'][type_os] }} --image-urn {{ image }} 
                --data-disk-size {{ disksize }} --subnet-id {{ subnetid_key }} 
                --nic-names {{ item }}; fi
        with_items: groups['test']
</code></pre>

<p>The error:</p>

<p>ERROR! Syntax Error while loading YAML.</p>

<p>The error appears to have been in '/home/pvillarruel/docker/azure-ansible/data/playbook.yml': line 79, column 1, but may
be elsewhere in the file depending on the exact syntax problem.</p>

<p>The offending line appears to be:</p>

<pre><code>shell: if ! grep {{ item }} /tmp/vm_{{ rgName }}; then azure vm create --vm-size
   {{ groups['item'][vmsize] }} --resource-group {{ rgName }} --name {{ item }}
</code></pre>

<p>^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes.  Always quote template expression brackets when they
start a value. For instance:</p>

<pre><code>with_items:
  - {{ foo }}
</code></pre>

<p>Should be written as:</p>

<pre><code>with_items:
  - "{{ foo }}"
</code></pre>

<p>Thanks</p>