Files
ansible-osx-setup/ansible_osx.yml
2019-05-01 14:16:15 +01:00

213 lines
6.4 KiB
YAML

---
- hosts: localhost
tasks:
- name: Install homebrew
shell: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- name: Install core packages via brew casks
homebrew_cask: name={{ item }} state=present
with_items:
- virtualbox
- vagrant
- visual-studio-code
- google-chrome
- slack
- postico
- datagrip
- sublime-text
- iterm2
# - docker-edge
- android-studio
# - caskroom/versions/java8
- android-sdk
- ngrok
- zeplin
- graphql-playground
- dash
- sketch
- zoomus
- postman
- microsoft-office
- amazon-workspaces
# - # 1password # @TODO uncomment this once don't have it already installed....
- private-internet-access
# - ADD FUSE and SSHFS (https://osxfuse.github.io/)
- google-cloud-sdk
- name: 'add custom homebrew repos'
homebrew_tap:
name: heroku/brew
- name: "Install homebrew packages"
homebrew:
name: [
'zsh',
'tmux',
'vim',
'yarn',
'kubernetes-cli',
'kubernetes-helm',
'mas',
'postgresql',
'watchman',
'heroku',
'awscli',
'imagemagick@6',
'gnu-time',
'kubectx',
'coreutils',
'automake',
'autoconf',
'openssl' ,
'libyaml',
'readline',
'libxslt',
'libtool',
'unixodbc',
'unzip',
'curl',
'gpg'
]
state: present
update_homebrew: yes
- name: "Link ImageMagick6 as main version (for rmagick gem)"
homebrew:
name: imagemagick@6
state: linked
- git:
repo: https://github.com/asdf-vm/asdf.git
dest: "/Users/{{ lookup('env', 'USER') }}/.asdf"
version: v0.7.1
# Note that MAS can only installed applications which are already in the "purchased" tab
# of the Mac app store. So if you're using a new app store account or you've never installed
# one of the below apps before, you'll need to install it from the Mac App Store app by hand
# the first time.
- name: Install apps from the Mac App Store using MAS (Assumes you're logged in etc)
shell: mas install {{ item }}
with_items:
- 409183694 # Keynote
- 1295203466 # Microsoft remote desktop
- 497799835 # xcode
- 496437906 # shush microphone manager
- name: Install Addroid SDKs etc
shell: yes | sdkmanager "{{ item }}" --sdk_root=/Users/{{ lookup('env', 'USER') }}/Library/Android/sdk
with_items:
- "platforms;android-23"
- "platforms;android-25"
- "platforms;android-26"
- "platforms;android-27"
- "platforms;android-28"
- "build-tools;23.0.3"
- "build-tools;23.0.1"
- "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"
- "system-images;android-23;google_apis;x86"
- "system-images;android-26;google_apis;x86"
- "extras;android;m2repository"
- "extras;google;m2repository"
- "extras;google;google_play_services"
- "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1"
- "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"
- "add-ons;addon-google_apis-google-21"
- "add-ons;addon-google_apis-google-22"
- "add-ons;addon-google_apis-google-23"
- 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)"
- 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
- name: "Create a default asdf configuration"
template:
src: templates/.asdfrc.j2
dest: /Users/{{ lookup('env', 'USER') }}/.asdfrc
owner: "{{ lookup('env', 'USER') }}"
force: yes
- name: "Install asdf plugins"
shell: asdf plugin-add {{ item }} || exit 0
with_items:
- ruby
- elixir
- nodejs
- name: "Install Default Ruby"
shell: |
asdf install ruby 2.4.2
asdf global ruby 2.4.2
- name: "Install default node"
shell: |
asdf install nodejs 11.11.0
bash /Users/{{ lookup('env', 'USER') }}/.asdf/plugins/nodejs/bin/import-release-team-keyring
asdf global nodejs 11.11.0
- name: "Install default elixir"
shell: |
asdf install elixir 1.6
asdf global elixir 1.6
- name: Install yarn packages
shell: yarn global add {{ item }} --prefix /usr/local
with_items:
- react-native-cli
- create-react-app
- apollo
- name: Install VSCode extensions
shell: code --install-extension {{ item }}
with_items:
- PeterJausovec.vscode-docker
- apollographql.vscode-apollo
- clinyong.vscode-css-modules
- rebornix.ruby
- peterjausovec.vscode-docker
- karunamurti.haml
- kaiwood.endwise
- eamodio.gitlens
- vscoss.vscode-ansible
- 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 a global ruby and some core gems
# shell: |
# eval "$(rbenv init -)"
# rbenv install 2.4.2
# rbenv global 2.4.2
# gem update --system
# gem install rcodetools rubocop cocoapods rails ruby-lint