Skip to content

Commit f4aec06

Browse files
committed
Parallelise pulp_container_content
1 parent 83ddd5d commit f4aec06

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
---
2+
- name: Initialize active tasks list
3+
set_fact:
4+
pulp_container_active_tasks: []
5+
26
- name: Add or remove content units
37
include_tasks: process_content.yml
48
loop: "{{ pulp_container_content }}"
59
loop_control:
610
loop_var: content_item
11+
12+
- name: Wait for tasks to complete
13+
pulp.squeezer.task:
14+
pulp_url: "{{ pulp_url }}"
15+
username: "{{ pulp_username }}"
16+
password: "{{ pulp_password }}"
17+
validate_certs: "{{ pulp_validate_certs | bool }}"
18+
pulp_href: "{{ item }}"
19+
state: completed
20+
loop: "{{ pulp_container_active_tasks }}"
21+
when: pulp_container_content_wait | bool

roles/pulp_container_content/tasks/process_content.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,11 @@
118118
- content_units | length > 0
119119
changed_when: true
120120

121-
- name: Wait for task completion
122-
pulp.squeezer.task:
123-
pulp_url: "{{ pulp_url }}"
124-
username: "{{ pulp_username }}"
125-
password: "{{ pulp_password }}"
126-
validate_certs: "{{ pulp_validate_certs | bool }}"
127-
pulp_href: "{{ item.response.pulp_href }}"
128-
state: completed
121+
- name: Register active tasks
122+
set_fact:
123+
pulp_container_active_tasks: "{{ pulp_container_active_tasks + [item.response.pulp_href] }}"
129124
loop: "{{ [add_result, remove_result] }}"
130125
when:
126+
- item is defined
131127
- item.changed | default(false)
132-
- pulp_container_content_wait | bool
128+
- item.response.pulp_href is defined

0 commit comments

Comments
 (0)