Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Macの開発環境構築をAnsibleで自動化する

 Macの開発環境構築をAnsibleで自動化する

第93回PHP勉強会@東京のLT資料です。

関連リンク:
http://tech.quartetcom.co.jp/2015/07/24/mac-osx-ansible/
https://phpstudy.doorkeeper.jp/events/30029

Takashi Kanemoto

August 25, 2015
Tweet

More Decks by Takashi Kanemoto

Other Decks in Programming

Transcript

  1. • brew install ͋Ε͜Ε • GUIΞϓϦ͋Ε͜ΕΠϯετʔϧ • dotfiles (~/.xxx) ೖΕΔ

    • httpd.conf ฤू • php.ini ฤू MacΛങ͍׵͑ͨͱ͖ ίϚϯυҰൃͰ ͢΂ͯऴΘΒ͍ͤͨʂ
  2. $ cat localhost.yml - hosts: localhost connection: local gather_facts: no

    sudo: no tasks: - homebrew: name={パッケージ名1} - homebrew: name={パッケージ名2} ؆୯ͳྫʢbrew installʣ $ cat hosts localhost
  3. ஔ׵ͱߦૠೖͰԿͱ͔ͳΔ • ྫɿ’Listen 8080’ Λ ‘Listen 80’ ʹஔ׵ - replace:

    dest: /path/to/httpd.conf regexp: '^( *Listen) .*$' replace: '\1 80'
  4. • ྫɿ’#ServerName ‘ Ͱ࢝·Δߦͷ͋ͱʹ
 ‘ServerName localhost:80’ Λૠೖ - lineinfile: dest:

    /path/to/httpd.conf insertafter: '^#ServerName ' line: 'ServerName localhost:80' ஔ׵ͱߦૠೖͰԿͱ͔ͳΔ
  5. via Ansible 1. ~/dotfiles ʹ git clone 2. ~/dotfiles/symlink.sh Λ࣮ߦ

    - git: repo: [email protected]:you/dotfiles.git dest: ~/dotfiles register: ret - shell: 'cd ~/dotfiles ; sh symlink.sh' when: ret|changed
  6. • brew install ͋Ε͜Ε • GUIΞϓϦ͋Ε͜ΕΠϯετʔϧ • dotfiles (~/.xxx) ೖΕΔ

    • httpd.conf ฤू • php.ini ฤू MacΛങ͍׵͑ͨͱ͖ ίϚϯυҰൃͰ ͢΂ͯऴΘΒͤͨͬͨʂ