|
1 | 1 | --- |
| 2 | +- name: Query repositories |
| 3 | + pulp.squeezer.rpm_repository: |
| 4 | + pulp_url: "{{ pulp_url }}" |
| 5 | + username: "{{ pulp_username }}" |
| 6 | + password: "{{ pulp_password }}" |
| 7 | + validate_certs: "{{ pulp_validate_certs | bool }}" |
| 8 | + register: pulp_repos_list |
| 9 | + |
| 10 | +- name: Query publications |
| 11 | + pulp.squeezer.rpm_publication: |
| 12 | + pulp_url: "{{ pulp_url }}" |
| 13 | + username: "{{ pulp_username }}" |
| 14 | + password: "{{ pulp_password }}" |
| 15 | + validate_certs: "{{ pulp_validate_certs | bool }}" |
| 16 | + register: pulp_pubs_list |
| 17 | + |
2 | 18 | - name: Ensure RPM distributions are defined |
| 19 | + vars: |
| 20 | + repo: "{{ pulp_repos_list.repositories | selectattr('name', 'equalto', item.repository) | first }}" |
| 21 | + # If the distribution references a specific version: |
| 22 | + specific_pub: "{{ pulp_pubs_list.publications | selectattr('repository_version', 'equalto', repo.pulp_href ~ 'versions/' ~ item.version | default ~ '/') }}" |
| 23 | + # If the distribution uses the latest version: |
| 24 | + latest_pub: "{{ pulp_pubs_list.publications | selectattr('repository', 'equalto', repo.pulp_href) | sort(attribute='repository_version', reverse=True) }}" |
| 25 | + pub: "{{ latest_pub | first if item.version is not defined else specific_pub | first }}" |
3 | 26 | pulp.squeezer.rpm_distribution: |
4 | 27 | pulp_url: "{{ pulp_url }}" |
5 | 28 | username: "{{ pulp_username }}" |
6 | 29 | password: "{{ pulp_password }}" |
7 | 30 | validate_certs: "{{ pulp_validate_certs | bool }}" |
8 | 31 | name: "{{ item.name }}" |
9 | 32 | base_path: "{{ item.base_path }}" |
10 | | - publication: "{{ item.publication }}" |
| 33 | + publication: "{{ pub.pulp_href }}" |
11 | 34 | state: "{{ item.state }}" |
12 | 35 | with_items: "{{ pulp_distribution_rpm }}" |
0 commit comments