|
1 | 1 | ---
|
2 | 2 | - name: Push OFED packages
|
3 | 3 | hosts: ofed-builder
|
| 4 | + vars: |
| 5 | + venv: "/opt/kayobe/venvs/kayobe" |
| 6 | + doca_extract_path: "/home/stack/doca" |
4 | 7 | tasks:
|
| 8 | + - name: Get OFED module repo variables |
| 9 | + ansible.builtin.set_fact: |
| 10 | + doca_modules_repo_name: "{{ stackhpc_pulp_rpm_repos | selectattr('name', 'search', 'OFED') | map(attribute='name') | join('') }}" |
| 11 | + doca_modules_repo_base_path: "{{ stackhpc_pulp_rpm_repos | selectattr('name', 'search', 'OFED') | map(attribute='base_path') | join('') }}" |
| 12 | + doca_modules_repo_distribution_name: "{{ stackhpc_pulp_rpm_repos | selectattr('name', 'search', 'OFED') | map(attribute='distribution_name') | join('') }}" |
| 13 | + |
5 | 14 | - name: Install python dependencies
|
6 | 15 | ansible.builtin.pip:
|
7 | 16 | name: pulp-cli
|
8 | 17 |
|
9 |
| - - name: Create Pulp repository for OFED |
| 18 | + - name: Ensure Pulp configuration directory exists |
| 19 | + ansible.builtin.file: |
| 20 | + path: /home/stack/.config/pulp/ |
| 21 | + state: directory |
| 22 | + recurse: true |
| 23 | + |
| 24 | + - name: Setup Pulp credentials |
| 25 | + ansible.builtin.blockinfile: |
| 26 | + path: /home/stack/.config/pulp/cli.toml |
| 27 | + create: true |
| 28 | + block: | |
| 29 | + [cli] |
| 30 | + base_url = '{{ stackhpc_release_pulp_url }}' |
| 31 | + verify_ssl = true |
| 32 | + format = "json" |
| 33 | + username = '{{ stackhpc_release_pulp_username }}' |
| 34 | + password = '{{ stackhpc_release_pulp_password }}' |
| 35 | + no_log: true |
| 36 | + |
| 37 | + - name: Find DOCA kernel repo package |
| 38 | + ansible.builtin.shell: |
| 39 | + cmd: 'find /tmp/DOCA.* -name doca-kernel-repo-*' |
| 40 | + register: doca_kernel_repo |
| 41 | + changed_when: false |
| 42 | + |
| 43 | + - name: Unpackage kernel repo |
| 44 | + ansible.builtin.shell: |
| 45 | + cmd: "rpm2cpio {{ doca_kernel_repo.stdout }} | cpio -idmv -D {{ doca_extract_path }}" |
| 46 | + |
| 47 | + - name: Find extracted kernel packages |
| 48 | + ansible.builtin.shell: |
| 49 | + cmd: 'find {{ doca_extract_path }}/usr/share/doca-host-*/Modules/$(uname -r)/*.rpm' |
| 50 | + register: doca_kernel_packages |
| 51 | + |
| 52 | + - name: Create Pulp repository for DOCA kernel modules |
10 | 53 | pulp.squeezer.rpm_repository:
|
11 | 54 | pulp_url: "{{ stackhpc_release_pulp_url }}"
|
12 | 55 | username: "{{ stackhpc_release_pulp_username }}"
|
13 | 56 | password: "{{ stackhpc_release_pulp_password }}"
|
14 |
| - name: "{{ stackhpc_pulp_repo_doca_ofed_rhel9.name }}" |
| 57 | + name: "{{ doca_modules_repo_name }}" |
15 | 58 | state: present
|
16 | 59 | retries: "{{ pulp_timeout_retries | default(3) }}"
|
17 | 60 |
|
18 |
| - - name: Lookup Pulp RPMs on builder |
19 |
| - ansible.builtin.find: |
20 |
| - paths: "/home/cloud-user/ofed" |
21 |
| - register: rpm_dir |
22 |
| - |
23 | 61 | - name: Upload OFED RPMs to Pulp
|
24 | 62 | ansible.builtin.shell:
|
25 | 63 | cmd: |
|
26 |
| - pulp \ |
27 |
| - --base-url '{{ stackhpc_release_pulp_url }}' \ |
28 |
| - --username '{{ stackhpc_release_pulp_username }}' \ |
29 |
| - --password '{{ stackhpc_release_pulp_password }}' \ |
| 64 | + {{ venv }}/bin/pulp \ |
30 | 65 | rpm content \
|
31 | 66 | --type package upload \
|
32 |
| - --repository '{{ stackhpc_pulp_repo_doca_ofed_rhel9.name }}' \ |
33 |
| - --file {{ item.path }} \ |
34 |
| - with_items: "{{ rpm_dir.files }}" |
35 |
| - no_log: true |
| 67 | + --repository '{{ doca_modules_repo_name }}' \ |
| 68 | + --file {{ item }} \ |
| 69 | + --no-publish \ |
| 70 | + with_items: "{{ doca_kernel_packages.stdout_lines }}" |
36 | 71 |
|
37 | 72 | - name: Create Pulp publication for OFED
|
38 | 73 | pulp.squeezer.rpm_publication:
|
39 | 74 | pulp_url: "{{ stackhpc_release_pulp_url }}"
|
40 | 75 | username: "{{ stackhpc_release_pulp_username }}"
|
41 | 76 | password: "{{ stackhpc_release_pulp_password }}"
|
42 |
| - repository: "{{ stackhpc_pulp_repo_doca_ofed_rhel9.name }}" |
| 77 | + repository: "{{ doca_modules_repo_name }}" |
43 | 78 | state: present
|
44 | 79 | register: publication
|
45 | 80 |
|
|
48 | 83 | pulp_url: "{{ stackhpc_release_pulp_url }}"
|
49 | 84 | username: "{{ stackhpc_release_pulp_username }}"
|
50 | 85 | password: "{{ stackhpc_release_pulp_password }}"
|
51 |
| - name: "{{ stackhpc_pulp_repo_doca_ofed_rhel9.distribution_name }}" |
| 86 | + name: "{{ doca_modules_repo_distribution_name + ofed_tag }}" |
52 | 87 | publication: "{{ publication.publication.pulp_href }}"
|
53 |
| - base_path: "{{ stackhpc_pulp_repo_doca_ofed_rhel9.base_path }}" |
| 88 | + content_guard: development |
| 89 | + base_path: "{{ doca_modules_repo_base_path }}/{{ ofed_tag }}" |
54 | 90 | state: present
|
0 commit comments