title: Iterate Over Yaml List with Ansible
body: <p>I have a variable defined in a vars.yml file that looks like this:</p>
  
  <pre><code>trust_table: ['first_hostname', 'second_hostname', ...]
  </code></pre>
  
  <p>I'd like to write an ansible step that will iterate over this list and write each hostname to a new line in a file. Basically the result would look like this:</p>
  
  <pre><code>$ cat host_file
  first_hostname
  second_hostname
  ...
  </code></pre>
  
  <p>So far I've looked at a few different types of ansible loops, but there doesn't appear to be much regarding looping over lists. I'm open to alternatives, like using some kind of template and then copying the template, but I wanted to check to see if anyone else has done something similar first.</p>