title: How to add a argument before each list element in ansible?
body: <p>I would like to add an argument before a string getting from a list with a join. How is that possible?</p>
  <p>My List definded as a variable in my ansible.yaml:</p>
  <pre class="lang-yaml prettyprint-override"><code>test:
    list:
       - /etc/a
       - /etc/b
       - /etc/c
  </code></pre>
  <p>With the above list I would like to get something like this when ansible is running</p>
  <p><code>ffmpeg -p /etc/a -p /etc/b/ -p /etc/c</code></p>
  <p>ffmpeg and argument is just a sample..</p>
  <p>How i need to configure my playbook task?</p>
  <pre class="lang-yaml prettyprint-override"><code>- name: Command
    shell: ffmpeg {{ test.list | map('regex_replace', '(^.*$)', '-p ') |join(' ') }}
  </code></pre>
  <p>The results of my task:</p>
  <pre><code>ffmpeg -p -p -p
  </code></pre>
  <p>EDIT:</p>
  <p>This is working thank you @Zeitounator</p>
  <pre class="lang-yaml prettyprint-override"><code>- name: Command
    shell: ffmpeg {{ test.list | map('regex_replace', '(^.*$)', '-p \\g&lt;1&gt; ') |join(' ') }}
  </code></pre>