Milestone 7 Deploying and Post Provisioning of BlueX Linux Servers - InaFricke/SEC-480 GitHub Wiki
7.1 Create a Rocky 9.1 Base VM
Create a Rocky Linux Minimal Base VM
Create a Rocky Linux Minimal Base VM (be sure to select minimal on the download page), you should have enough information to make this happen.
Make sure it is thin-provisioned.
-
Download
-
Upload to datastore 2
-
create new VM
-
Put it on datastore 2
-
Configure
- Create a normal user and a root user
Username: ina PW: RB
Username: root PW: RB
Enable SSH
-
do installation
-
login as admin
curl -O https://raw.githubusercontent.com/gmcyber/RangeControl/main/src/scripts/base-vms/rhel-sealer.sh
-
sudo yum install wget -
bash rhel-sealer.sh -
Login
-
Poweroff
-
Snapshot
7.2 DHCP on Blue8fw and a static (or dynamic) route on 480-fw
-
Log in to 480-fw
-
configure -
set protocols static route 10.0.5.0/24 next-hop 10.0.17.200commit and save
ISSUE X FIX
configure
set interfaces ethernet eth0 address 10.0.5.2/24
delete interfaces ethernet eth0 address 10.0.8.1/24
commit
save
show protocols static route
PlayBook
- inventory + vars, playbook vyos-dhcp-config.yml
Documentation is up to date
- Screenshot of DHCP config on Vyos
3 rocky linked clones
-
Confirm base snapshot
-
log in to vcenter
- Added Get-IPs function to the utils file
function Get-IPs {
param (
[string[]]$VMNames
)
foreach ($name in $VMNames) {
Get-IP -VMName $name
}
}
- update the driver file, comment out unnecessary parts ( vcenter connection, adapters, networks)
-
Import the module
Import-Module ./480-utils.psm1 -Force -
run it .\480.driver.ps1
7.3 Post Provisioning Rocky-1-3 with Ansible
-
check if you have a key
ls ~/.ssh/ -
make key
ssh-keygen -t rsa -b 4096 -
create playbook named rocky-provision.yml
-
Create
inventory-ricky.ymlusing IPs from get-IP function, double check those are the same as ens34 because the nmcli used interface not variable.
- Run it
-
Ended it early because it could not reconnect and confirm reboot after IPs changed (confirmed they rebooted on the console)
-
Static IPs set
- SSH
Video
- Get-IPs before (DHCP addresses)
- The playbook run
- Get-IPs after (static addresses)
- SSH into one VM as deployer with no password
- sudo -i to show passwordless root
Post Provisioning Ubuntu 1-2 with Ansible
Cloning of Ubuntu base server
- Update driver file.
$SourceVM = "ubuntu.base.server"
$CloneName = "ubuntu-1"
-
Repeat with ubuntu-2
-
Get the IP's
- login to check IP's
user:rangeuser PW: RR32
ubuntu 1 - 10.0.5.83
ubuntu 2 - 10.0.5.84
- Create,
inventory-ubuntu.yml: defines the two Ubuntu hosts, their DHCP IPs, usernames, and static IPs as variables
ubuntu-provision.yml: the playbook with all the tasks
netplan.j2: the Jinja2 template that generates the static IP network config for each Ubuntu VM
-
Pull from GitHub
-
run in the ansible directory
- Staticaly assigned
- sudo -i with no password needed
Video
Before — run Get-IPs showing the DHCP addresses (10.0.5.83 and 10.0.5.84)
Run the playbook — show the successful output
After — run Get-IPs showing the static addresses (10.0.5.30 and 10.0.5.31)
SSH in as deployer to one of the VMs without a password and run sudo -i
Walk through all 3 files — inventory-ubuntu.yml, ubuntu-provision.yml, and netplan.j2