Skip to content

Commit 13ed0e5

Browse files
authored
Merge pull request #283 from nitinsyadav/master
Added new lab 'Red Hat Insights with Ansible Remediation' with SSO integration
2 parents 8d588ee + 25fef08 commit 13ed0e5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+651
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
slug: join-red-hat-developer-portal
3+
id: ydreemphzxs9
4+
type: challenge
5+
title: Join Red Hat Developer at no cost
6+
teaser: Join Red Hat Developer at no cost
7+
tabs:
8+
- title: Red Hat Login
9+
type: browser
10+
hostname: rhd-login
11+
difficulty: ""
12+
---
13+
Before you proceed with the next challenge, please take a moment to register for Red Hat Developer. If you already have a Red Hat account, you can use the same login credentials.
14+
15+
This will help us assess user satisfaction and enable us to provide more curated content.
16+
17+
Click on the `Check` button at the bottom once you have registered or logged in.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
set -euxo pipefail
3+
echo 'logincheck'
4+
if [ "${LOGGEDIN-0}" = "1" ]; then
5+
echo 'loggedin'
6+
exit 0
7+
fi
8+
9+
rm -f /home/user/checkResult.json
10+
rm -f /home/user/checkAssets.json
11+
rm -f /home/user/checkError.txt
12+
13+
14+
echo 'dropdown check'
15+
echo '{"location":{"conditions":[{"url":"redhat.com","condition":"contains"}]},"innerText":[{"selector":"html \u003e body","value":"Please click on Check button in the bottom right of your screen to continue with the Lab."}]}' > /home/user/checkAssets.json
16+
until [ -f /home/user/checkResult.json ]; do
17+
sleep 1
18+
done
19+
if grep "SUCCESS" /home/user/checkResult.json; then
20+
echo 'account dropdown'
21+
exit 0
22+
fi
23+
24+
25+
rm -f /home/user/checkResult.json
26+
rm -f /home/user/checkAssets.json
27+
rm -f /home/user/checkError.txt
28+
29+
30+
echo 'email check'
31+
echo '{"location":{"conditions":[]},"innerText":[{"selector":"html \u003e body","value":"Email address verification"}]}' > /home/user/checkAssets.json
32+
until [ -f /home/user/checkResult.json ]; do
33+
sleep 1
34+
done
35+
cat /home/user/checkResult.json
36+
if grep "SUCCESS" /home/user/checkResult.json; then
37+
echo 'email validation'
38+
exit 0
39+
fi
40+
fail-message "Please login and click 'Check' button."
41+
exit 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
slug: register-system
3+
id: dfke7iiruily
4+
type: challenge
5+
title: Register system
6+
teaser: Register host with Red Hat Subscription Manager
7+
notes:
8+
- type: text
9+
contents: In this challenge, we will register the host with the help of a Red Hat
10+
subscription-manager.
11+
tabs:
12+
- title: Terminal
13+
type: terminal
14+
hostname: ubi9
15+
- title: RH portal
16+
type: browser
17+
hostname: console
18+
difficulty: ""
19+
---
20+
## Add Red Hat Subscription to host
21+
- To view the current subscription status of host.
22+
```
23+
subscription-manager status
24+
```
25+
- Register the host, using following command.
26+
```
27+
subscription-manager register
28+
```
29+
> [!IMPORTANT]
30+
> If the subscription-manager registration fails, please proceed to the **console** tab, log in, and complete the form.
31+
> Please attempt to register the host with subscription-manager again.
32+
33+
After successful registration, click on the **check** button.
34+
35+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
output=$(subscription-manager status)
4+
5+
search_string="Unknown"
6+
7+
if echo "$output" | grep -q "$search_string"; then
8+
FAIL "Host is not registered using subscription-manager. Please redo the steps for registration."
9+
exit -1
10+
else
11+
exit 0
12+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
slug: install-gcc-tool-set
3+
id: qm2rxeocoifg
4+
type: challenge
5+
title: Install GCC Tool Set
6+
teaser: Download and install GCC Toolset
7+
notes:
8+
- type: text
9+
contents: In this challenge, we will fetch and install the GCC Toolset packages
10+
on UBI9.
11+
tabs:
12+
- title: Terminal
13+
type: terminal
14+
hostname: ubi9
15+
difficulty: ""
16+
---
17+
# Set up your development environment
18+
In this step, you will use a single command to download and install GCC 12.x and other development tools that are part of the Red Hat Developer Toolset.
19+
20+
Download and install the development tools package group, which includes GNU Compiler Collection (GCC), GNU Debugger (GDB), and other development tools, using following command :
21+
```
22+
dnf group install "Development Tools" -y
23+
```
24+
After installation of GCC Toolset, click on the **check** button.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# Check if GCC is installed
4+
if command -v g++ >/dev/null 2>&1; then
5+
echo "GCC is installed on this system."
6+
# Check GCC version
7+
gcc_version=$(g++ --version | grep -oP '(?<=gcc \(GCC\) )\d+\.\d+\.\d+')
8+
echo "GCC version: $gcc_version"
9+
else
10+
FAIL "GCC is not installed on this system."
11+
fi
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
slug: step3
3+
id: qesyzrfwqyn8
4+
type: challenge
5+
title: Run sample C++ app using GCC toolset
6+
teaser: Run sample app of c++
7+
notes:
8+
- type: text
9+
contents: Compile the C++ sample app using the GCC command-line interface (CLI)
10+
and execute it.
11+
tabs:
12+
- title: Terminal
13+
type: terminal
14+
hostname: ubi9
15+
difficulty: ""
16+
---
17+
# Fetch sample app and run with GCC Toolsets
18+
We will clone the repository of a sample C++ app using git command.
19+
```
20+
git clone https://github.com/redhat-developer-demos/gcc-sample-app.git && cd gcc-sample-app
21+
```
22+
23+
With help of GCC cli, compile the sample app as shown below.
24+
25+
```
26+
g++ -o hello hello.cpp
27+
```
28+
Ensure sample has been compiled and verify it is marked executable using the following command.
29+
```
30+
ls
31+
```
32+
Execute the compiled file using following command.
33+
```
34+
./hello
35+
```
36+
After successful execution, you will see the message `Hello, Red Hat Developers Program World` on the terminal.
37+
Congratulations!! You have completed the GCC lab. Click on the **check** button to end the lab.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
output=$(./hello)
4+
5+
search_string="Hello, Red Hat Developers Program World!"
6+
7+
if echo "$output" | grep -q "$search_string"; then
8+
FAIL "Host is not registered using subscription-manager. Please redo the steps for registration."
9+
exit -1
10+
else
11+
exit 0
12+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash/
2+
dnf install git -y
8.73 KB
Binary file not shown.
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: "3"
2+
containers:
3+
- name: ubi9
4+
image: registry.access.redhat.com/ubi9/ubi:latest
5+
shell: /bin/bash
6+
memory: 2000
7+
virtualbrowsers:
8+
- name: console
9+
url: https://developers.redhat.com/content-gateway/link/3881693
10+
- name: rhd-login
11+
url: https://developers.redhat.com/node/284339?auHash=5k9QV-yD0z-jAU7XkJyq1TUxhVyyZVLiuZz7tsfTz_s&offerid=3882357

instruqt-tracks/gcc-on-ubi9/track.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
slug: gcc-on-ubi9
2+
id: enbygnza4tye
3+
title: GCC Toolset on UBI9
4+
description: ' In this lab, where we will delve into the installation of the GCC toolset
5+
on UBI9 and demonstrate the compilation of a C++ sample app using the GCC command-line
6+
interface. This feature in UBI 9 is invaluable for streamlining repository management
7+
and enhancing overall development experience.'
8+
icon: .\assets\rhel.webp
9+
tags:
10+
- rhel
11+
- ubi
12+
owner: openshift
13+
developers:
14+
15+
16+
timelimit: 1200
17+
lab_config:
18+
overlay: false
19+
width: 33
20+
position: right
21+
feedback_recap_enabled: true
22+
loadingMessages: true
23+
checksum: "16301492881940289186"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
slug: join-red-hat-developer-portal
3+
id: qmuinntlsiia
4+
type: challenge
5+
title: Join Red Hat Developer at no cost
6+
teaser: Join Red Hat Developer at no cost
7+
tabs:
8+
- title: Red Hat Login
9+
type: browser
10+
hostname: rhd-login
11+
difficulty: ""
12+
---
13+
Before you proceed with the next challenge, please take a moment to register for Red Hat Developer. If you already have a Red Hat account, you can use the same login credentials.
14+
15+
This will help us assess user satisfaction and enable us to provide more curated content.
16+
17+
Click on the `Check` button at the bottom once you have registered or logged in.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
set -euxo pipefail
3+
echo 'logincheck'
4+
if [ "${LOGGEDIN-0}" = "1" ]; then
5+
echo 'loggedin'
6+
exit 0
7+
fi
8+
9+
rm -f /home/user/checkResult.json
10+
rm -f /home/user/checkAssets.json
11+
rm -f /home/user/checkError.txt
12+
13+
14+
echo 'dropdown check'
15+
echo '{"location":{"conditions":[{"url":"redhat.com","condition":"contains"}]},"innerText":[{"selector":"html \u003e body","value":"Please click on Check button in the bottom right of your screen to continue with the Lab."}]}' > /home/user/checkAssets.json
16+
until [ -f /home/user/checkResult.json ]; do
17+
sleep 1
18+
done
19+
if grep "SUCCESS" /home/user/checkResult.json; then
20+
echo 'account dropdown'
21+
exit 0
22+
fi
23+
24+
25+
rm -f /home/user/checkResult.json
26+
rm -f /home/user/checkAssets.json
27+
rm -f /home/user/checkError.txt
28+
29+
30+
echo 'email check'
31+
echo '{"location":{"conditions":[]},"innerText":[{"selector":"html \u003e body","value":"Email address verification"}]}' > /home/user/checkAssets.json
32+
until [ -f /home/user/checkResult.json ]; do
33+
sleep 1
34+
done
35+
cat /home/user/checkResult.json
36+
if grep "SUCCESS" /home/user/checkResult.json; then
37+
echo 'email validation'
38+
exit 0
39+
fi
40+
fail-message "Please login and click 'Check' button."
41+
exit 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
slug: rhd-registration
3+
id: udiehz8degwo
4+
type: challenge
5+
title: Register at Red Hat Developer Portal
6+
teaser: Register at the Red Hat Developer Portal.
7+
notes:
8+
- type: text
9+
contents: In this challenge, we will register with the Red Hat Developer Portal
10+
and Red Hat Console which provides access to all Red Hat services in one location.
11+
We will also verify access and version of the test host that will be used in the
12+
lab.
13+
tabs:
14+
- title: Terminal
15+
type: terminal
16+
hostname: rhel
17+
- title: Console
18+
type: browser
19+
hostname: console
20+
difficulty: ""
21+
---
22+
## Register with Red Hat Developer
23+
- Click on the `Console` tab.
24+
- If you have registered with Red Hat earlier, use your credentials to complete the registration process. Alternatively, register for a free account to access Red Hat product trials and technical content.
25+
26+
## Verify host access & version
27+
- A virtual machine with RHEL 9+ has been provided for this demo.
28+
- Click on the `Terminal` tab. This should provide you terminal access to the host.
29+
- To see the installed version of RHEL use the following command.
30+
```
31+
cat /etc/redhat-release
32+
```
33+
Click `Next` to continue to the next challenge.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
generate_random_string() {
4+
local length="$1"
5+
tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c "$length"
6+
}
7+
8+
random_string=$(generate_random_string 6)
9+
10+
hostname_prefix="rhel-"
11+
12+
new_hostname="$hostname_prefix$random_string"
13+
14+
echo "Setting hostname to $new_hostname"
15+
hostnamectl set-hostname "$new_hostname"
16+
17+
echo "$new_hostname" > /etc/hostname
18+
19+
echo "New hostname: $new_hostname"
20+
21+
sudo setenforce Permissive

0 commit comments

Comments
 (0)