MacBook の環境を管理する。
# brew と brew cask は導入済み
$ brew install ansible
$ ansible --version
ansible 2.5.0
今回用意した 2 つのファイル。
localhost
---
- hosts: localhost
connection: local
gather_facts: no
become: no
vars:
homebrew_packages:
- name: fish
- name: git
- name: node
- name: pyenv
- name: python
- name: tree
- name: vim
homebrew_cask_packages:
- name: atom
- name: docker
- name: dropbox
- name: evernote
- name: google-chrome
- name: google-drive
- name: iTerm2
- name: slack
- name: vagrant
- name: virtualbox
tasks:
- name: update homebrew
homebrew: update_homebrew=yes
# brew
- name: install homebrew_packages
homebrew:
name={{ item.name }}
with_items: '{{ homebrew_packages }}'
# homebrew_cask
- name: install homebrew_cask_packages
homebrew_cask:
name={{ item.name }}
with_items: '{{ homebrew_cask_packages }}'
実行。
$ ansible-playbook -i hosts localhostsyml