bifrost/playbooks/roles/bifrost-download-packages/tasks/main.yml
Dmitry Tantsur b3818dc77c Do not install grub2 and shim on the host system
At least on the CI nodes it causes issues with grub-pc on Debian since
the CI nodes don't have bootloader configured. Download and extract
packages instead.

To account for Kolla (which has a split between the install and the
bootstrap phases), the downloaded files are cached in /use/lib/ironic.

Change-Id: I9307366db9579b194dcb88818ed0ce2fedb4baaf
2022-09-16 17:58:01 +02:00

55 lines
1.9 KiB
YAML

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
- name: "Fail if unsupported OS family"
fail:
msg: Only Debian and RedHat families are supported for bifrost-download-packages
when: ansible_os_family not in ['Debian', 'RedHat']
- name: "Get a string out of package list"
set_fact:
download_packages_string: "{{ download_packages | join(' ') }}"
- block:
- name: "Download {{ download_packages_string }}"
command: apt-get download {{ download_packages_string }} # noqa: command-instead-of-module
args:
chdir: "{{ download_dest }}"
- name: "Unpack {{ download_packages_string }}"
shell: >
dpkg-deb -R {{ download_dest }}/{{ item }}_*.deb {{ download_dest }}/{{ item }}
loop: "{{ download_packages }}"
when: ansible_os_family == 'Debian'
- block:
- name: "Download {{ download_packages_string }}"
command: >
dnf download --downloaddir {{ download_dest }} {{ download_packages_string }}
- name: "Create a subdirectory for the package {{ item }}"
file:
path: "{{ download_dest }}/{{ item }}"
state: directory
loop: "{{ download_packages }}"
- name: "Unpack {{ download_packages_string }}"
shell: |
set -eo pipefail
rpm2cpio {{ download_dest }}/{{ item }}-*.rpm | cpio -idm
args:
chdir: "{{ download_dest }}/{{ item }}"
executable: /bin/bash
loop: "{{ download_packages }}"
when: ansible_os_family == 'RedHat'