From 12f068931cea72c61fc27ad47a1387059d26ce9c Mon Sep 17 00:00:00 2001 From: jgoutin <jgoutin@accelize.com> Date: Thu, 18 Jul 2019 10:37:00 +0200 Subject: [PATCH] Add AWS XRT packages. --- README.md | 3 +- defaults/main.yml | 18 ++++++-- molecule/default/molecule.yml | 64 +++++++++++++++++++++++--- molecule/default/playbook.yml | 2 +- tasks/main.yml | 86 +++++++++++++++++++++++++---------- 5 files changed, 137 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 501d543..dfb3f43 100644 --- a/README.md +++ b/README.md @@ -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 ======================= @@ -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 ---------------- diff --git a/defaults/main.yml b/defaults/main.yml index b423233..b217aa5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 # ------------------- @@ -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) }}" diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index fb8c419..bf71bcd 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -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: diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml index 542ed1b..100880e 100644 --- a/molecule/default/playbook.yml +++ b/molecule/default/playbook.yml @@ -2,4 +2,4 @@ - name: Converge hosts: all roles: - - role: ansible-role-xilinx-xrt + - role: ansible-role-xilinx_xrt diff --git a/tasks/main.yml b/tasks/main.yml index 2f42164..9ef05c7 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -5,15 +5,6 @@ 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 @@ -21,18 +12,6 @@ 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" @@ -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 }}" @@ -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 }}"