MacOS Ansible Recipes: Indepotent & Omnipotent
It will pre-install a dev environment with all the big and small tools we use at Web^ID.
A freshly installed (or not) macOS computer. Nothing else.
First, you would need git, make sure it is installed by opening your terminal (cmd + space, then type "terminal" and hit enter) and typing git --version
. If you see a popup that says you need command line tools to use git, click on the "Install" button.
After you clone this repository, you need to make config
:
# a good idea would be to create a folder for you code first
mkdir ~/Workspace
cd ~/Workspace
git clone https://github.com/web-id-fr/mario.git
cd mario
make config
This will copy the config_vars.yml.dist
to config_vars.yml
and the mario-playbook.yml.dist
to mario-playbook.yml
. You should edit those accordingly, see Configuration.
Then you just have to:
make install
During make install
you will be asked for your password and then to press the return key to install homebrew.
Calling make install
will:
- ✅ Install homebrew if needed, see bin/install-brew.sh
- ✅ Install ansible if needed, see bin/install-ansible.sh
- 🚀 Run the mario-playbook.yml ansible playbook.
Tip: if you only need to run the playbook, you can just make mario
.
The mario-playbook.yml is a regular ansible playbook file and contains all the roles that you want to run. Just comment the roles you don't want.
The mario-configuration.yml file contains variables you need to set for specific roles, see bellow:
If you are using the git
role, you must set these three configuration variable:
git_name: tentacode
git_email: [email protected]
They will be used to set your user in git config
If you are using the gtihub
role, you should set this configuration variable:
github_access_name: "Web^ID macbook" # In case you use more computer with one account, each name must be different
github_access_token: ABCDEF1234567 # To create a github access token : https://github.com/settings/tokens
This will push a ssh key to be authenticated in github.
If you are using the php
role, you can install older versions in addition to the latest stable version:
php_older_versions:
- [email protected]
- [email protected]
Check the mario-playbook.yml.dist, each role is documented there and it should give you a good overview of what's in there. But wait! There's more:
Use the alias
command to see all of oh-my-zsh aliases.
- st : a simpler display of git status
- amend :
git commit --amend --no-edit
- rebase-main :
git pull --rebase origin main
- pushu : push a new branch to origin and tracks it
- mvi : rename a file with case sensivity (ex:
git mv abc ABC
, does not work by default with git) - previous : go back by one commit (useful for workshops)
- next : go to the next commit (useful for workshops)
- date : got to a date "YYYY-MM-DD" in current branch history
- yolo :
git add . && git amend && git push -f