Skip to content

Commit 4c06cd8

Browse files
committed
playbooks: Added Initial Ansible framework to deploy Intel features
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@intel.com>
1 parent 8cd73e2 commit 4c06cd8

5 files changed

+181
-0
lines changed

playbooks/README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Intel Technology Enabling Ansible Playbooks
2+
3+
## Overview
4+
This directory contains Ansible playbooks designed to automate the deployment and configuration of Intel technologies on Red Hat OpenShift clusters. These playbooks streamline the Intel feature provisioning and validation process on OpenShift environments.
5+
6+
## Prerequisites
7+
Before running the playbook, ensure the following prerequisites are met:
8+
- Provisioned RHOCP Cluster
9+
- Red Hat Enterprise Linux (RHEL) system with [Ansible](https://docs.ansible.com/ansible/2.9/installation_guide/intro_installation.html#installing-ansible-on-rhel-centos-or-fedora) installed and configured with a `kubeconfig` to connect to your RHOCP cluster.
10+
11+
## Run the Playbook
12+
13+
To run the ansible playbook, clone this repository to your RHEL system. Navigate to the directory containing the playbook.
14+
15+
```bash
16+
git clone https://github.com/intel/intel-technology-enabling-for-openshift.git
17+
18+
cd intel-technology-enabling-for-openshift/
19+
20+
ansible-playbook playbooks/intel_ocp_provisioning.yaml
21+
```

playbooks/configure_nfd.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- name: NFD - Create NFD discovery CR
2+
k8s:
3+
state: present
4+
definition: '{{ item }}'
5+
wait: yes
6+
wait_condition:
7+
type: Available
8+
status: 'False'
9+
with_items: '{{ lookup("url", "https://raw.githubusercontent.com/intel/intel-technology-enabling-for-openshift/main/nfd/node-feature-discovery-openshift.yaml", split_lines=False) | from_yaml_all | list }}'
10+
when: (item is not none)
11+
- name: NFD - Create NFD rules instance CR
12+
k8s:
13+
state: present
14+
definition: '{{ item }}'
15+
wait: yes
16+
with_items: '{{ lookup("url", "https://raw.githubusercontent.com/intel/intel-technology-enabling-for-openshift/main/nfd/node-feature-rules-openshift.yaml", split_lines=False) | from_yaml_all | list }}'
17+
when: (item is not none)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
- name: Create global OperatorGroup in openshift-operators namespace
2+
k8s:
3+
state: present
4+
definition:
5+
apiVersion: operators.coreos.com/v1alpha2
6+
kind: OperatorGroup
7+
metadata:
8+
name: global-operators
9+
namespace: openshift-operators
10+
11+
- name: Create Intel Device Plugins Operator Subscription
12+
k8s:
13+
state: present
14+
definition:
15+
apiVersion: operators.coreos.com/v1alpha1
16+
kind: Subscription
17+
metadata:
18+
labels:
19+
operators.coreos.com/intel-device-plugins-operator.openshiftoperators: ""
20+
name: intel-device-plugins-operator
21+
namespace: openshift-operators
22+
spec:
23+
channel: alpha
24+
installPlanApproval: Automatic
25+
name: intel-device-plugins-operator
26+
source: certified-operators
27+
sourceNamespace: openshift-marketplace

playbooks/install_nfd_operator.yaml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
- name: Create namespace for Node Feature Discovery
2+
k8s:
3+
state: present
4+
definition:
5+
apiVersion: v1
6+
kind: Namespace
7+
metadata:
8+
name: openshift-nfd
9+
10+
- name: Create operator group for Node Feature Discovery
11+
k8s:
12+
state: present
13+
definition:
14+
apiVersion: operators.coreos.com/v1
15+
kind: OperatorGroup
16+
metadata:
17+
generateName: openshift-nfd-
18+
name: openshift-nfd
19+
namespace: openshift-nfd
20+
spec:
21+
targetNamespaces:
22+
- openshift-nfd
23+
24+
- name: Subscribe to Node Feature Discovery operator
25+
k8s:
26+
state: present
27+
definition:
28+
apiVersion: operators.coreos.com/v1alpha1
29+
kind: Subscription
30+
metadata:
31+
name: nfd
32+
namespace: openshift-nfd
33+
spec:
34+
channel: "stable"
35+
installPlanApproval: Automatic
36+
name: nfd
37+
source: redhat-operators
38+
sourceNamespace: openshift-marketplace

playbooks/intel_ocp_provisioning.yaml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
- hosts: localhost
2+
gather_facts: no
3+
vars:
4+
kubeconfig_path: "~/.kube/mojave-config"
5+
environment:
6+
KUBECONFIG: "{{ kubeconfig_path }}"
7+
vars_prompt:
8+
- name: "install_operators"
9+
prompt: "Do you want to install operators? 'Yes' to install NFD Operator and Intel Device Plugins Operator, or 'No' to skip"
10+
private: no
11+
- name: "validation_feature"
12+
prompt: "Which Intel feature do you want to validate? Enter 1 for Intel SGX, 2 for Intel QAT, 3 for Intel DSA, 4 for Intel GPU"
13+
private: no
14+
15+
tasks:
16+
- name: Validate Inputs
17+
block:
18+
- name: Invalid Install Operators Input
19+
fail:
20+
msg: "Invalid input for Install Operators. Please enter a valid option for Install Operators (Yes/No)."
21+
when: install_operators not in ["Yes", "No"]
22+
- name: Invalid Validation Feature Input
23+
fail:
24+
msg: "Invalid input for validation feature. Please enter a valid option (1-4)."
25+
when: validation_feature not in ["1", "2", "3", "4"]
26+
27+
- name: Install Operators
28+
block:
29+
- name: NFD - Install NFD Operator
30+
include_tasks: install_nfd_operator.yaml
31+
- name: IDPO - Install Intel Device Plugins Operator
32+
include_tasks: install_device_plugins_operator.yaml
33+
- name: NFD - Wait until the nfd-operator-controller Deployment is available
34+
k8s_info:
35+
kind: Deployment
36+
wait: yes
37+
name: nfd-controller-manager
38+
label_selectors:
39+
- operators.coreos.com/nfd.openshift-nfd
40+
- control-plane=controller-manager
41+
namespace: openshift-nfd
42+
wait_condition:
43+
type: Available
44+
status: 'True'
45+
- name: NFD - Configure NFD Operator
46+
include_tasks: configure_nfd.yaml
47+
- name: IDPO - Wait until the inteldeviceplugins-controller-manager Deployment is available
48+
k8s_info:
49+
kind: Deployment
50+
name: inteldeviceplugins-controller-manager
51+
namespace: openshift-operators
52+
wait: yes
53+
wait_condition:
54+
type: Available
55+
status: 'True'
56+
reason: MinimumReplicasAvailable
57+
when: install_operators == "Yes"
58+
59+
- name: Skip Operator Installation
60+
debug:
61+
msg: "Skipping operator installation as per user input."
62+
when: install_operators == "No"
63+
64+
- name: Validate Intel SGX
65+
include_tasks: validate_sgx.yaml
66+
when: validation_feature == "1"
67+
68+
- name: Validate Intel QAT
69+
include_tasks: validate_gpu.yaml
70+
when: validation_feature == "2"
71+
72+
- name: Validate Intel DSA
73+
include_tasks: validate_qat.yaml
74+
when: validation_feature == "3"
75+
76+
- name: Validate Intel GPU
77+
include_tasks: validate_dsa.yaml
78+
when: validation_feature == "4"

0 commit comments

Comments
 (0)