Files
ansible-osx-setup/ansible_osx.yml
2020-12-30 20:36:24 +08:00

264 lines
7.5 KiB
YAML

---
- hosts: localhost
tasks:
- name: Install homebrew
shell: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- name: Setup dnsmasq
include_role: dnsmasq
- name: 'add custom homebrew repos'
homebrew_tap:
name: [
heroku/brew,
thoughtbot/formulae,
caskroom/versions,
adoptopenjdk/openjdk,
weaveworks/tap,
fishtown-analytics/dbt
]
- name: Install core packages via brew casks
homebrew_cask: name={{ item }} state=present
ignore_errors: yes
with_items:
- 1password
- android-sdk
- android-studio
- dash
- datagrip
- docker
- dropbox
- google-chrome
- google-cloud-sdk
- graphql-playground
- iterm2
- adoptopenjdk/openjdk/adoptopenjdk8
- kindle
- microsoft-office
- ngrok
- osxfuse
- postico
- postman
- rstudio
- sketch
- slack
- sublime-text
- tunnelblick
- vagrant
- virtualbox
- visual-studio-code
- vlc
- zeplin
- zoomus
- name: "Install homebrew packages"
homebrew:
name: [
'autoconf',
'automake',
'awscli',
'aws-iam-authenticator',
'coreutils',
'curl',
'dbt',
'direnv',
'dnsmasq',
'erlang',
'fzf',
'gnu-time',
'gpg',
'heroku',
'imagemagick@6',
'kubectx',
'kubernetes-cli',
'kubernetes-helm',
'libtool',
'libxslt',
'libyaml',
'mas',
'mysql',
'openssl' ,
'pkg-config',
'postgresql',
'r',
'rcm',
'readline',
'redis',
'sqlite3',
'sshfs',
'tmux',
'terraform',
'unixodbc',
'unzip',
'vim',
'watchman',
'weaveworks/tap/eksctl',
'xz',
'yarn',
'zsh',
'zlib',
]
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: 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"
- 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
- 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: |
source /Users/{{ lookup('env', 'USER') }}/.asdf/asdf.sh
asdf plugin-add {{ item }} || exit 0
with_items:
- ruby
- elixir
- nodejs
- python
- name: "Install Default Python"
shell: |
export LDFLAGS="${LDFLAGS} -L/usr/local/opt/zlib/lib"
export CPPFLAGS="${CPPFLAGS} -I/usr/local/opt/zlib/include"
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH} /usr/local/opt/zlib/lib/pkgconfig"
source /Users/{{ lookup('env', 'USER') }}/.asdf/asdf.sh
asdf install python 3.7.3
asdf global python 3.7.3
pip3 install boto
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"
shell: |
source /Users/{{ lookup('env', 'USER') }}/.asdf/asdf.sh
asdf install ruby 2.4.2
asdf global ruby 2.4.2
gem install bundler -v 1.17.3
gem install cocoapods
- 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 11.11.0
asdf install nodejs 10.8.0
asdf install nodejs 9.11.1
asdf global nodejs 11.11.0
- name: "Install default elixir"
shell: |
source /Users/{{ lookup('env', 'USER') }}/.asdf/asdf.sh
asdf install elixir 1.6
asdf install elixir 1.9.1
asdf global elixir 1.9.1
mix archive.install hex phx_new 1.4.9 --force
- name: Install yarn packages
shell: yarn global add {{ item }} --prefix /usr/local
with_items:
- react-native-cli
- create-react-app
- apollo
- generator-generator
- yo
- name: Install VSCode extensions
shell: code --install-extension {{ item }}
with_items:
- apollographql.vscode-apollo
- clinyong.vscode-css-modules
- eamodio.gitlens
- kaiwood.endwise
- karunamurti.haml
- ms-vscode.vscode-typescript-tslint-plugin
- PeterJausovec.vscode-docker
- peterjausovec.vscode-docker
- rebornix.ruby
- Tyriar.sort-lines
- 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