Skip to content

Commit d58d708

Browse files
committed
Optimize copying of directories
The ansible copy module is pretty slow when copying directories especically if there are a lot of files. Switching to the synchronize module yields much better performance.
1 parent f276fb6 commit d58d708

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ansible/roles/compute_init/tasks/install.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
- tasks
1616

1717
- name: Inject files from roles
18-
copy:
18+
synchronize:
1919
src: '{{ item.src }}'
2020
dest: '/etc/ansible-init/playbooks/{{ item.dest }}'
21-
owner: root
22-
group: root
23-
mode: 0644
21+
archive: false
22+
rsync_opts: ["-p", "--chmod=D770,F644", "--owner=root", "--group=root"]
23+
recursive: true
24+
use_ssh_args: true
25+
become: true
2426
loop:
2527
- src: ../../resolv_conf/templates/resolv.conf.j2
2628
dest: templates/resolv.conf.j2

0 commit comments

Comments
 (0)