Introduction
For the unfamiliar, Jenkins and Ansible are open-source projects for automation. Due to the way they are used in my experience, the distinction can be confusing, and it is important. Jenkins is a web-based application for executing long-running shell scripts on an endpoint, allowing the observation of the output of the shell scripts in the browser. Ansible is a linux program that runs various tasks on remote endpoints depending on the configured playbooks. Since Ansible playbooks can be thought of as long-running shell scripts, this makes sense to run from a Jenkins playbook. The Jenkins playbook can be created to collect the variables and set up the environment to run the Ansible playbook from.
I learned about this way of doing things at Tesla ITMFG; we use Ansible playbooks running from Jenkins pipelines for a lot of the automation we do there. I initially just wanted to understand what happened when I hit build on the pipeline and so started poking around. Then, Microsoft announced Windows Recall, the built-in spyware that would eventually be included with all PCs that would record keystrokes and screenshots. This caused me dive deep into learning how to use Linux, and since my experience using Linux now included Ansible for automating endpoint deployment, I decided to use this with my own stuff. I have always been very confident with using Windows, but I have to move to Linux because of the inexcusable privacy violation, but I needed to have a way to have a consistent environment. I set up my own PXE server with a private key and other preconfigured items. I set up a Jenkins server on Matt-Cloud and integrated it with my SSO. I set up an Ansible environment that I can view in VS in the browser. I learned how to sync my Jenkinsfiles with Github and then how to pull the Pipelines from Github to allow for advanced pipelines.
The other main advantage to this is that it allows me to have a consistent platform for tinkering. To better explain this, let me compare this to how I used to use Linux. My old Linux systems were all one-off unique builds. I would often find myself with a working setup but poor records of how I achieved that. Now, if I do everything in Ansible, this means that I am always starting from the Matt-Cloud base image, then pushing out the project build as I'm working on it now. Once it's working, this means I have a permanently reproducible project, and I can build on it at any point and then just deploy my most recent changes to any currently working setups. This is a huge benefit of using Ansible in my opinion.
The other main use for Ansible and Jenkins is deploying my primary Linux workstation. I like to have my main Linux system be effectively ephemeral, meaning that all I need to create an identical system to what I am using now is run a specific playbook on a fresh Matt-Cloud base image. I have a pipeline to capture my profile that I run periodically, and this can be deployed as part of an Ansible playbook.
No Comments