title: Multiple with_items for copy module
body: <p>I am trying to create switch backups. And i want to create dynamic files based on config output and switch hostname.
  As an example, the configuration of switch1 should be saved in file names hostname1, config of switch2 should be saved in file names hostname2 and so on.
  I am getting the hostnames from the switches from a file.</p>
  
  <p>And my problem is, that the config of switch1 gets saved in file hostname1, hostname2 etc.
  How can I loop the variables correctly to get the right config in the right file?</p>
  
  <p>My current playbook looks like this:</p>
  
  <pre><code>    ---
      - hosts: cisco
        connection: local
        gather_facts: false
  
        vars:
          backup_path: /etc/ansible/tests
  
          cli:
            host: "{{ inventory_hostname }}"
            username: test
            password: test
  
        tasks:
          - name: show run on  switches
            ios_command:
              commands: show running-config
              provider: "{{ cli }}"
            register: config
  
          - name: creating folder
            file:
              path: "{{ backup_path }}"
              state: directory
            run_once: yes
  
         - name: get hostnames
           become: yes
           shell: cat /etc/ansible/tests/hostname_ios.txt
           register: hostnames
  
        - name: copy config
          copy:
            content: "{{ config.stdout[0] }}"
            dest: "{{ backup_path }}/{{ item }}.txt"
          with_together:  "{{ hostnames.stdout_lines }}"
      ...
  </code></pre>