One thing I have always wondered has been removing the error and the manual out of our imaging process.
While Deploystudio does offer many tools to automate the process and design workflows to achieve completion, I still needed to come up with a way to deal with computer names and the computer records that are stored in Deploystudio.
Thankfully, Deploystudio has a REST API which can be used.
What I wanted to do:
-Netboot a computer into Deploystudio
-Select a designated workflow
-Have a script grab the serial of the mac and look through Deploystudio database for a record,if that record exists, the computer name and hostname will be updated with a new generated name based on a designed convention along with other informations should we find the need for and if the record doesn’t exist, it will be created.
I have put together a couple of scripts, that about handles everything in one go.
While on the Deploystudio Server, Download my scripts from my Repo and keep them together.
Now that we have downloaded the pieces, we need to add our info to the scripts
Setup.py –> Needs the path to your DS Repo
I would recommend opening up a Terminal window and navigating to the Repo.
Once in the repo, type pwd to get the full path and copy that into setup.py
host = ‘Deploystudio Url’ ##–> Deploystudio URL
adminuser = ‘Deploystudio_username’##–> Deploystudio username
adminpass = ‘Deploystudio_password’ ##–> Deploystudio password
Once done, Save the file and open up a Terminal window
Make sure you have git installed; You can check by typing git –version in Terminal
It will returned the version of git you are running or if you are not, Launch a Menu to install it.
(I assume your DS Server has access to the internet as we need to download a few things)
Seat back and relax
Once completed, Launch Deploystudio Admin and confirm the presence of hostname_generator.py in your Scripts section.
Now we add hostname_generator.py to a workflow; it needs to be before the Configure task since we want to update the database prior to configuring the settings.
Also setup the script with Postpone uncheck and automate check as we want to make sure the database is updated on the first go and unattended.
That’s it…. We are done, netboot a mac and test out your new workflow.