Skip to content

Instantly share code, notes, and snippets.

@snowleung
Created May 2, 2017 14:44
Show Gist options
  • Save snowleung/81bcc207d4a84c7e65048fa2b90f95b2 to your computer and use it in GitHub Desktop.
Save snowleung/81bcc207d4a84c7e65048fa2b90f95b2 to your computer and use it in GitHub Desktop.
ansible playbook to set up your mac, include:
---
# ## osx startup
# ansible playbook to set up your mac, include:
# * oh~my~zsh
# * pyenv
# * pyenv-virtualenv
# * emacs
# ## dependency
# * [homebrew](https://brew.sh/)
# * [Ansible](https://github.com/ansible/ansible/)
# ## How to use
# ```shell
# ansible-playbook startup.yml
# ```
#############################
- hosts: localhost
tasks:
- name: install ohmyzsh
command: sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
- name: clone pyenv
git:
repo: https://github.com/pyenv/pyenv.git
dest: ~/.pyenv
- name: install virtual
git:
repo: https://github.com/pyenv/pyenv-virtualenv.git
dest: ~/.pyenv/plugins/pyenv-virtualenv
- lineinfile: dest=~/.zshrc line='#pyenv required'
- lineinfile: dest=~/.zshrc line='export PYENV_ROOT="$HOME/.pyenv"'
- lineinfile: dest=~/.zshrc line='export PATH="$PYENV_ROOT/bin:$PATH"'
- lineinfile: dest=~/.zshrc line='eval "$(pyenv init -)"'
- lineinfile: dest=~/.zshrc line='eval "$(pyenv virtualenv-init -)"'
- lineinfile: dest=~/.zshrc line='#my script'
- lineinfile: dest=~/.zshrc line="alias djsrc='open https://github.com/django/django/tree/stable/1.6.x'"
- lineinfile: dest=~/.zshrc line="alias pysrc='open https://github.com/python-git/python'"
- lineinfile: dest=~/.zshrc line="alias gsheet='open https://docs.google.com/spreadsheets/u/0/'"
- lineinfile: dest=~/.zshrc line="alias emptycurr='git push origin :$(current_branch)'"
- lineinfile: dest=~/.zshrc line="alias rmpyc='find . -name \"*.pyc\" -delete'"
- lineinfile: dest=~/.zshrc line="alias rmtmp='find . -name \"*~\" -delete'"
- lineinfile: dest=~/.zshrc line="alias rmlogs='find . -name \"*.log\" -delete'"
- lineinfile: dest=~/.zshrc line="alias gnr='grep -nr'"
- name: install emacs
command: brew install emacs
### CONFIG Emacs ###
- name: clone emacsd
git:
repo: https://github.com/snowleung/myemacsd
dest: ~/myemacsd
- name: config my emacs
command: cp -rf ~/myemacsd/.emacs ~/
- name: config my emacs2
command: cp -rf ~/myemacsd/.emacs.d ~/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment