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

Commit

Permalink
Add AWS XRT packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
JGoutin committed Jul 18, 2019
1 parent cfc55fe commit 12f0689
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 36 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/Accelize/ansible-role-xilinx-xrt.svg?branch=master)](https://travis-ci.org/Accelize/ansible-role-xilinx-xrt)
[![Build Status](https://travis-ci.org/Accelize/ansible-role-xilinx_xrt.svg?branch=master)](https://travis-ci.org/Accelize/ansible-role-xilinx_xrt)

Xilinx XRT Ansible Role
=======================
Expand All @@ -16,6 +16,7 @@ Role Variables
--------------

* **xilinx_xrt_version**: Xilinx XRT version to install. Default to `2018.3`.
* **xilinx_xrt_aws**: If `true`, also install AWS XRT package. Default to `false`.

Example Playbook
----------------
Expand Down
18 changes: 14 additions & 4 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Xilinx XRT version to install
xilinx_xrt_version: 2019.1

# Install the AWS extension to XRT
xilinx_xrt_aws: false

# Internals variables
# -------------------

Expand All @@ -22,8 +25,15 @@ xilinx_xrt_packages:
rhel7_distribution_version: 7.4.1708

# Packages filenames
xrt_deb: "xrt_{{ xilinx_xrt_packages[xilinx_xrt_version] }}_\
{{ ansible_distribution_version }}-xrt.deb"
xrt_rpm: "xrt_{{ xilinx_xrt_packages[xilinx_xrt_version] }}_\
{{ rhel7_distribution_version }}-xrt.rpm"
prefix_deb: "xrt_{{ xilinx_xrt_packages[xilinx_xrt_version] }}_\
{{ ansible_distribution_version }}-"
prefix_rpm: "xrt_{{ xilinx_xrt_packages[xilinx_xrt_version] }}_\
{{ rhel7_distribution_version }}-"

xrt_deb: "{{ prefix_deb }}xrt.deb"
xrt_rpm: "{{ prefix_rpm }}xrt.rpm"
xrt_package: "{{ (ansible_os_family == 'Debian') | ternary(xrt_deb, xrt_rpm) }}"

aws_deb: "{{ prefix_deb }}aws.deb"
aws_rpm: "{{ prefix_rpm }}aws.rpm"
aws_package: "{{ (ansible_os_family == 'Debian') | ternary(aws_deb, aws_rpm) }}"
64 changes: 57 additions & 7 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,76 @@
---
# Default scenario that does not require a FPGA device to run.

dependency:
name: galaxy

driver:
name: docker

lint:
name: yamllint

platforms:
- name: ubuntu_bionic
- name: ubuntu_bionic-2019.1
image: ubuntu:bionic
groups:
- xrt_2019.1

- name: ubuntu_bionic-2018.3
image: ubuntu:bionic
privileged: true
- name: ubuntu_xenial
groups:
- xrt_2018.3

- name: ubuntu_bionic-2018.2
image: ubuntu:bionic
groups:
- xrt_2018.2

- name: ubuntu_xenial-2019.1
image: ubuntu:xenial
groups:
- xrt_2019.1

- name: ubuntu_xenial-2018.3
image: ubuntu:xenial
privileged: true
- name: centos_7
groups:
- xrt_2018.3

- name: ubuntu_xenial-2018.2
image: ubuntu:xenial
groups:
- xrt_2018.2

- name: centos_7-2019.1
image: centos:7
groups:
- xrt_2019.1

- name: centos_7-2018.3
image: centos:7
privileged: true
groups:
- xrt_2018.3

- name: centos_7-2018.2
image: centos:7
groups:
- xrt_2018.2

provisioner:
name: ansible
lint:
name: ansible-lint
inventory:
group_vars:
xrt_2019.1:
xilinx_xrt_version: 2019.1
xilinx_xrt_aws: true
xrt_2018.3:
xilinx_xrt_version: 2018.3
xilinx_xrt_aws: true
xrt_2018.2:
xilinx_xrt_version: 2018.2
xilinx_xrt_aws: false

verifier:
name: testinfra
lint:
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
- name: Converge
hosts: all
roles:
- role: ansible-role-xilinx-xrt
- role: ansible-role-xilinx_xrt
86 changes: 63 additions & 23 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,13 @@
path: /opt/xilinx/xrt/bin/xbutil
register: xbutil

- name: Ensure EPEL repository is installed
yum:
name: epel-release
state: present
install_weak_deps: false
retries: 10
delay: 1
when: ansible_os_family == 'RedHat'

- name: Create temporary directory
tempfile:
state: directory
prefix: xrt_
register: xrt_tmp
when: not xbutil.stat.exists

- name: Download XRT package from Xilinx website
get_url:
url: "https://www.xilinx.com/bin/public/openDownload?filename={{ item }}"
dest: "{{ xrt_tmp.path }}/{{ item }}"
with_items:
- "{{ xrt_package }}"
- "{{ xrt_package }}.digests"
- "{{ xrt_package }}.sig"
retries: 10
delay: 1
when: not xbutil.stat.exists

- name: Download Xilinx master signing key
get_url:
url: "https://www.xilinx.com/support/download/xilinx-master-signing-key.asc"
Expand All @@ -45,18 +24,39 @@
command: "gpg --import {{ xrt_tmp.path }}/xilinx-master-signing-key.asc"
when: not xbutil.stat.exists

- name: Verify package signature
- name: Download XRT package from Xilinx website
get_url:
url: "https://www.xilinx.com/bin/public/openDownload?filename={{ item }}"
dest: "{{ xrt_tmp.path }}/{{ item }}"
with_items:
- "{{ xrt_package }}"
- "{{ xrt_package }}.digests"
- "{{ xrt_package }}.sig"
retries: 10
delay: 1
when: not xbutil.stat.exists

- name: Verify XRT package signature
command: "gpg --verify {{ xrt_package }}.sig {{ xrt_package }}"
args:
chdir: "{{ xrt_tmp.path }}"
when: not xbutil.stat.exists

- name: Verify package checksum
- name: Verify XRT package checksum
command: sha512sum -c {{ xrt_package }}.digests
args:
chdir: "{{ xrt_tmp.path }}"
when: not xbutil.stat.exists

- name: Ensure EPEL repository is installed
yum:
name: epel-release
state: present
install_weak_deps: false
retries: 10
delay: 1
when: ansible_os_family == 'RedHat'

- name: Ensure XRT DEB package is installed
package:
deb: "{{ xrt_tmp.path }}/{{ xrt_package }}"
Expand All @@ -71,6 +71,46 @@
install_weak_deps: false
when: ansible_os_family == 'RedHat' and not xbutil.stat.exists

- name: Download AWS XRT package from Xilinx website
get_url:
url: "https://www.xilinx.com/bin/public/openDownload?filename={{ item }}"
dest: "{{ xrt_tmp.path }}/{{ item }}"
with_items:
- "{{ aws_package }}"
- "{{ aws_package }}.digests"
- "{{ aws_package }}.sig"
retries: 10
delay: 1
when: (xilinx_xrt_aws | bool) and not xbutil.stat.exists

- name: Verify AWS XRT package signature
command: "gpg --verify {{ aws_package }}.sig {{ aws_package }}"
args:
chdir: "{{ xrt_tmp.path }}"
when: (xilinx_xrt_aws | bool) and not xbutil.stat.exists

- name: Verify AWS XRT package checksum
command: sha512sum -c {{ aws_package }}.digests
args:
chdir: "{{ xrt_tmp.path }}"
when: (xilinx_xrt_aws | bool) and not xbutil.stat.exists

- name: Ensure AWS XRT DEB package is installed
package:
deb: "{{ xrt_tmp.path }}/{{ aws_package }}"
state: present
install_recommends: false
when: "(xilinx_xrt_aws | bool) and (ansible_os_family == 'Debian') and
not xbutil.stat.exists"

- name: Ensure AWS XRT RPM package is installed
yum:
name: "{{ xrt_tmp.path }}/{{ aws_package }}"
state: present
install_weak_deps: false
when: "(xilinx_xrt_aws | bool) and (ansible_os_family == 'RedHat') and
not xbutil.stat.exists"

- name: Clean up temporary directory
file:
path: "{{ xrt_tmp.path }}"
Expand Down

0 comments on commit 12f0689

Please sign in to comment.