This an Ansible Playbook to provision my macOS and Ubuntu dev machines.
It will :
- create useful directories.
- install packages (brew(and taps), mise-managed tools, and on Ubuntu also apt/flatpak).
- copy dotfiles which configure various applications(Git, npm, terraform) in home.
- copy some zsh script, mainly for configuration and some helper functions and aliases.
-
install brew : brew.sh/
-
install ansible and gh :
brew install ansible gh -
authenticate to GitHub (the playbook installs
ghextensions, which needs this done first)gh auth login
-
checkout project in
~/projects/perso/provision/dev-provision. -
copy
roles/mac_dev_playbook/files/HOME/.ansible.cfgin ~/.ansible.cfgcurl -fsSL https://github.com/Ameausoone/dev-provision/raw/refs/heads/main/roles/mac_dev_playbook/files/HOME/.ansible.cfg -o ~/.ansible.cfg -
init the
~/.ansible/inventoryfilemkdir -p ~/.ansible && printf '[localhost]\n%s\n' "$(hostname)" > ~/.ansible/inventory
-
then go to
~/projects/perso/provision/dev-provision. -
run
ansible-playbook main.yml --diff --verbose --inventory ~/.ansible/inventory --limit $(hostname).
- install Linuxbrew : docs.brew.sh/Homebrew-on-Linux
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" eval "$($(brew --prefix)/bin/brew shellenv)"
- install ansible, gh, and the collections ansible needs (
community.general,ansible.posix) :brew install ansible gh ansible-galaxy collection install -r requirements.yml
- authenticate to GitHub (the playbook installs
ghextensions, which needs this done first)gh auth login
- checkout project, e.g. in
~/projects/perso/provision/dev-provision. - copy
roles/mac_dev_playbook/files/HOME/.ansible.cfgin ~/.ansible.cfg (same as macOS above). - init the
~/.ansible/inventoryfile as above. - run
ansible-playbook main.yml --diff --verbose --inventory ~/.ansible/inventory --limit $(hostname) --ask-become-pass(--ask-become-passis needed: apt/flatpak tasks andchshrequire sudo). - the apt tasks need
python3-aptandpython3-debianfor the system Python (already present on Ubuntu Desktop by default; if missing:sudo apt install python3-apt python3-debian).
Packages that only make sense on one OS are split in roles/mac_dev_playbook/defaults/main.yml
(*_darwin_only for macOS-only Homebrew formulae, mac_dev_playbook_apt_packages /
mac_dev_playbook_flatpak_packages for Ubuntu-only GUI apps).
- Dry run first, to see what would change: add
--checkto theansible-playbookcommand above. - Run it for real (see command above). Order: oh-my-zsh clone → dotfiles copy → brew → mise install → apt/flatpak [Ubuntu only] → docker plugin symlinks → gh extensions → shells → macOS defaults [macOS only].
- On Ubuntu,
--ask-become-passprompts once for your sudo password (used by the apt/flatpak/chsh tasks). - Open a new terminal (or
exec zsh) to pick up the newly installed dotfiles/shell. - Re-running the playbook is safe (idempotent) — use it whenever you change a package list or dotfile.
Two functions are provided :
macconfigwill open project with code
- Configure iTerm2 https://apple.stackexchange.com/questions/136928/using-alt-cmd-right-left-arrow-in-iterm
- Create
~/.gitconfig.localwith your git identity (not repo-managed, machine-local):[user] name = Your Name email = your@email.com
Terraform tools are documented in terraform-family.md.
- I talked about this project at DevFest Strasbourg 2023: https://www.youtube.com/watch?v=3EVxJo2A5a8
At your own risk, this playbook doesn't aim to be used by someone else, it's just to share how I provision my computers.
mise install