Created
May 2, 2015 13:19
-
-
Save gin0606/eaa173e7889c07454f63 to your computer and use it in GitHub Desktop.
roles/base/task/main.yaml
This file contains 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: Command Line Toolsが入っているかの確認 | |
stat: path=/usr/include | |
register: command_line_tools_dir | |
- name: Command Line Toolsが入っていなかったらインストールする | |
shell: | | |
PLACEHOLDER=/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress | |
touch $PLACEHOLDER | |
PROD=$(softwareupdate -l | grep "\*.*Command Line" | head -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | tr -d '\n') | |
softwareupdate -i "${PROD}" | |
[[ -f $PLACEHOLDER ]] && rm $PLACEHOLDER | |
when: not command_line_tools_dir.stat.exists | |
- name: homebrewが入っているかの確認 | |
command: type /usr/local/bin/brew | |
register: exist_homebrew | |
ignore_errors: yes | |
- name: homebrewが入っていなかったらインストールする | |
shell: echo '\n' | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
when: "'not found' in exist_homebrew.stderr" | |
- homebrew: update_homebrew=yes | |
- homebrew_tap: tap={{ item }} state=present | |
with_items: homebrew.tap | |
- homebrew_cask: name={{ item }} | |
with_items: homebrew.cask | |
- homebrew: name={{ item }} | |
with_items: homebrew.formula | |
- name: rbenv関係のformulaをインストールする | |
homebrew: name={{ item }} | |
with_items: | |
- rbenv | |
- ruby-build | |
- rbenv-gem-rehash | |
- file: path=~/.bash_profile state=touch | |
- lineinfile: dest=~/.bash_profile line='if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' | |
- lineinfile: dest=~/.bash_profile line='export PATH=$HOME/.rbenv/shims:$PATH' | |
- shell: /bin/bash -lc "rbenv install --skip-existing {{ rbenv.global }}" | |
- shell: /bin/bash -lc "rbenv global {{ rbenv.global }}" | |
- gem: name={{ item }} | |
with_items: ruby.gems |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment