Skip to content
This repository has been archived by the owner on Jan 13, 2020. It is now read-only.

Commit

Permalink
Allow to download AWS SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
JGoutin committed Nov 6, 2019
1 parent dda3b73 commit 8e6e399
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Role Variables
No effect if *aws_fpga_allow_non_root* is `false`.
* **aws_fpga_sdk_override_group**: If true, do not raise error if the group specified by *aws_fpga_sdk_group* already exists.
Default to `false`. No effect if *aws_fpga_allow_non_root* is `false`.
* **aws_fpga_src_install**: If specified, install AWS FPGA sources in the specified directory.

* **aws_fpga_xrt**: If `true`, also install Xilinx XRT.
Default to `true`.
Expand Down
4 changes: 4 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ provisioner:
name: ansible
lint:
name: ansible-lint
inventory:
host_vars:
centos_7:
aws_fpga_src_install: /opt/aws_fpga

verifier:
name: testinfra
Expand Down
41 changes: 30 additions & 11 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,34 @@
tempfile:
state: directory
prefix: aws_fpga_
register: aws_fpga_src
when: not libfpga_mgmt.stat.exists
register: aws_fpga_tmp_src
when:
- not libfpga_mgmt.stat.exists
- aws_fpga_src_install is not defined

- name: Set AWS FPGA source directory
set_fact:
aws_fpga_src: "{{ aws_fpga_tmp_src.path }}"
when: aws_fpga_tmp_src.path is defined

- name: Ensure AWS FPGA source directory exists
file:
state: directory
path: "{{ aws_fpga_src_install }}"
when:
- aws_fpga_src_install is defined

- name: Set AWS FPGA source directory
set_fact:
aws_fpga_src: "{{ aws_fpga_src_install }}"
when:
- aws_fpga_src_install is defined

- name: Download and extract AWS FPGA release tarbal
unarchive:
src: "https://api.github.com/repos/aws/aws-fpga/tarball/\
{{ aws_fpga_version | default('') }}"
dest: "{{ aws_fpga_src.path }}"
dest: "{{ aws_fpga_src }}"
remote_src: true
extra_opts: ['--strip-components=1']
register: aws_sdk
Expand Down Expand Up @@ -55,7 +75,7 @@
when: ansible_os_family == 'RedHat' and not libfpga_mgmt.stat.exists

- name: Build and install AWS FPGA libraries and utilities
shell: "source {{ aws_fpga_src.path }}/sdk_setup.sh;"
shell: "source {{ aws_fpga_src }}/sdk_setup.sh;"
environment:
AWS_FPGA_ALLOW_NON_ROOT: "{{ aws_fpga_allow_non_root or '' }}"
AWS_FPGA_SDK_GROUP: "{{ aws_fpga_sdk_group }}"
Expand All @@ -69,7 +89,7 @@
- name: Download xrt/xrt-aws packages from AWS FPGA developper AMI
get_url:
url: "{{ s3_dev_ami_url }}{{ xrt_package }}-{{ item }}.rpm"
dest: "{{ aws_fpga_src.path }}/{{ xrt_package | basename }}-{{ item }}.rpm"
dest: "{{ aws_fpga_src }}/{{ xrt_package | basename }}-{{ item }}.rpm"
with_items:
- xrt
- aws
Expand All @@ -87,7 +107,7 @@

- name: Ensure xrt/xrt-aws packages are installed
yum:
name: "{{ aws_fpga_src.path }}/{{ xrt_package | basename }}-{{ item }}.rpm"
name: "{{ aws_fpga_src }}/{{ xrt_package | basename }}-{{ item }}.rpm"
state: present
with_items:
- xrt
Expand Down Expand Up @@ -115,11 +135,10 @@
- name: Build and install AWS FPGA driver
command: "{{ item }}"
args:
chdir: "{{ aws_fpga_src.path }}/sdk/linux_kernel_drivers/\
{{ aws_fpga_driver }}"
chdir: "{{ aws_fpga_src }}/sdk/linux_kernel_drivers/{{ aws_fpga_driver }}"
environment:
# Required for XOCL
SDACCEL_DIR: "{{ aws_fpga_src.path }}/SDAccel"
SDACCEL_DIR: "{{ aws_fpga_src }}/SDAccel"
with_items:
- /usr/bin/make -j
- /usr/bin/make install
Expand All @@ -128,6 +147,6 @@

- name: Clean up AWS FPGA temporary directory
file:
path: "{{ aws_fpga_src.path }}"
path: "{{ aws_fpga_tmp_src.path }}"
state: absent
when: not libfpga_mgmt.stat.exists and aws_fpga_src.path is defined
when: not libfpga_mgmt.stat.exists and aws_fpga_tmp_src.path is defined

0 comments on commit 8e6e399

Please sign in to comment.