diff options
-rwxr-xr-x | functions.sh | 2 | ||||
-rw-r--r-- | playbooks/roles/pre-install/tasks/main.yml | 14 | ||||
-rw-r--r-- | playbooks/roles/pre-install/vars/Debian.yml | 6 | ||||
-rw-r--r-- | sw_config/bmra/patched_vfio.yml | 52 |
4 files changed, 73 insertions, 1 deletions
diff --git a/functions.sh b/functions.sh index a446acb..fce71f6 100755 --- a/functions.sh +++ b/functions.sh @@ -243,6 +243,8 @@ cp ${PROJECT_ROOT}/${INSTALLER}/{all.yml,kube-node.yml} \ ${PROJECT_ROOT}/container-experience-kits/group_vars/ cp ${PROJECT_ROOT}/${INSTALLER}/patched_cmk_build.yml \ ${PROJECT_ROOT}/container-experience-kits/roles/cmk_install/tasks/main.yml +cp ${PROJECT_ROOT}/${INSTALLER}/patched_vfio.yml \ + ${PROJECT_ROOT}/container-experience-kits/roles/sriov_nic_init/tasks/bind_vf_driver.yml sudo docker run --rm \ -e ANSIBLE_CONFIG=/bmra/ansible.cfg \ -e PROFILE=${BMRA_PROFILE} \ diff --git a/playbooks/roles/pre-install/tasks/main.yml b/playbooks/roles/pre-install/tasks/main.yml index da21c16..ba3e1c0 100644 --- a/playbooks/roles/pre-install/tasks/main.yml +++ b/playbooks/roles/pre-install/tasks/main.yml @@ -8,8 +8,10 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -- name: Ensure Python3 is installed (Equinix Metal) +- name: Ensure Python3 is installed for CentOS (Equinix Metal) raw: yum install -y python3 + ignore_errors: true + failed_when: false when: lookup('env', 'VENDOR') == 'equinix-metal' - name: Gather facts @@ -19,6 +21,16 @@ include_vars: file: "{{ ansible_os_family }}.yml" +- name: Update cache (RedHat) + yum: + update_cache: yes + when: ansible_os_family == "RedHat" + +- name: Update cache (Debian) + apt: + update_cache: yes + when: ansible_os_family == "Debian" + - name: Install BRMA requirements become: true package: diff --git a/playbooks/roles/pre-install/vars/Debian.yml b/playbooks/roles/pre-install/vars/Debian.yml new file mode 100644 index 0000000..1a7144b --- /dev/null +++ b/playbooks/roles/pre-install/vars/Debian.yml @@ -0,0 +1,6 @@ +--- +bmra_pkgs: + - lshw + - pciutils + - ethtool + - python3 diff --git a/sw_config/bmra/patched_vfio.yml b/sw_config/bmra/patched_vfio.yml new file mode 100644 index 0000000..c0a6e25 --- /dev/null +++ b/sw_config/bmra/patched_vfio.yml @@ -0,0 +1,52 @@ +## +## Copyright (c) 2020 Intel Corporation. +## +## 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. +## +--- +# check if the selected driver module is available on host +- name: Check that selected driver module is available + # if modinfo fails, lookup loaded modules as modinfo might return error + # for igb_uio and potentially other modules not included with the kernel + shell: "modinfo {{ vf_driver }} || grep {{ vf_driver }} /proc/modules || grep {{ vf_driver }} /lib/modules/$(uname -r)/modules.builtin" + register: shell_result + ignore_errors: yes + failed_when: no + changed_when: no + +# get a list of VFs PCI addresses and save the configuration +- name: attach VFs driver + block: + - name: fetch VFs pci addresses for a PF + shell: "for vf in /sys/class/net/{{ pfname }}/device/virtfn*;do basename $(readlink -f $vf);done" + register: vf_pciids + args: + executable: /bin/bash + changed_when: false + + - name: save VF driver binding + lineinfile: + path: "{{ sriov_config_path }}/bmra_interfaces" + line: "{{ this_item }} {{ vf_driver }}" + regexp: "^{{ this_item }}" + create: yes + owner: root + group: root + mode: '0600' + loop: "{{ vf_pciids.stdout_lines }}" + loop_control: + loop_var: this_item + when: + - vf_pciids.stderr|length == 0 + - vf_pciids.stdout_lines|length > 0 + when: shell_result.rc == 0 |