Logo

MacStadium Blog

MacStadium + Ansible are Making Life Easier for DevOps Teams

Provisioning your Mac cloud virtual machines for macOS and iOS CI just got easier. MacStadium engineers have put together some example Ansible scripts for provisioning your CI build environment.

Provisioning your Mac cloud virtual machines for macOS and iOS CI just got easier.

MacStadium engineers have put together some example Ansible scripts for provisioning your CI build environment. You can find them and detailed READMEs at MacStadium’s Github.

Ansible is a configuration management tool that acts as a sort of hub for scripting a variety of actions with all sorts of software. It is written in 'Ansible,' a YAML-based language that embraces human readability, so it doesn’t take a tremendous level of technical skill to use.

It also requires Python (Python2.7 or Python3.5+ should do the trick) to be installed on the control machine. You can execute Ansible against groups of target nodes or on the control machine itself (in this case the control machine will configure itself).  

Scripted processes are broken down systematically into smaller, more manageable and modular, sections called Modules. There are tons of modules out there. If you can’t find the module you need, Ansible lets you write a custom one using Python or Powershell for Windows modules. Multiple Modules can be combined into a Role. Multiple Roles can be combined to comprise a Playbook -- that is a single, more complex collection of Roles.

For our purposes, we’ve put together an Xcode Installation and an OSX CI Build Role, and we’ve wrapped those up in a Playbook of the same name that is a fully operational example and is ready to either be dropped into a CI workflow as is, or it can easily be extended to suit your needs.

Specifically, these roles will speed up and ease the installation of Xcode, Homebrew, Node.js 10 LTS, Java 8, Fastlane, and CocoaPods.

Our example scripts allow you to provision a single VM, from which you can create a VM template that can be cloned time and again quickly and easily. They must be run on the target machine via SSH. They are written to target the 'localhost', although this behavior can easily be changed to suit your particular workflow.

One interesting use case that will serve MacStadium customers well is the integration of Ansible with VMware, the virtualization platform that runs the VMs themselves. Ansible has the built-in ability to talk to VMware’s vCenter API, and thereby provide a human-readable interface for creating, amending, and deleting VMs via an API that is exposed from your Mac cloud environment.

This automated standing-up of VMs via Ansible can be intermingled with the provisioning of said VMs as described above so that you end up with a single, complete description of your workflow that has all the user-friendliness of a YAML based language.

To learn more about Ansible and its far-reaching possibilities, check out Ansible’s docs.

Logo

Orka, Orka Workspace and Orka Pulse are trademarks of MacStadium, Inc. Apple, Mac, Mac mini, Mac Pro, Mac Studio, and macOS are trademarks of Apple Inc. The names and logos of third-party products and companies shown on the website are the property of their respective owners and may also be trademarked.

©2023 MacStadium, Inc. is a U.S. corporation headquartered at 3525 Piedmont Road, NE, Building 7, Suite 700, Atlanta, GA 30305. MacStadium, Ltd. is registered in Ireland, company no. 562354.