Ansible Playbook that I use to setup a new laptop.
⚠️ No longer maintained⚠️ I switched to using Nix as my package manager and Home Manager as the program to manage my HOME directory, so I no longer maintain this repository. I now keep the configuration for all of all my programs in this other repository: nix-config.
The Ansible playbook playbook.yaml
contains several tasks (i.e. the Ansible unit of action) grouped by roles and identified by tags.
ℹ️ Ansible playbooks are essentially sets of instructions (plays) that you send to run on a single target or groups of targets (hosts).
Tasks involving snaps will be executed using the community.general.snap module. All other tasks will use modules of the Ansible.Builtin collection.
ℹ️ I use Xubuntu, but the Ansible tasks that you can find in this playbook should work fine with all other Debian-based Linux distros.
Roles are either defined in playbook.yaml
, or declared in requirements.yaml
and downloaded from Ansible Galaxy.
You can use tags to run only the tasks you want.
Download all Ansible roles declared in requirements.yaml
:
ansible-galaxy install -r requirements.yaml
Run all tasks tagged with docker
(-K
means that you have to type your sudo password):
ansible-playbook playbook.yaml -K --tags "docker"
⚠️ Don't forget to logout and login back again after you have added your linux user to thedocker
group (or simply restart you computer). This way you can rundocker
commands without prepending them withsudo
.
Run all tasks tagged with some tag. For example, run all tasks tagged with either development
or productivity
:
ansible-playbook playbook.yaml -K --tags "development,productivity"
List of all tasks tagged with development
, productivity
, or both:
ansible-playbook playbook.yaml --list-tasks --tags "development,productivity"
If Ansible fails to install some task, double check that the playbook does not have any syntactic errors:
ansible-playbook playbook.yaml --syntax-check
then try re-running the playbook and skipping them:
ansible-playbook playbook.yaml -K --skip-tags "productivity"
I encountered this problem once, then I realized I typed the wrong become password. Failing to produce any output and/or throwing an error in these kind of situations is a long standing issue with Ansible.
For example:
ansible-playbook playbook.yaml -K --tags "development,productivity" -vvvvv
If, after the installation is completed, you notice that keyboard shortcuts perform the expected action only after A LOT of time, try uninstalling dbus-user-session
as suggested here.
I keep my dotfiles in a separate repository, so I can keep reusing them even if I decide to stop using Ansible. Most of my dotfiles are symlinked to my home directory using GNU Stow.
Here are some resources I found useful and that inspired me to create this repository.
- ansible-ubuntu
- Ansible for DevOps
- Deploying Your First Clojure App ...From the Shadows. This book has a couple of chapters that describe how to provision a server for Clojure web apps. There is also a repo.