Skip to content

Immutable Infrastructure as Code Workstation Ansible Playbook

License

Notifications You must be signed in to change notification settings

j-simmons-phd/iiac-workstation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Immutable Infrastructure as Code Workstation

The Immutable Infrastructure as Code Workstation project bootstraps your localhost for developing Immutable Infrastructure as Code (IIaC). The IIaC toolchain is built around Ansible, which must be installed manually before you begin (see Prerequisites), and as such the workstation is designed to be run from Linux. Windows 11 users can use the Windows Linux Subsystem v2 (WSL2) and its support for GUI apps to run the IIaC toolchain (with a little assistance from Chocolatey.

The full provided IIaC toolchain is as follows:

Prerequisites

All users must install Ansible manually before proceeding. Windows 11 users have some additional steps to perform to set up a WSL2 Ubuntu environment for use with the IIaC toolchain.

Note: Once the Windows 11 specific steps are complete, all instructions assume Windows 11 users are operating from within their WSL2 Ubuntu environment.

Windows 11 Users

Ansible only runs under Unix-like operating systems, so Windows 11 users must operate within a WSL2 Ubuntu environment. Further, a WSL Ubuntu environment cannot run VirtualBox or Docker. So, these two tools must also be installed before proceeding with the Ansible install. We will use Chocolatey to facilitate these installations.

  1. Ensure the WSL2 is installed and up to date
    1. Determine if WSL2 is installed by running wsl --status from an elevated command prompt
    2. If WSL2 is not installed, install it by running wsl --install from an elevated command prompt (you will be prompted to reboot, after which execute the following step)
    3. If WSL2 is installed, update it by running wsl --update from an elevated command prompt and follow any additional prompts
    4. Confirm WSL2 is fully installed and up to date by running wsl --status from an elevated command prompt, again
  2. Install Chocolatey
  3. Install VirtualBox by running choco install virtualbox from an elevated command prompt, verify it installed correctly by launching from the Start Menu
  4. Install Docker by running choco install docker-desktop from an elevated command prompt, verify it installed correctly by launching from the Start Menu and accepting the license
  5. Install WSL2 Ubuntu environment from the Microsoft Store by launching the Microsoft Store, searching for Ubuntu and clicking the Get button, then launch it from the start menu and follow prompts to create your Ubuntu user

Install Ansible

Follow the official Installing Ansible on specific operating systems instructions to install Ansible. Windows 11 users, remember to follow these instructions in your WSL2 Ubuntu environment.

Install IIaC Toolchain

Windows 11 Users Pre-Installation Steps

Note, these instructions must be run inside the WSL2 environment.

  1. Download the iiac-wsl2-env.yaml file to your computer by running wget https://raw.githubusercontent.com/j-simmons-phd/iiac-workstation/v1.0.0-alpha/iiac-wsl2-env.yaml
  2. Apply the WSL2 specific environment variables to your .bashrc file by running ansible-playbook -i,localhost ./iiac-wsl2-env.yaml
  3. Source your .bashrc file to enable the new environmnet variables by running source ~/.bashrc

All Users Installation Steps

Note, these instructions are for all users, including Windows 11 running inside a WSL2 environment.

  1. Download the requirements.yaml file to your computer by running wget https://raw.githubusercontent.com/j-simmons-phd/iiac-workstation/v1.0.0-alpha/requirements.yaml
  2. Download the iiac-workstation.yaml file to your computer by running wget https://raw.githubusercontent.com/j-simmons-phd/iiac-workstation/v1.0.0-alpha/iiac-workstation.yaml
  3. Install the requirements by running ansible-galaxy install -r requirements.yaml
  4. Execute the playbook by running ansible-playbook -i,localhost --ask-become-pass ./iiac-workstation.yaml

Note: If you run into an Vagrant error about chmod under WSL2 on Windows 11, see the fix at Error `chmod’: Operation not permitted @ chmod_internal.

About

Immutable Infrastructure as Code Workstation Ansible Playbook

Resources

License

Stars

Watchers

Forks

Packages

No packages published