Compare commits
10 Commits
0deefda45a
...
e804a1ff44
| Author | SHA1 | Date | |
|---|---|---|---|
| e804a1ff44 | |||
| 0531ab1eed | |||
| 529e916ec8 | |||
|
|
d186c26915 | ||
|
|
a1c635431e | ||
|
|
9dd13fbef7 | ||
|
|
466035a564 | ||
|
|
596df42c86 | ||
|
|
f1d521cadb | ||
|
|
327d99f4de |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
*.retry
|
||||
.DS_Store
|
||||
@@ -1,6 +1,6 @@
|
||||
# MacOS Setup with Ansible
|
||||
|
||||
This repository contains an Ansible configuration for setting up a Mac from scratch. It's primary purpose is setting up a new Mac from scratch, but I endeavor to also use it for adding new software as I go so that it remains up to date. At the moment it's being used for setting up Intel based Macs running MacOS Big Sur.
|
||||
This repository contains an Ansible configuration for setting up a Mac from scratch. It's primary purpose is setting up a new Mac from scratch, but I endeavor to also use it for adding new software as I go so that it remains up to date. At the moment it's being used for setting up M1 based Macs running MacOS Monterey.
|
||||
|
||||
## Getting Started
|
||||
|
||||
@@ -14,6 +14,8 @@ And then runs the main playbook `ansible_osx.yml`.
|
||||
|
||||
For future updates, `bin/apply` can be used to run just the Ansible playbook without the setup commands.
|
||||
|
||||
It's important to note that this isn't designed to be particularly robust, particularly when it comes to required env vars, it may be required to run this. Then close the terminal and open it again and re-run and then repeat this process a few times.
|
||||
|
||||
## What's installed
|
||||
|
||||
The easiest way to understand what's installed is to read the contents of `ansible_osx.yml`, this configuration is fairly specific to the range of development I do personally, but may serve as a useful starting point for others. The core components are:
|
||||
|
||||
232
ansible_osx.yml
232
ansible_osx.yml
@@ -3,21 +3,20 @@
|
||||
tasks:
|
||||
- name: Install homebrew
|
||||
include_role:
|
||||
name: geerlingguy.homebrew
|
||||
name: geerlingguy.mac.homebrew
|
||||
|
||||
- name: Setup dnsmasq
|
||||
include_role:
|
||||
name: dnsmasq
|
||||
- name: Make sure homebrew bin is in path
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/paths
|
||||
state: present
|
||||
line: '/opt/homebrew/bin'
|
||||
become: true
|
||||
become_user: root
|
||||
|
||||
- name: 'add custom homebrew repos'
|
||||
community.general.homebrew_tap:
|
||||
name: [
|
||||
adoptopenjdk/openjdk,
|
||||
fishtown-analytics/dbt,
|
||||
heroku/brew,
|
||||
homebrew/cask-versions,
|
||||
thoughtbot/formulae,
|
||||
weaveworks/tap,
|
||||
]
|
||||
|
||||
- name: Install core packages via brew casks
|
||||
@@ -25,123 +24,47 @@
|
||||
name: "{{ item }}"
|
||||
ignore_errors: yes
|
||||
with_items:
|
||||
- 1password
|
||||
- adoptopenjdk/openjdk/adoptopenjdk8
|
||||
- android-sdk
|
||||
- android-studio
|
||||
- dash
|
||||
- datagrip
|
||||
- docker
|
||||
- dropbox
|
||||
- google-chrome
|
||||
- google-cloud-sdk
|
||||
- graphql-playground
|
||||
- iterm2
|
||||
- kindle
|
||||
- microsoft-office
|
||||
- ngrok
|
||||
- osxfuse
|
||||
- postico
|
||||
- postman
|
||||
- rstudio
|
||||
- sketch
|
||||
- slack
|
||||
- sublime-text
|
||||
- telegram
|
||||
- tunnelblick
|
||||
- vagrant
|
||||
- virtualbox
|
||||
- visual-studio-code
|
||||
- vlc
|
||||
- zeplin
|
||||
- zoomus
|
||||
- zoom
|
||||
- discord
|
||||
- moom
|
||||
- signal
|
||||
- spotify
|
||||
- whatsapp
|
||||
- alfred
|
||||
- kitty
|
||||
|
||||
- name: "Install homebrew packages"
|
||||
community.general.homebrew:
|
||||
name: [
|
||||
'autoconf',
|
||||
'automake',
|
||||
'aws-iam-authenticator',
|
||||
'awscli',
|
||||
'bfg',
|
||||
'coreutils',
|
||||
'curl',
|
||||
'dbt@0.18.0',
|
||||
'direnv',
|
||||
'dnsmasq',
|
||||
'erlang',
|
||||
'fzf',
|
||||
'gnu-time',
|
||||
'gpg',
|
||||
'heroku',
|
||||
'htop',
|
||||
'imagemagick@6',
|
||||
'kubectx',
|
||||
'kubernetes-cli',
|
||||
'kubernetes-helm',
|
||||
'libtool',
|
||||
'libxslt',
|
||||
'libyaml',
|
||||
'mas',
|
||||
'mysql',
|
||||
'openssl' ,
|
||||
'pkg-config',
|
||||
'postgresql',
|
||||
'r',
|
||||
'rcm',
|
||||
'readline',
|
||||
'redis',
|
||||
'sqlite3',
|
||||
'sshfs',
|
||||
'terraform',
|
||||
'tmux',
|
||||
'unixodbc',
|
||||
'unzip',
|
||||
'vim',
|
||||
'watchman',
|
||||
'weaveworks/tap/eksctl',
|
||||
'xz',
|
||||
'nvim',
|
||||
'mas',
|
||||
'bat',
|
||||
'fish',
|
||||
'neovim',
|
||||
'gh',
|
||||
'yarn',
|
||||
'zlib',
|
||||
'zsh',
|
||||
]
|
||||
state: present
|
||||
update_homebrew: yes
|
||||
|
||||
- name: "Link ImageMagick6 as main version (for rmagick gem)"
|
||||
shell: brew link -f imagemagick@6
|
||||
|
||||
- git:
|
||||
repo: https://github.com/asdf-vm/asdf.git
|
||||
dest: "/Users/{{ lookup('env', 'USER') }}/.asdf"
|
||||
version: v0.7.1
|
||||
|
||||
- name: Get the path to ZSH
|
||||
become: false
|
||||
local_action: command which zsh
|
||||
register: zsh_path
|
||||
|
||||
- name: "Ensure homebrew zsh is in allowed shells"
|
||||
lineinfile:
|
||||
path: /etc/shells
|
||||
line: "{{ zsh_path.stdout }}"
|
||||
become: true
|
||||
|
||||
- name: Install Oh My ZSH
|
||||
shell: sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
args:
|
||||
creates: "/Users/{{ lookup('env', 'USER') }}/.oh-my-zsh"
|
||||
|
||||
- name: Set ZSH as the default shell
|
||||
shell: chsh -s $(which zsh) {{ lookup('env', 'USER') }}
|
||||
become: true
|
||||
|
||||
- name: "Create a default ZSH configuration"
|
||||
template:
|
||||
src: templates/.zshrc.j2
|
||||
dest: /Users/{{ lookup('env', 'USER') }}/.zshrc
|
||||
owner: "{{ lookup('env', 'USER') }}"
|
||||
force: yes
|
||||
version: v0.8.1
|
||||
|
||||
- name: "Create a default asdf configuration"
|
||||
template:
|
||||
@@ -150,126 +73,41 @@
|
||||
owner: "{{ lookup('env', 'USER') }}"
|
||||
force: yes
|
||||
|
||||
- name: Create a default VSCode configuration
|
||||
template:
|
||||
src: templates/vscode-settings.json.j2
|
||||
dest: /Users/{{ lookup('env', 'USER') }}/Library/Application Support/Code/User/settings.json
|
||||
owner: "{{ lookup('env', 'USER') }}"
|
||||
force: no
|
||||
|
||||
- name: Install VSCode extensions
|
||||
shell: code --install-extension {{ item }}
|
||||
with_items:
|
||||
- apollographql.vscode-apollo
|
||||
- bradlc.vscode-tailwindcss
|
||||
- castwide.solargraph
|
||||
- clinyong.vscode-css-modules
|
||||
- eamodio.gitlens
|
||||
- jakebecker.elixir-ls
|
||||
- kaiwood.endwise
|
||||
- karunamurti.haml
|
||||
- ms-vscode-remote.vscode-remote-extensionpack
|
||||
- ms-vscode.vscode-typescript-tslint-plugin
|
||||
- msjsdiag.debugger-for-chrome
|
||||
- rebornix.ruby
|
||||
- richie5um2.vscode-sort-json
|
||||
- Tyriar.sort-lines
|
||||
- vscodevim.vim
|
||||
- vscoss.vscode-ansible
|
||||
- wholroyd.jinja
|
||||
- wingrunr21.vscode-ruby
|
||||
- xabikos.javascriptsnippets
|
||||
|
||||
- name: "Install asdf plugins"
|
||||
shell: |
|
||||
source /Users/{{ lookup('env', 'USER') }}/.asdf/asdf.sh
|
||||
asdf plugin-add {{ item }} || exit 0
|
||||
with_items:
|
||||
- ruby
|
||||
- elixir
|
||||
- nodejs
|
||||
- python
|
||||
- erlang
|
||||
- rust
|
||||
|
||||
- name: "Install Default Python"
|
||||
shell: |
|
||||
source /Users/{{ lookup('env', 'USER') }}/.asdf/asdf.sh
|
||||
asdf install python 3.9.1
|
||||
asdf global python 3.9.1
|
||||
pip3 install boto
|
||||
asdf install python 3.10.1
|
||||
asdf global python 3.10.1
|
||||
pip3 install ansible
|
||||
pip3 install jupyterlab
|
||||
pip3 isntall numpy
|
||||
pip3 install scipy
|
||||
pip3 install matplotlib
|
||||
pip3 install ipython
|
||||
pip3 install jupyter
|
||||
pip3 install pandas
|
||||
pip3 install sympy
|
||||
pip3 install nose
|
||||
pip3 install scikit-learn
|
||||
asdf reshim python
|
||||
|
||||
- name: "Install Default Ruby"
|
||||
- name: "Install default Rust"
|
||||
shell: |
|
||||
source /Users/{{ lookup('env', 'USER') }}/.asdf/asdf.sh
|
||||
asdf install ruby 3.0.0
|
||||
asdf install ruby 2.7.2
|
||||
asdf global ruby 3.0.0
|
||||
gem install bundler -v 2.2.4
|
||||
gem install cocoapods
|
||||
gem install rubocop
|
||||
gem install solargraph
|
||||
asdf install rust 1.58.1
|
||||
asdf global rust 1.58.1
|
||||
asdf reshim rust
|
||||
|
||||
- name: "Install default node"
|
||||
shell: |
|
||||
source /Users/{{ lookup('env', 'USER') }}/.asdf/asdf.sh
|
||||
bash /Users/{{ lookup('env', 'USER') }}/.asdf/plugins/nodejs/bin/import-release-team-keyring
|
||||
asdf install nodejs 14.15.3
|
||||
asdf global nodejs 14.15.3
|
||||
|
||||
- name: "Install default elixir"
|
||||
shell: |
|
||||
source /Users/{{ lookup('env', 'USER') }}/.asdf/asdf.sh
|
||||
asdf install elixir 1.11.2
|
||||
asdf global elixir 1.11.2
|
||||
mix local.hex --force
|
||||
mix archive.install hex phx_new 1.5.7 --force
|
||||
asdf install nodejs 17.4.0
|
||||
asdf global nodejs 17.4.0
|
||||
|
||||
- name: Install yarn packages
|
||||
shell: yarn global add {{ item }} --prefix /usr/local
|
||||
shell: yarn global add {{ item }}
|
||||
with_items:
|
||||
- react-native-cli
|
||||
- create-react-app
|
||||
- apollo
|
||||
- generator-generator
|
||||
- yo
|
||||
- name: re-generate bins now we've installed some yarn packages
|
||||
shell: asdf reshim nodejs
|
||||
|
||||
- name: Install Addroid SDKs etc
|
||||
shell: yes | sdkmanager "{{ item }}" --sdk_root=/Users/{{ lookup('env', 'USER') }}/Library/Android/sdk
|
||||
with_items:
|
||||
- "add-ons;addon-google_apis-google-21"
|
||||
- "add-ons;addon-google_apis-google-22"
|
||||
- "add-ons;addon-google_apis-google-23"
|
||||
- "build-tools;23.0.1"
|
||||
- "build-tools;23.0.3"
|
||||
- "build-tools;25.0.2"
|
||||
- "build-tools;25.0.3"
|
||||
- "build-tools;26.0.0"
|
||||
- "build-tools;26.0.1"
|
||||
- "build-tools;26.0.2"
|
||||
- "build-tools;26.0.3"
|
||||
- "build-tools;27.0.3"
|
||||
- "build-tools;28.0.3"
|
||||
- "extras;android;m2repository"
|
||||
- "extras;google;google_play_services"
|
||||
- "extras;google;m2repository"
|
||||
- "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1"
|
||||
- "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"
|
||||
- "platforms;android-23"
|
||||
- "platforms;android-25"
|
||||
- "platforms;android-26"
|
||||
- "platforms;android-27"
|
||||
- "platforms;android-28"
|
||||
- "system-images;android-23;google_apis;x86"
|
||||
- "system-images;android-26;google_apis;x86"
|
||||
@@ -1,8 +1,10 @@
|
||||
#!/bin/sh
|
||||
xcode-select --install
|
||||
sudo xcodebuild -license
|
||||
sudo easy_install pip
|
||||
pip install --ignore-installed ansible
|
||||
/usr/sbin/softwareupdate --install-rosetta
|
||||
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
||||
python3 get-pip.py
|
||||
sudo pip3 install --ignore-installed ansible
|
||||
ansible-galaxy install -r requirements.yml
|
||||
|
||||
ansible-playbook -i "localhost," -c local ansible_osx.yml --ask-become-pass
|
||||
9
manual_tasks.md
Normal file
9
manual_tasks.md
Normal file
@@ -0,0 +1,9 @@
|
||||
## Manual
|
||||
- [ ] Remap Caps Lock to Escape
|
||||
- [ ] change scroll direction
|
||||
- [ ] turn off touch bar (fn key)
|
||||
- [ ] Twisted Wave
|
||||
- [ ] Smart Countdown Timer
|
||||
- [ ] Close.io
|
||||
- [ ] set fish or bash as the main terminal (not zsh)
|
||||
- [ ] install Dank Mono
|
||||
@@ -1,7 +1,6 @@
|
||||
---
|
||||
roles:
|
||||
- name: geerlingguy.homebrew
|
||||
collections:
|
||||
- name: https://github.com/ansible-collections/community.general.git
|
||||
type: git
|
||||
version: main
|
||||
- name: geerlingguy.mac
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
- name: "Install homebrew packages"
|
||||
community.general.homebrew:
|
||||
name: [ dnsmasq ]
|
||||
state: present
|
||||
update_homebrew: true
|
||||
|
||||
- name: "Get config directory"
|
||||
shell:
|
||||
cmd: echo "$(brew --prefix)/etc/"
|
||||
register: config_directory
|
||||
|
||||
- name: Create config directory
|
||||
file:
|
||||
path: "{{ config_directory.stdout | trim }}"
|
||||
state: directory
|
||||
|
||||
- name: Create config
|
||||
template:
|
||||
src: dnsmasq.conf.j2
|
||||
dest: "{{ config_directory.stdout | trim }}/dnsmasq.conf"
|
||||
|
||||
- name: Create resolvers directory
|
||||
file:
|
||||
path: /etc/resolver/
|
||||
state: directory
|
||||
become: true
|
||||
|
||||
- name: Create resolver
|
||||
template:
|
||||
src: local-resolver.j2
|
||||
dest: /etc/resolver/localhost
|
||||
become: true
|
||||
|
||||
- name: Notes
|
||||
debug:
|
||||
msg: "Remember must be started with sudo, e.g. sudo brew services start dnsmasq"
|
||||
@@ -1,2 +0,0 @@
|
||||
address=/.localhost/127.0.0.1
|
||||
port=53
|
||||
@@ -1 +0,0 @@
|
||||
nameserver 127.0.0.1
|
||||
@@ -1,37 +0,0 @@
|
||||
# This file us auto-generated by ansible, do not change this file directly
|
||||
# instead make changes to ~/.zshrc.personal which is loaded after this file
|
||||
|
||||
# Setup some standard paths
|
||||
export ANDROID_HOME=~/Library/Android/sdk
|
||||
export PATH=${PATH}:${ANDROID_HOME}/tools
|
||||
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
|
||||
export PATH=/usr/local/opt/imagemagick@6/bin:${PATH}
|
||||
|
||||
# For compilers to find zlib you may need to set:
|
||||
export LDFLAGS="${LDFLAGS} -L/usr/local/opt/zlib/lib"
|
||||
export CPPFLAGS="${CPPFLAGS} -I/usr/local/opt/zlib/include"
|
||||
|
||||
# For pkg-config to find zlib you may need to set:
|
||||
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH} /usr/local/opt/zlib/lib/pkgconfig"
|
||||
|
||||
# ZSH setup
|
||||
export ZSH=$HOME/.oh-my-zsh
|
||||
ZSH_THEME="robbyrussell"
|
||||
plugins=(git kubectl)
|
||||
DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||
ZSH_DISABLE_COMPFIX=true
|
||||
|
||||
# Load personal pre oh-my-zsh init config which should be stored in ~/.zshrc.personal.before
|
||||
# E.g. setting ZSH theme etc
|
||||
if [ -f ~/.zshrc.personal.before ]; then . ~/.zshrc.personal.before; fi
|
||||
|
||||
# Load Oh My Zsh
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# Load personal ZSH config which should be stored in ~/.zshrc.personal.after
|
||||
# Most ZSH config e.g. aliases etc goes here
|
||||
if [ -f ~/.zshrc.personal.after ]; then . ~/.zshrc.personal.after; fi
|
||||
|
||||
# Load asdf
|
||||
. $HOME/.asdf/asdf.sh
|
||||
. $HOME/.asdf/completions/asdf.bash
|
||||
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"breadcrumbs.enabled": false,
|
||||
"cSpell.language": "en-GB",
|
||||
"diffEditor.ignoreTrimWhitespace": false,
|
||||
"editor.lineNumbers": "relative",
|
||||
"editor.minimap.enabled": false,
|
||||
"editor.tabSize": 2,
|
||||
"elixirLS.fetchDeps": false,
|
||||
"explorer.confirmDragAndDrop": false,
|
||||
"files.associations": {
|
||||
"*.html.leex": "html-eex",
|
||||
"*.leex": "html-eex"
|
||||
},
|
||||
"gitlens.menus": {
|
||||
"editor": false,
|
||||
"editorGroup": false,
|
||||
"editorTab": false,
|
||||
"explorer": false,
|
||||
"scmGroup": false,
|
||||
"scmItem": false
|
||||
},
|
||||
"path-autocomplete.triggerOutsideStrings": true,
|
||||
"ruby.codeCompletion": "rcodetools",
|
||||
"ruby.format": "rubocop",
|
||||
"ruby.intellisense": "rubyLocate",
|
||||
"ruby.useLanguageServer": true,
|
||||
"terminal.integrated.allowChords": false,
|
||||
"typescript.tsserver.log": "verbose",
|
||||
"typescript.updateImportsOnFileMove.enabled": "always",
|
||||
"window.title": "${activeEditorLong}${separator}${rootName}",
|
||||
"window.zoomLevel": 2,
|
||||
"workbench.activityBar.visible": true,
|
||||
"workbench.editor.closeEmptyGroups": false,
|
||||
"workbench.editor.labelFormat": "short",
|
||||
"workbench.editor.revealIfOpen": true,
|
||||
"workbench.editor.showTabs": true,
|
||||
"workbench.sideBar.location": "left",
|
||||
"workbench.statusBar.visible": true,
|
||||
"zenMode.fullScreen": false,
|
||||
"zenMode.hideLineNumbers": false,
|
||||
"zenMode.hideTabs": false
|
||||
}
|
||||
Reference in New Issue
Block a user