Milestone 4 ‐ Automation with pyvmomi - jacobwilliams100/sys-350 GitHub Wiki
Setting up pyvmomi and VSC
sudo apt update
sudo apt install python3-pip
pip3 install wheel
pip3 install pyvmomi
pip3 install pyvim
for vscode...
sudo snap install code --classic
and git...
sudo apt install git
Cloning git Repo
Open Visual Studio Code from the (not) start menu
go to this icon-> clone repo (must have Git installed)
and sign in to your account, select desired repo
Deliverable 1. Figure out how to clone your course git repository.
Deliverable 2. Demo your own interactive session with vcenter via pyvmomi.
Writing the program with Python
code may be found in this repo:
https://github.com/jacobwilliams100/sys-350/blob/main/project4point1.py
Enabling VMWare Tools on pfsense
Will need to do this to get the program to work properly with fw01
https://www.youtube.com/watch?v=j4XmKvVtDUA
Deliverable 3. Provide a link to a short video showing program requirements and explaining the code.
https://drive.google.com/file/d/1Zm2qDoHBs13H0sy30Ji0fa4bZ3ToJwvf/view?usp=sharing
Deliverable 4: Tech Journaling
You are viewing it right now.
Deliverable 5. Reflection
I had a ton of difficulty with this lab, mostly because I had barely touched Python before this lab (and haven't done much programming at all in years because I fundamentally do not enjoy coding). I did not even understand how to use VSCode with GitHub; I was so confused that I couldn't get my code to sync with my repo. After watching some videos, I learned how to stage, push, pull, sync, etc. As for the program itself, I had to watch some videos and use ChatGPT learn about methods, if-then-else statements, and especially the more specific functions for interfacing with vcenter. My major hangups included figuring out how to get python to import data from a json file (I needed a dependency to make it work), the VM search/selection function, and getting it to only return details from the one selected. I kept running into an issue where option 3 would return the details (or rejection message ) for every VM no matter what, and it turned out to be because I added an extra tab to the else statement. Unlike some other languages, indentation is VERY important in Python.
Not a programming issue, but I ran into difficulty getting open-vm-tools installed on pfsense fw01, but eventually figured it out with the help of a video.
From doing this project, I learned that Python is a versatile language and there are often very many ways to perform a function. I certainly improved my skills a bit too. I think that I definitely could have made my program shorter, cleaner and more efficient, but it already took me a while to get it all working correctly and I was afraid of breaking something.