Skip to content
/ setup Public

Ansible Playbooks for setting up WSL/Multipass VMs

Notifications You must be signed in to change notification settings

jasonwc/setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setup

Ansible Playbooks for setting up an ops/ruby/elixir focused workstation.

Used on:

(Required) Setting up a Linux Environment

There are a couple easy ways to get to a clean Linux environment on Windows: multipass and WSL.

(Recommended) WSL2

Follow the Windows Subsystem for Linux Installation Guide for Windows 10

Multipass

Follow the installation instructions on the Multipass homepage

(Required) Docker for Desktop

This setup repo won't install the Docker daemon in the Linux environment itself. Instead it assumes you have Docker for Desktop running either in WSL2.0 or on the Windows side and only installs client libs. I've gone with this approach because the Docker and WSL teams are constantly improving the connectivity and it was much harder to try to spin up Docker myself in WSL2.0 and nigh impossible in WSL1.0.

To install Docker for Desktop on Windows, check out their instructions.

If you're using WSL2.0, make sure to use the WSL backend setting in the Docker for Desktop client. Then it's pretty seamless.

If you're using Multipass, you might have to enable some settings to talk to the Docker socket running in either WSL2.0 or on Hyper V.

Quick Start

You'll need to get an ssh key into your new Linux environment. Afterwards, run the following:

# Clone to your home directory
git clone [email protected]:jasonwc/setup.git

# (Required) Set your username in playbook.yaml. While you're at it, check out the roles and vars_files too.
# (Required) Set your username, repo directory, and repos in user_environment.yml (or clone my repos, what do I care!)

# Installs ansible and dependencies
sudo sh bootstrap.sh

# Run the playbook
ansible-playbook -K playbook.yaml

What do you get?

This is a somewhat opinionated but lean installation of tools that I want to have on a Linux environment. I do a lot of dev in Docker containers, so often those containers will have specialized tools.

Generally, I'm running this on my primary WSL2 workspace. I also spin up a VM from time to time for specific tasks and provision it with these tools for consistency.

Shell

Installs basic tools like vim and tmux and sets up zsh as the default shell. Uses my dotfiles repo to configure them.

  • zsh: "Zsh is a shell designed for interactive use, although it is also a powerful scripting language."
  • oh-my-zsh: "Oh My Zsh is a delightful, open source, community-driven framework for managing your Zsh configuration."
  • vim: "Vim is a highly configurable text editor for efficiently creating and changing any kind of text."
  • tmux: "tmux is a terminal multiplexer: it enables a number of terminals to be created, accessed, and controlled from a single screen. "
  • Syncs from my dotfiles repo. Loads of config for the basics over there.
  • Clones some repos I'm working on
  • Runs PlugInstall in Vim

Ops tooling

Tooling for doing operations and infrastructure type tasks. Mostly focused on interacting with cloud providers and working with Kubernetes and Docker.

  • Docker: building and running containers
  • Kubectl: interacting with Kubernetes clusters
  • Kubeadm: building and managing Kubernetes clusters
  • Helm: building, deploying, and using Helm charts
  • Krew: Plugin manager for kubectl
  • Configures kubectl with some krew plugins I like.

Dev tooling

Tooling and programming languages for scripting and application development.

  • asdf: version manager for multiple languages, frameworks, and plugings (think nvm, rbenv)
  • ruby: "A dynamic, open source programming language with a focus on simplicity and productivity."
  • erlang: "Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability."
  • elixir: "Elixir is a dynamic, functional language designed for building scalable and maintainable applications."
  • Handles dependency installation for various languages
  • Configurable language versions. Installs whatever is set and sets it globally for easy upgrades.

Troubleshooting

[WARNING] Ansible is in a world writable directory

If you see something like this, you need to set correct permissions on the setup directory:

 chmod 700 /path/to/setup directory

This often happens with WSL installs.

Inspiration

I learned a lot about Ansible during my time at Mavenlink. Much of the intial idea came from a great tool maintained by the team there called "ansible-workstation" and its successor "bootstrap-workstation".

These other resources helped me along the way: