Last active
June 19, 2019 00:38
-
-
Save ishideo/426e4e86981ad73a09ef2ddf8729a5c7 to your computer and use it in GitHub Desktop.
Mac Setup Ansible Playbook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Mac Setup | |
hosts: 127.0.0.1 | |
connection: local | |
var: | |
brew_cask_apps: | |
- qlmarkdown | |
- qlcolorcode | |
- quicklook-json | |
- qlprettypatch | |
- quicklook-csv | |
- betterzipql | |
- qlimagesize | |
- webpquicklook | |
- qlvideo | |
- quicklookase | |
# - suspicious-package | |
- sourcetree | |
- imageoptim | |
- tinypng | |
- vivaldi | |
- the-unarchiver | |
- intellij-idea-ce | |
- mysqlworkbench | |
- dbeaver-community | |
- sequel-pro | |
- tableplus | |
- appcleaner | |
- emacs | |
- alfred | |
- mi | |
- flux | |
- textmate | |
- clipy | |
- flycut | |
- iterm2 | |
- visual-studio-code | |
- macvim | |
- rstudio | |
- libreoffice | |
- cakebrew | |
- font-m-plus | |
- stackedit | |
- marxico | |
- google-japanese-ime | |
brew_packages: | |
- mariadb | |
- spark | |
- tor | |
- geckodriver | |
- q | |
- nodebrew | |
- pyenv | |
- emacs | |
- go | |
- neovim | |
- R | |
- nodebrew | |
- zsh | |
- peco | |
- tmux | |
- bash-completion | |
- autoconf | |
- doxygen | |
- git | |
- git-lfs | |
- jq | |
- nmap | |
- oath-toolkit | |
- openssl | |
- ssh-copy-id | |
- tig | |
- tree | |
- wget | |
- the_silver_searcher | |
- fzf | |
- fish | |
- ack | |
- gibo | |
- zsh-syntax-highlighting | |
tasks: | |
- name: Install Homebrew Cask Packages | |
homebrew_cask: | |
name: "{{ item }}" | |
state: "present" | |
install_options: "appdir=/Applications" | |
accept_external_apps: yes | |
with_items: "{{ brew_cask_apps }}" | |
- name: Installing Homebrew Packages | |
homebrew: | |
name: '{{ brew_packages }}' | |
state: 'present' | |
- name: install vim | |
homebrew: | |
name: | |
- vim | |
install_options: | |
--with-override-system-vi | |
- name: 'check spacemacs' | |
stat: path=~/.emacs.d/ | |
register: spacemacs_directory | |
- name: Install Spacemacs | |
shell: git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d | |
when: spacemacs_directory.stat.exists == false | |
- name: 'check prelude' | |
stat: path=~/.prelude/ | |
register: prelude_directory | |
- name: Install prelude | |
shell: git clone https://github.com/bbatsov/prelude ~/.prelude | |
when: prelude_directory.stat.exists == false | |
- name: 'check oh-my-zsh' | |
stat: path=~/.oh-my-zsh/ | |
register: oh_my_zsh_directory | |
- name: Install oh-my-zsh | |
shell: sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | |
args: | |
creates: ~/.oh-my-zsh/ | |
when: oh_my_zsh_directory.stat.exists == false | |
- name: 'check oh-my-fish' | |
stat: path=~/.local/share/fish/ | |
register: oh_my_fish_directory | |
- name: Install oh-my-fish | |
shell: curl -L https://get.oh-my.fish | fish | |
when: oh_my_fish_directory.stat.exists == false | |
- name: Check venv | |
stat: path=~/venv | |
register: venv_directory | |
- name: Install venv | |
shell: python3 -m venv ~/venv | |
when: venv_directory.stat.exists == false | |
- name: Activate venv | |
shell: source ~/venv/bin/activate | |
- name: Check .bashrc | |
stat: path=~/.bashrc | |
register: f | |
- name: touch .bashrc | |
shell: touch ~/.bashrc | |
when: f.stat.exists == false | |
- name: Add lines on .bashrc | |
lineinfile: | |
dest=~/.bashrc | |
line={{ item }} | |
with_items: | |
- 'source ~/venv/bin/activate' | |
- 'source ~/.sdkman/bin/sdkman-init.sh' | |
- 'export JAVA_HOME=~/.sdkman/candidates/java/current' | |
- 'export PATH=$JAVA_HOME/bin:$PATH' | |
- 'export PATH=$HOME/.nodebrew/current/bin:$PATH' | |
- 'eval "$(direnv hook bash)"' | |
- name: Add lines on .zshrc | |
lineinfile: | |
dest=~/.zshrc | |
line={{ item }} | |
with_items: | |
- 'source ~/venv/bin/activate' | |
- 'source ~/.sdkman/bin/sdkman-init.sh' | |
- 'export JAVA_HOME=~/.sdkman/candidates/java/current' | |
- 'export PATH=$JAVA_HOME/bin:$PATH' | |
- 'export PATH=$HOME/.nodebrew/current/bin:$PATH' | |
- 'eval "$(direnv hook zsh)"' | |
- name: source ~/.bashrc | |
shell: 'source ~/.bashrc' | |
- name: Check sdkman | |
stat: path=~/.sdkman/ | |
register: sdkman_directory | |
- name: Install sdkman | |
shell: curl -s "https://get.sdkman.io" | bash | |
when: sdkman_directory.stat.exists == false | |
- name: Install java | |
command: bash -lc "sdk install java" | |
- name: pip install | |
pip: | |
name: "{{ item }}" | |
with_items: | |
- ptpdb | |
- flake8-mypy | |
- pysocks | |
- pyvirtualdisplay | |
- pytest | |
- pytest-cov | |
- psutil | |
- neovim | |
- prompt_toolkit | |
- xonsh | |
- jedi | |
- flake8 | |
- autopep8 | |
- black | |
- flake8-import-order | |
- pyflakes | |
- pep8 | |
- pipenv | |
- pylint | |
- mccabe | |
- mypy | |
- yapf | |
- isort | |
failed_when: False | |
- name: 'setting macOS' | |
osx_defaults: > | |
domain={{ item.domain }} | |
key={{ item.key }} | |
type={{ item.type }} | |
value={{ item.value }} | |
state={{ item.state|default('present') }} | |
with_items: | |
- { domain: com.apple.dock, key: autohide, type: bool, value: true } | |
- { domain: com.apple.dock, key: autohide-delay, type: float, value: 0 } | |
- { domain: com.apple.dock, key: autohide-time-modifier, type: int, value: 0 } | |
- { domain: com.apple.finder, key: ShowStatusBar, type: bool, value: true } | |
- { domain: com.apple.finder, key: ShowPathbar, type: bool, value: true } | |
- { domain: com.apple.finder, key: ShowTabView, type: bool, value: true } | |
- { domain: com.apple.finder, key: AppleShowAllFiles, type: bool, value: true } | |
- { domain: com.apple.finder, key: _FXShowPosixPathInTitle, type: bool, value: true } | |
- { domain: com.apple.finder, key: QLEnableTextSelection, type: bool, value: true } | |
- { domain: com.apple.desktopservices, key: DSDontWriteNetworkStores, type: bool, value: true } | |
- { domain: com.apple.dashboard, key: mcx-disabled, type: bool, value: true } | |
- { domain: NSGlobalDomain, key: WebKitDeveloperExtras, type: bool, value: true } | |
- { domain: com.apple.menuextra.battery, key: ShowPercent, type: string, value: "YES" } | |
- name: Check .nodebrew | |
stat: path=~/.nodebrew/ | |
register: nodebrew_directory | |
- name: Setup nodebrew | |
shell: nodebrew setup; nodebrew install-binary stable | |
when: nodebrew_directory.stat.exists == false | |
- name: Start the MariaDB service at login | |
shell: if [[ $(/usr/local/bin/brew services list | /usr/bin/grep mariadb | /usr/bin/awk '{print $2}') != "started" ]]; then /usr/local/bin/brew services start mariadb; fi | |
register: brew_services_mariadb_running_result | |
changed_when: brew_services_mariadb_running_result.stdout != '' | |
become: brew_services_mariadb_running_result.stdout != '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment