Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Commit

Permalink
Ensure kernel headers are present and add source step to .bashrc
Browse files Browse the repository at this point in the history
  • Loading branch information
JGoutin committed Nov 27, 2019
1 parent 004014c commit 23fdade
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ CentOS 7 is recommanded on AWS since AWS only provides packages for it.
Default to the classical Xilinx XRT environment.
* **xilinx_xrt_ensure_compatible_kernel**: If `true`, ensure the Linux kernel installed is compatible.
Default to `true`.
* **xilinx_xrt_bashrc**: If `true`, add the source of the XRT setup script to the user `~/.bashrc`.
Default to `false`.

### AWS FPGA

Expand Down
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Install Xilinx XRT
xilinx_xrt_install: true

# Add "source /opt/xilinx/xrt/setup.sh" to user "~/.bashrc"
xilinx_xrt_bashrc: false

# Xilinx XRT environement, default to Xilinx classical environement
xilinx_xrt_env: ''

Expand Down
45 changes: 45 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,23 @@
- not xbutil.stat.exists
- ansible_os_family == 'RedHat'

- name: Ensure Kernel headers RPM are installed
yum:
name:
- "kernel-devel-{{ ansible_kernel }}"
- "kernel-headers-{{ ansible_kernel }}"
state: present
install_weak_deps: false
enablerepo: C7.*
retries: 10
delay: 1
when:
- xilinx_xrt_install | bool
- not xbutil.stat.exists
- ansible_os_family == 'RedHat'
tags:
- molecule-notest # Bad detected kernel version from container

- name: Ensure XRT RPM package is installed
yum:
name: "{{ xrt_tmp.path }}/{{ xrt_package }}"
Expand All @@ -123,6 +140,25 @@
- ansible_os_family == 'RedHat'
- not xbutil.stat.exists

- name: Ensure APT cache is up to date
apt:
update_cache: true
changed_when: false
when:
- xilinx_xrt_install | bool
- ansible_os_family == 'Debian'
- not xbutil.stat.exists

- name: Ensure Kernel headers DEB are installed
apt:
name: "linux-headers-{{ ansible_kernel }}-generic"
when:
- xilinx_xrt_install | bool
- ansible_os_family == 'Debian'
- not xbutil.stat.exists
tags:
- molecule-notest # Bad detected kernel version from container

- name: Ensure XRT DEB package is installed
package:
deb: "{{ xrt_tmp.path }}/{{ xrt_package }}"
Expand All @@ -135,5 +171,14 @@
- ansible_os_family == 'Debian'
- not xbutil.stat.exists

- name: Ensure XRT is sourced in ~/.bashrc
lineinfile:
path: /home/{{ ansible_user }}/.bashrc
regexp: "^source /opt/xilinx/xrt/setup.sh"
line: source /opt/xilinx/xrt/setup.sh
when:
- xilinx_xrt_install | bool
- xilinx_xrt_bashrc | bool

- include_tasks: aws.yml
when: xilinx_xrt_env == 'aws'

0 comments on commit 23fdade

Please sign in to comment.