Giter VIP home page Giter VIP logo

setup's Introduction

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:

setup's People

Contributors

jasonwc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

setup's Issues

Failing Erlang install

TASK [dev : Install Erlang] ********************************************************************************************
fatal: [wsl]: FAILED! => {"changed": true, "cmd": "asdf install erlang ref:master", "delta": "0:00:03.299104", "end": "2019-07-19 18:22:05.702832", "msg": "non-zero return code", "rc": 1, "start": "2019-07-19 18:22:02.403728", "stderr": "", "stderr_lines": [], "stdout": "Checking out Erlang/OTP git repository from https://github.com/erlang/otp.git...\nError cloning local git repository", "stdout_lines": ["Checking out Erlang/OTP git repository from https://github.com/erlang/otp.git...", "Error cloning local git repository"]}

Thoughts on V2

  • Lightweight instructions for what to do from a fresh machine
    • Quickest path to Linux environment
    • Quickest path to SSH key in Linux environment?
  • How much automation can be done windows side to prepare Linux side?
  • Integration with 1password
  • Quickest path to Dockerized tooling
    • What tools do I even want installed "locally"
    • Do I use Docker "locally" or provide a remote option?
  • How much dev "in" Linux?
  • How much usage of bedrock?
  • Is Ansible still legit?

First run: Error: unknown command \"krew\" for \"kubectl\

TASK [ops : Get installed krew plugins] ********************************************************************************************************************
fatal: [wsl]: FAILED! => {"changed": true, "cmd": ["kubectl", "krew", "list"], "delta": "0:00:00.065498", "end": "2021-05-16 18:41:12.734422", "msg": "non-zero return code", "rc": 1, "start": "2021-05-16 18:41:12.668924", "stderr": "Error: unknown command \"krew\" for \"kubectl\"\nRun 'kubectl --help' for usage.", "stderr_lines": ["Error: unknown command \"krew\" for \"kubectl\"", "Run 'kubectl --help' for usage."], "stdout": "", "stdout_lines": []}

Need to make sure I'm reloading

ASDF not sourced when running a first time install


TASK [dev : Clone asdf] ************************************************************************************************changed: [wsl]

TASK [dev : Add asdf to shell] *****************************************************************************************changed: [wsl]

TASK [dev : Get installed asdf plugins] ********************************************************************************fatal: [wsl]: FAILED! => {"changed": false, "cmd": "asdf plugin-list", "msg": "[Errno 2] No such file or directory", "rc": 2}
...ignoring                                                                                                             
TASK [dev : Add asdf plugins] ******************************************************************************************fatal: [wsl]: FAILED! => {"msg": "The conditional check 'item|string not in asdf_plugins.stdout_lines' failed. The error was: error while evaluating conditional (item|string not in asdf_plugins.stdout_lines): Unable to look up a name or access an attribute in template string ({% if item|string not in asdf_plugins.stdout_lines %} True {% else %} False {% endif %}).\nMake sure your variable name does not contain invalid characters like '-': argument of type 'StrictUndefined' is not iterable\n\nThe error appears to have been in '/home/jason/setup/roles/dev/tasks/asdf.yml': line 19, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Add asdf plugins\n  ^ here\n"}

PLAY RECAP *************************************************************************************************************wsl                        : ok=37   changed=26  

This fails until you start a new shell and run ansible with that sourced. Need to figure out a graceful way to do this.

Mac setup?

I'd like to use this to setup my M1 Air.

  • What does Multiplatform look like?
  • Its painful to get to ansible on Mac. Is it the right tool?
  • Since we're setting up a "native" thing, should I install a bunch of applications via cask?
  • How much (if at all) should I adopt medic since dogfooding is good.

Second run: Permission denied: b'asdf'

TASK [dev : Get installed asdf plugins] ********************************************************************************
fatal: [wsl]: FAILED! => {"changed": false, "cmd": "asdf plugin-list", "msg": "[Errno 13] Permission denied: b'asdf'", "rc": 13}
...ignoring

TASK [dev : Add asdf plugins] ******************************************************************************************
fatal: [wsl]: FAILED! => {"msg": "The conditional check 'item|string not in asdf_plugins.stdout_lines' failed. The error was: error while evaluating conditional (item|string not in asdf_plugins.stdout_lines): 'dict object' has no attribute 'stdout_lines'\n\nThe error appears to be in '/home/jasonwc/setup/roles/dev/tasks/asdf.yml': line 22, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Add asdf plugins\n  ^ here\n"}

Guessing this is a similar shell issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.