Skip to content

Ansible Playbook to setup my workstation

Notifications You must be signed in to change notification settings

pascal-sun/setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

74 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

setup

πŸš€ Integration ✨ Lint

Ansible Playbook to setup my workstation

How to run it?

On an Ubuntu 24.04 LTS (Noble Numbat):

Update your packages

sudo apt update && sudo apt upgrade --yes

Install Ansible with pipx

sudo apt install pipx --yes
pipx ensurepath
pipx install ansible-core

Install git and clone the repository

sudo apt install git --yes
git clone https://github.com/pascal-sun/setup.git
cd setup/

Install required Ansible Galaxy Collections

ansible-galaxy install --role-file requirements.yml

Run Ansible Playbook

ansible-playbook playbook.yml --ask-become-pass 
BECOME password: <Enter your password>

And that's it! πŸš€

Post-installation manual steps

Firefox Extensions

  • Bitwarden: At home, at work, or on the go, Bitwarden easily secures all your passwords, passkeys, and sensitive information.
  • Sidebery: Vertical tabs tree and bookmarks in sidebar with advanced containers configuration, grouping and many other features.
  • Vimium: The Hacker's Browser. Vimium provides keyboard shortcuts for navigation and control in the spirit of Vim.

NvChad

  • Install, clean and plugins:
    nvim
    :Lazy sync
  • Or from command-line:
    nvim --headless "+Lazy! sync" +qa

GitHub SSH key

  • Copy the SSH public key to your clipboard:
    cat ~/.ssh/id_ed25519.pub
  • Go to GitHub, then Settings > SSH and GPG keys > New SSH key
  • Add Authentication and Signing keys, and paste the SSH public key

JetBrains

  • Launch Toolbox with app launcher: super+space and search JetBrains Toolbox
  • (or from terminal: $HOME/.local/share/JetBrains/Toolbox/bin/jetbrains-toolbox)
  • Install desired tools, such as PyCharm Professional

Exegol

  • Install resources (~1GB) and full image (~60GB):
    exegol install
  • Follow instruction

Warning

Downloading takes a long time...

How to test it?

With act

act --env RUNNER_DEBUG=1 --job with-github-runner 
act --env RUNNER_DEBUG=1 --job with-docker-container

Caution

With act, it does not possible to use snapd. Therefore packages intalled with snap (tagged with installed_with_snap) are skipped.

With CI run-ansible

Just push the code, and check GitHub Action

Architecture decision record

Docker

Docker Engine or Docker Desktop?

On Linux, you have the choice between Docker Engine and Docker Desktop (which isn't the case for macOS and Windows: Docker Desktop is the only choice, as a VM on Linux is mandatory).

🟒 Docker Engine is the core software that enables containerization, which includes the Docker daemon dockerd, the command-line interface docker and APIs to talk to the Docker daemon. It's free, easier to install with the Docker repository, and it's less consuming in terms of resources, as it includes only essential components and runs directly on the operating system.

πŸ”΄ Docker Desktop is a package of tools, which includes Docker Engine, Docker Extensions, Docker Compose, Kubernetes, etc. (stuff that I don't need) and a graphical interface. Due to the additional components and the use of a Virtual Machine (even on Linux), it can be more consuming in terms of resources than Docker Engine alone.

The Docker Engine and the CLI are enough for my use, and if not, can use the Docker interface of Jetbrains IDEs instead of the Docker Desktop.

Python

Why not install python3-pip?

pip is a package installer for Python, and is automatically installed if you're working in a virtual environment. As pipx and venv are used, python3-pip is not necessary outside a virtual environment, so install python3-pip is not required.

Why install python3-venv?

venv is integrated into the standard library module since python3.3, and is used to create virtual environments. The installation of python3-venv is done by default when Python is installed.

However, on Debian/Ubuntu (and derivatives), python3-venv is not installed by default: you must install manually, to use tool like pipx (https://pipx.pypa.io/stable/troubleshooting/#debian-ubuntu-issues.

Why not use other package / version / virtual environment managers?

Python has many package and virtual environment managers:

Package managers

🟒 pip is the "default" package installer for Python, and specifies package dependencies in a requirements.txt file. Ideal for a small to medium project, with a small number of dependencies. However, it does not manage dependency conflicts and virtual environments (need other tools, such as virtualenv or venv)

🟒 poetry is a newer popular package manager and specifies package dependencies in a pyproject.toml file. Best choice for a larger and more complex project, with a large number of dependencies. It manages virtual environments, from its built-in environment manager, or from external environment manager (such as virtualenv or venv). And it resolves dependency conflicts... but slowly.

πŸ”΄ pdm and hatch, very similar to poetry but less popular, so didn't test...

πŸ”΄ conda and mamba, I'm not a data scientist so...

🟑 uv is an extremely fast Python package installer and resolver, written in Rust, and designed as a drop-in replacement for pip. But it is no stable for now (but keep an eye on... πŸ‘€)

Version managers
  • pyenv is used to switch between multiple versions of Python, and also install multiple Python versions

    # Installation
    curl https://pyenv.run | bash
    # Usage
    pyenv install 3.10
    pyenv local 3.10
  • asdf is used to manage and switch multiple language versions (it's like pyenv, but for other languages also)

    # Installation
    git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0
    # Usage
    asdf plugin add python
    asdf install python 3.10.14 # need to be very specific
    asdf local python 3.10.14
  • βœ… mise, is like asdf, but faster and easier to use (and has additional features)

    # Installation
    curl https://mise.run | sh
    # Usage
    mise use [email protected]
Virtual environment managers
  • virtualenv is a popular tool maintained by PyPA, to create virtual environments for python2 and python3

    # Installation
    pipx install virtualenv
    # Usage
    virtualenv my_env --python=python2.7
  • pipenv is a mixture with pip and virtualenv

  • venv is a standard library to create virtual environments (with less feature than virtualenv, such as creating virtual environments for arbitrarily installed python versions)

    # Usage
    python3 -m venv my_env
    • πŸ”΄ Cannot with different version of Python, and especially python2

TODO

About

Ansible Playbook to setup my workstation

Resources

Stars

Watchers

Forks

Languages