I want to copy multiple files in playbooks, Currently i’m doing one by one
-
name: Copy tomcat to target server
copy: src=files/apache-tomcat-7.0.61.tar.gz dest=/tmp/apache-tomcat-7.0.61.tar.gz owner=root group=azureuser mode=0644
when: ansible_os_family == ‘Suse’ or ansible_os_family == ‘RedHat’ -
name: Copy file1 to target server
copy: src=files/file1 dest=/opt/file1 owner=azureuser group=root mode=0644
when: ansible_os_family == ‘Suse’ or ansible_os_family == ‘RedHat’
Is there a way to copy it recursively for many files with different destinations similar to below
- name: Install necessary package group
yum: name=“{{ item }}” state=present
with_items: - “libselinux-python”
- “git”
- “ksh”
- “httpd”
- “java-1.7.0-openjdk-devel”
when: ansible_os_family == ‘RedHat’