Giter Site home page Giter Site logo

rdbreak / rhce7env Goto Github PK

View Code? Open in Web Editor NEW
9.0 5.0 2.0 156 KB

This is a RHCE 7 study environment built with Vagrant/Ansible

Home Page: https://join.slack.com/t/redhat-certs/shared_invite/zt-7ju3rz7b-_G3Njp3PDwdBG_81SwPeLA

License: MIT License

vagrant ansible ipa-server practice-exams studies virtualbox ipa automation deployment practice-exercises

rhce7env's Introduction

RHCE 7 Automated Practice Deployment

Powered by Ansible and Vagrant

Installation options below:

macOS

Gatekeeper will block virtualbox from installing. All you have to do is go into Security & Privacy of System Preferences and click Allow under the General tab and rerun installation.

Install all at once with the command below:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" && xcode-select --install &&brew install ansible ; brew install python ; brew cask install vagrant ; brew cask install VirtualBox ; brew cask install virtualbox-extension-pack ; vagrant plugin install vagrant-guest_ansible
Alternatively, you can install everything individually below.
Once the above software is installed. Do the following if you're running the environment on Mac:
  1. Create a separate ~/bin directory and cd to it. (The directory doesn't have to be ~/bin, it can be anything you want.)
  2. Clone the environment repo to it with git clone https://github.com/rdbreak/rhce7env.git
  3. Change to the rhce7env directory that is now in your ~/bin directory.
  4. Run vagrant up to deploy the environment (If the environment has a designated repo VM it will take the longest to deploy the first time only, this is because the repo system has all the packages available to the base release but will be quicker on subsequent deployments.)

NOTE2 - If you receive an error for an ansible guest vagrant plugin, DO NOT worry, as there are two different plugins related to Ansible and only one needs to be installed.

For CentoOS/RHEL7/Manjaro/Arch (Continue below for RHEL 8 specific script)
systemctl stop packagekit; yum install -y epel-release && yum install -y git binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms libvirt libvirt-devel ruby-devel libxslt-devel libxml2-devel libguestfs-tools-c ; mkdir ~/Vagrant ; cd ~/Vagrant ; curl -o  vagrant_2.2.6_x86_64.rpm https://releases.hashicorp.com/vagrant/2.2.6/vagrant_2.2.6_x86_64.rpm && yum install -y vagrant_2.2.6_x86_64.rpm && vagrant plugin install vagrant-guest_ansible ; vagrant plugin install vagrant-guest-ansible ; wget -O /etc/yum.repos.d/virtualbox.repo wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo ; yum install -y VirtualBox-6.0 && systemctl start packagekit
If you're using RHEL 8, use the script below:
systemctl stop packagekit; dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm ; dnf install -y git binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms libvirt libvirt-devel ruby-devel libxslt-devel libxml2-devel libguestfs-tools-c ; mkdir ~/Vagrant ; cd ~/Vagrant ; curl -o  vagrant_2.2.6_x86_64.rpm https://releases.hashicorp.com/vagrant/2.2.6/vagrant_2.2.6_x86_64.rpm && dnf install -y vagrant_2.2.6_x86_64.rpm && vagrant plugin install vagrant-guest_ansible ; wget -O /etc/yum.repos.d/virtualbox.repo wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo ; dnf install -y VirtualBox-6.0 && /usr/lib/virtualbox/vboxdrv.sh setup ; usermod -a -G vboxusers root ; systemctl start packagekit
Also, install the Virtualbox extension pack below
Once the above software is installed. Do the following if you're running the environment on Mac:
  1. Create a separate ~/bin directory and cd to it. (The directory doesn't have to be ~/bin, it can be anything you want.)
  2. Clone the environment repo to it with git clone https://github.com/rdbreak/rhcsa8env.git
  3. Change to the rhcsa8env directory that is now in your ~/bin directory.
  4. Run vagrant up to deploy the environment (If the environment has a designated repo VM it will take the longest to deploy the first time only, this is because the repo system has all the packages available to the base release but will be quicker on subsequent deployments.)

Windows/Fedora

dnf -y install wget git binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms libvirt libvirt-devel ruby-devel libxslt-devel libxml2-devel ; wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo ; mv virtualbox.repo /etc/yum.repos.d/virtualbox.repo ; dnf install -y VirtualBox-6.0 ; usermod -a -G vboxusers ${USER} ; /usr/lib/virtualbox/vboxdrv.sh setup ; dnf -y install vagrant ; dnf remove -y rubygem-fog-core ; vagrant plugin install vagrant-guest_ansible
Once the above software is installed. Do the following if you're running the environment on Windows:
  1. Create a separate ~/bin directory and cd to it using the same PowerShell/Terminal as Administrator/Root.  (The directory doesn't have to be ~/bin, it can be anything you want.)
  2. Use your browser of choice and navigate to https://github.com/rdbreak/rhce7env, press the green “Clone or download” button then the “Download ZIP” button. Or use Github Desktop (See below).
  3. Once downloaded, unzip the file and move it to the directory you created earlier, ~/bin in the above example.
  4. Use PowerShell/Terminal as Administrator/Root again and cd to the ~/bin/rhce7env directory then run vagrant up to deploy the environment. (If the environment has a designated repo VM it will take the longest to deploy the first time only, this is because the repo system has all the packages available to the base release but will be quicker on subsequent deployments.)

Debian

NOTE - If it's been awhile since you've run apt update, do that first. Reboot if the kernel was updated.

Install all at once by Copy/Pasting the below command into your terminal as root.
sudo snap install ruby ; sudo apt install ruby-bundler git -y; wget -c https://releases.hashicorp.com/vagrant/2.2.6/vagrant_2.2.6_x86_64.deb ; sudo dpkg -i vagrant_2.2.6_x86_64.deb ; wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - ; wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add - ; sudo add-apt-repository "deb http://download.virtualbox.org/virtualbox/debian bionic contrib"; sudo apt update; sudo apt install -y virtualbox-6.0 ; vagrant plugin install vagrant-guest_ansible
Also, install the Virtualbox extension pack below
Once the above software is installed. Do the following if you're running the environment on Linux:
  1. Create a separate ~/bin directory and cd to it. (The directory doesn't have to be ~/bin, it can be anything you want.)
  2. Clone the environment repo to it with git clone https://github.com/rdbreak/rhce7env.git
  3. Change to the rhce7env directory that is now in your ~/bin directory.
  4. Run vagrant up to deploy the environment (If the environment has a designated repo VM it will take the longest to deploy the first time only, this is because the repo system has all the packages available to the base release but will be quicker on subsequent deployments.)

Also, don't be spooked by any scary red font during the setup process. There are known issues that won't have a negative affect on the environment.

Now the deployment should be up and running!

(Recommended) Install Github Desktop to make pulling down changes easier

NOTE this requires a free Github account

  1. Navigate to https://desktop.github.com/ and download Github Desktop.
  2. Create or sign in to your account.
  3. Click "Clone a repository from the Internet" and enter "rdbreak/rhce7env" and choose a location then "Clone".
  4. You are also able to easily pull changes when they're made available.

Notable Vagrant Commands to control the environment:

  • vagrant up - Boots and provisions the environment
  • vagrant destroy -f - Shuts down and destroys the environment
  • vagrant halt - Only shuts down the environment VMs (can be booted up with vagrant up)
  • vagrant suspend - Puts the VMs in a suspended state
  • vagrant resume - Takes VMs out of a suspended state

Other Useful Information:

You can also use the VirtualBox console to interact with the VMs or through a terminal. If you need to reset the root password, you would need to use the console. I'm constantly making upgrades to the environments, so every once and awhile run git pull in the repo directory to pull down changes. If you're using Windows, it's recommended to use Github Desktop so you can easily pull changes that are made to the environment. The first time you run the vagrant up command, it will download the OS images for later use. In other words, it will take longest the first time around but will be faster when it is deployed again. You can run vagrant destroy -f to destroy your environment at anytime. This will erase everything. This environment is meant to be reuseable, If you run the vagrant up command after destroying the environment, the OS image will already be downloaded and environment will deploy faster. Once the setup is complete, the ipa server and client for realm TEST.EXAMPLE.COM will already be setup and paired. Deployment should take around 15 minutes depending on your computer. You shouldn't need to access the IPA server or Repo server during your practice exams. You shouldn't need to access the IPA or REPO server during your practice exams. Everything should be provided that you would normally need during an actual exam. Hope this helps in your studies!

Included systems:

  • ipa.test.example.com
  • repo.test.example.com
  • system1.test.example.com
  • system2.test.example.com

System Details:

repo

  • IP - 192.168.55.19
  • Gateway - 192.168.55.1
  • DNS - 192.168.55.5

ipa

  • 192.168.55.20
  • Gateway - 192.168.55.1
  • DNS - 192.168.55.5

system1

  • 192.168.55.21
  • Gateway - 192.168.55.1
  • DNS - 192.168.55.5

system2

  • 192.168.55.22
  • Gateway - 192.168.55.1
  • DNS - 192.168.55.5

There is a repo available to use from http://repo.test.example.com/rpms

Accessing the systems

Remember to add the IP addresses to your local host file if you want to connect to the guest systems with the hostname. Username - vagrant Password - vagrant

  • For root - use sudo or sudo su Access example - ssh [email protected] or vagrant ssh system

LDAP users

  • Username = dave, lisa
  • Password = password

Help

If you're having problems with the environment, please submit an issue by going to the ISSUES tab at the top. If you have more questions, looking for practice exams to use against this environment, or just looking for a fantastic Red Hat community to join, please navigate to #practiceexam in the Red Hat Certs Slack Workspace.

Known Issues:

Running the 'vagrant up' environment build will fail If HyperV is installed on the Windows VirtualBox host. Error is usually "VT-x is not available. (VERR_VMX_NO_VMX)" or similar, when the script attempts to boot the first VM.

Resolution seems to be either remove HyperV, or preventing its hypervisor from starting with the command: bcdedit /set hypervisorlaunchtype off, followed by a reboot.

rhce7env's People

Contributors

rdbreak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

gr8alex vlakmaker

rhce7env's Issues

Ansible provisioning isn't completing

===============================================================================
IPA server Configured. ------------------------------------------------ 327.17s
Packages Installed. Configuring IPA server...(Est. Time - 7 minutes) --- 81.88s
Environment Packages Installed. Configuring IPA Client... -------------- 46.84s
Environment Packages Installed. Configuring IPA Client... -------------- 46.29s
Rebooting machine ------------------------------------------------------ 27.34s
Rebooting machine ------------------------------------------------------ 23.95s
Finishing IPA client configuration ------------------------------------- 15.85s
Finishing IPA client configuration ------------------------------------- 15.57s
Enabling services ------------------------------------------------------- 1.58s
Adding NFS service to System1 ------------------------------------------- 1.19s
Enabling Firewall Services ---------------------------------------------- 1.11s
Starting Firewalld ------------------------------------------------------ 1.01s
Reloaded Firewall. Installing Environment Packages... ------------------- 0.81s
Enabling services ------------------------------------------------------- 0.55s
Enabling services ------------------------------------------------------- 0.54s
Fixing hosts file ------------------------------------------------------- 0.54s
Disabling services ------------------------------------------------------ 0.51s
Disabling services ------------------------------------------------------ 0.37s
Configuring IPA client -------------------------------------------------- 0.35s
Starting services ------------------------------------------------------- 0.31s
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
[fireside rhce7env]# ```

system1 and system2 with iscsi initiator enabled stopping before unmounting on shutdown

Hi @rdbreak
Firstly, I would like to say thanks to the Lab environment.
Secondly. I would like to make it better :-)
I've created target iscsi config:

[root@system1 ~]# targetcli
targetcli shell version 2.1.fb34
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/> ls
o- / ...................................................................................................... [...]
  o- backstores ........................................................................................... [...]
  | o- block ............................................................................... [Storage Objects: 1]
  | | o- system1 ........................................... [/dev/vg-lab2/system1 (1.0GiB) write-thru activated]
  | o- fileio .............................................................................. [Storage Objects: 0]
  | o- pscsi ............................................................................... [Storage Objects: 0]
  | o- ramdisk ............................................................................. [Storage Objects: 0]
  o- iscsi ......................................................................................... [Targets: 1]
  | o- iqn.2020-02.com.example.test:system1 ........................................................... [TPGs: 1]
  |   o- tpg1 ............................................................................ [no-gen-acls, no-auth]
  |     o- acls ....................................................................................... [ACLs: 1]
  |     | o- iqn.2020-02.com.redhat:system1 .................................................... [Mapped LUNs: 1]
  |     |   o- mapped_lun0 ............................................................ [lun0 block/system1 (rw)]
  |     o- luns ....................................................................................... [LUNs: 1]
  |     | o- lun0 ........................................................ [block/system1 (/dev/vg-lab2/system1)]
  |     o- portals ................................................................................. [Portals: 1]
  |       o- 0.0.0.0:3260 .................................................................................. [OK]
  o- loopback ...................................................................................... [Targets: 0]
/> exit
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
[root@system1 ~]# 

I've installed iscsi-initiator utils and logged in to the target:

[root@system1 ~]# cat /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2020-02.com.redhat:system1
[root@system1 ~]# iscsiadm --mode discoverydb --type sendtargets --portal 192.168.55.21 --discover
192.168.55.21:3260,1 iqn.2020-02.com.example.test:system1
[root@system1 ~]# iscsiadm --mode node --targetname iqn.2020-02.com.example.test:system1  --portal  192.168.55.21 --login
Logging in to [iface: default, target: iqn.2020-02.com.example.test:system1, portal: 192.168.55.21,3260] (multiple)
Login to [iface: default, target: iqn.2020-02.com.example.test:system1, portal: 192.168.55.21,3260] successful.
[root@system1 ~]# lsscsi
[0:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sda
[3:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sdb
[4:0:0:0]    disk    LIO-ORG  system1          4.0   /dev/sdc
[root@system1 ~]# 

Then reboot or shutdown...
And server hangs on rebooting with this information:
image
The same issue on initiators system1 and system2 (when system1 as a target).

IPA Server Port 464 not enabled for KPASSWD Reset

When getting a ticket from KDC using a user account with expired password, user will be prompt to reset password via kpasswd protocol which communicates via port 464.
IPA Server does not have that port permitted, resulting in the password changing to fail.
The user will not be able to login.

Reproduce Issue
Install the 4 Virtual Machines from the repository. Ensure the IPA Server and client machine is up.
Set System1 IP Address as 192.168.55.21/24 and set it to use LDAP + Kerberos authentication against ipa.test.example.com.
(Base DN: dc=test,dc=example,dc=com | Kerberos Realm: TEST.EXAMPLE.COM)
Login to user lisa and request a ticket via kinit.
Should be prompted to reset password and unsuccessful in contacting any KDC Error message.

Below is a pcap file recorded on the IPA Server and a screenshot of the output.
attachment.zip

"vagrant up" failing after "vagrant halt"

When using vagrant halt to stop my virtual machines, I get errors when using vagrant up to start my environment again. Using Virtualbox 6.0.16 and Vagrant 2.2.7 on Mac

A customization command failed:

["storagectl", :id, "--name", "SATA Controller", "--add", "sata", "--portcount", 2]

The following error was experienced:

#<Vagrant::Errors::VBoxManageError: There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["storagectl", "b5b58256-06a7-4842-af58-fe40c00ebeb7", "--name", "SATA Controller", "--add", "sata", "--portcount", "2"]

Stderr: VBoxManage: error: Storage controller named 'SATA Controller' already exists
VBoxManage: error: Details: code VBOX_E_OBJECT_IN_USE (0x80bb000c), component SessionMachine, interface IMachine, callee nsISupports
VBoxManage: error: Context: "AddStorageController(Bstr(pszCtl).raw(), StorageBus_SATA, ctl.asOutParam())" at line 1080 of file VBoxManageStorageController.cpp
>

Please fix this customization and try again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.