title: Ansible looping through files
body: <p>Prior to Ansible 2.5, the syntax for loops used to be <code>with_x</code>. Starting at 2.5, <code>loop</code> is favored and <code>with_x</code> basically disappeared from the docs.</p>
  
  <p>Still, the docs mention exemples of how to replace <code>with_x</code> with <code>loop</code>. But I'm clueless as to how we're now supposed to loop through a directory of files.</p>
  
  <p>Let's say I need to upload all the files within a given dir, I used to use <code>with_fileglob</code>.</p>
  
  <pre><code>- name: Install local checks
    copy:
      src: "{{ item }}"
      dest: /etc/sensu/plugins/
      owner: sensu
      group: sensu
      mode: 0744
    with_fileglob:
      - plugins/*
  </code></pre>
  
  <p>So what's the modern equivalent? Is it even possible? I know I still can use <code>with_fileglob</code> but as I'm writing new roles, I'd better have them future-proof. </p>