|
31 | 31 | parameters: |
32 | 32 | name: "{{ content_item.src_repo }}" |
33 | 33 | register: src_repo_result |
34 | | - when: |
| 34 | + when: |
35 | 35 | - content_item.state | default('present') == 'present' |
36 | 36 | - content_item.src_repo is defined |
37 | 37 |
|
38 | 38 | - name: Fail if source repository not found |
39 | 39 | fail: |
40 | 40 | msg: "Source repository '{{ content_item.src_repo }}' not found." |
41 | | - when: |
| 41 | + when: |
42 | 42 | - content_item.state | default('present') == 'present' |
43 | 43 | - content_item.src_repo is defined |
44 | 44 | - src_repo_result.response.count == 0 |
|
75 | 75 | missing_tags: "{{ content_item.tags | difference(found_tags) }}" |
76 | 76 | fail: |
77 | 77 | msg: "Some tags not found in source repository: {{ missing_tags | join(', ') }}" |
78 | | - when: |
| 78 | + when: |
79 | 79 | - content_item.state | default('present') in ['present', 'read'] |
80 | 80 | - not content_item.allow_missing | default(false) |
81 | 81 | - missing_tags | length > 0 |
|
96 | 96 | body: |
97 | 97 | content_units: "{{ content_units }}" |
98 | 98 | register: add_result |
99 | | - when: |
| 99 | + when: |
100 | 100 | - content_item.state | default('present') == 'present' |
101 | 101 | - content_units | length > 0 |
102 | 102 | changed_when: true |
|
113 | 113 | body: |
114 | 114 | content_units: "{{ content_units }}" |
115 | 115 | register: remove_result |
116 | | - when: |
| 116 | + when: |
117 | 117 | - content_item.state | default('present') == 'absent' |
118 | 118 | - content_units | length > 0 |
119 | 119 | changed_when: true |
120 | 120 |
|
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] }}" |
129 | 124 | loop: "{{ [add_result, remove_result] }}" |
130 | | - when: |
| 125 | + when: |
| 126 | + - item is defined |
131 | 127 | - item.changed | default(false) |
132 | | - - pulp_container_content_wait | bool |
| 128 | + - item.response.pulp_href is defined |
0 commit comments