I need a way to speed up my playbook, maybe better logical structuring. It’s running sequentially now. The task is simple – run playbook from AWX that will backup list of VMs.
I’m supplying list of VMs in AWX extra variables:
`
backupList:
- vmName: VM1
backupAge: 2d - vmName: VM2
backupAge: 5d - vmName: VM3
backupAge: 1d
backupDirectory:/vmfs/volumes/NFS_BACKUPS
`
The first playbook is simple:
`
- name: Process VM backup here
include_tasks: processBackup.yml
vars:
vm_name: “{{ item.vmName }}”
backupAge: “{{ item.backupAge }}”
with_items: “{{ backupList }}”
`
It reads extra variables and loops through calling second playbook using “include_tasks” where all functionality is written: cloning VM, copy to NFS server and making sure we keep the defined amount of copies.
Basically the same set of tasks performed with different VM names and backup age. In this configuration, it is executed sequentially and takes a long time, especially the copy part to a backup server.
So, I’m wondering if there is a better way to restructure the code to run tasks simultaneously for each VM name?
Thanks