空前絶後のォォ!超絶怒濤のAnsible/fukuten-20170127

 空前絶後のォォ!超絶怒濤のAnsible/fukuten-20170127

Fukuoka.NET #5 2017/1/27 LT資料です。

356dbe9f00ed6a1f5dafe126029497f1?s=128

Kunihiro Morita

January 27, 2017
Tweet

Transcript

  1. ۭલઈޙͷΥΥʂ ௒ઈౖᔶͷAnsible 2017/1/27 Fukuoka.NET (Fukuten) #5 1

  2. Kunihiro Morita AlterBooth,inc. Solutions Architect @morita92hiro morita92hiro http://hawaku.hateblo.jp 2017/1/27 Fukuoka.NET

    (Fukuten) #5 2
  3. 2017/1/27 Fukuoka.NET (Fukuten) #5 3

  4. Ansible by Red Hat 2017/1/27 Fukuoka.NET (Fukuten) #5 4

  5. Red Hat ❤ Microsoft 2017/1/27 Fukuoka.NET (Fukuten) #5 5

  6. Ansibleͱ͸ 4 PythonͰಈ͘ 4 ίʔυͰΠϯϑϥΛߏ੒؅ཧ͢Δπʔϧ 4 Infrastructure as code 2017/1/27

    Fukuoka.NET (Fukuten) #5 6
  7. ྨࣅπʔϧ 4 chef 4 puppet 2017/1/27 Fukuoka.NET (Fukuten) #5 7

  8. ͳͥ࢖͏ʁ 2017/1/27 Fukuoka.NET (Fukuten) #5 8

  9. ߏ੒؅ཧπʔϧͳ͠ 4 खॱॻΛݩʹखಈͰઃఆ 4 खಈͳͷͰϛε΋͓͖Δ 4 खॱॻ͸࠷৽ͷঢ়ଶʁ 4 ൿ఻ͷλϨ 4

    ࢼ͞ΕΔهԱྗ 2017/1/27 Fukuoka.NET (Fukuten) #5 9
  10. ߏ੒؅ཧπʔϧ͋Γ 4 खॱΛίʔυͰهड़ 4 ίʔυΛ࣮ߦͯࣗ͠ಈͰઃఆ 4 ίʔυ͕࠷৽ͷঢ়ଶ 4 όʔδϣϯ؅ཧͯ͠ɺҎલͷঢ়ଶʹ໭͢ͷ΋؆୯ 4

    Կ౓࣮ߦͯ͠΋ಉ͡ঢ়ଶʢႈ౳ੑʣ 2017/1/27 Fukuoka.NET (Fukuten) #5 10
  11. AnsibleΠϯετʔϧ $ pip install ansible 2017/1/27 Fukuoka.NET (Fukuten) #5 11

  12. Ansibleͷཁૉ 4 inventory 4 module 4 playbook 2017/1/27 Fukuoka.NET (Fukuten)

    #5 12
  13. inventory ࡞ۀର৅ͱͳΔϗετΛهड़͢ΔϑΝΠϧ [web] 192.168.0.10 [db] 192.168.0.20 2017/1/27 Fukuoka.NET (Fukuten) #5

    13
  14. module Πϯετʔϧ΍αʔϏεىಈͳͲίϚϯυͷ෦෼ 4 yum 4 service $ ansible -i hosts

    web -m ping 192.168.0.10 | success >> { "changed": false, "ping": "pong" } 2017/1/27 Fukuoka.NET (Fukuten) #5 14
  15. playbook ϞδϡʔϧΛ࣮૷࣮ͯ͠ߦ͢Δ෦෼ - hosts: web sudo: yes tasks: - name:

    be sure httpd is installed yum: name=httpd state=installed - name: be sure httpd is running and enabled service: name=httpd state=running enabled=yes 2017/1/27 Fukuoka.NET (Fukuten) #5 15
  16. playbook࣮ߦ $ ansible-playbook -i hosts simple.yml PLAY [web] ************************************************************ GATHERING

    FACTS *************************************************************** ok: [192.168.0.10] TASK: [be sure httpd is installed] ******************************************** changed: [192.168.0.10] TASK: [be sure httpd is running and enabled] ********************************** changed: [192.168.0.10] PLAY RECAP ******************************************************************** 192.168.0.10 : ok=3 changed=2 unreachable=0 failed=0 2017/1/27 Fukuoka.NET (Fukuten) #5 16
  17. MacͰ΍ͬͯΈΔ 2017/1/27 Fukuoka.NET (Fukuten) #5 17

  18. hosts localhost 2017/1/27 Fukuoka.NET (Fukuten) #5 18

  19. playbook - hosts: localhost connection: local gather_facts: no tasks: -

    name: tap homebrew cask homebrew_tap: tap=caskroom/cask state=present - name: install homebrew-cask homebrew: name=brew-cask state=latest - name: install dockertoolbox homebrew_cask: name=dockertoolbox state=present 2017/1/27 Fukuoka.NET (Fukuten) #5 19
  20. playbook࣮ߦ $ ansible-playbook -i hosts localhost.yml -vv PLAY [localhost] **************************************************************

    TASK: [tap homebrew cask] ***************************************************** <localhost> REMOTE_MODULE homebrew_tap tap=caskroom/cask state=present CHECKMODE=True ok: [localhost] => {"changed": false, "msg": "added: 0, unchanged: 1"} TASK: [install homebrew-cask] ************************************************* <localhost> REMOTE_MODULE homebrew name=brew-cask state=latest CHECKMODE=True ok: [localhost] => {"changed": false, "msg": "Package is already upgraded: brew-cask"} TASK: [install dockertoolbox] ************************************************ <localhost> REMOTE_MODULE homebrew_cask name=dockertoolbox state=present CHECKMODE=True changed: [localhost] => {"changed": true, "msg": "Cask would be installed: dockertoolbox"} PLAY RECAP ******************************************************************** localhost : ok=3 changed=1 unreachable=0 failed=0 2017/1/27 Fukuoka.NET (Fukuten) #5 20
  21. WindowsͰ΍ͬͯΈΔ 2017/1/27 Fukuoka.NET (Fukuten) #5 21

  22. ࢒೦ͳ͕Β௚઀AnsibleΛ ಈ͔͢͜ͱ͸ग़དྷ·ͤΜ ! 2017/1/27 Fukuoka.NET (Fukuten) #5 22

  23. ಈ͔͢ʹ͸! 4 Windows্ʹLinuxͷԾ૝ϚγϯΛ༻ҙ͢Δ 4 Cygwinʢαϙʔτ֎ʣ 4 Windows Subsystem for Linux

    2017/1/27 Fukuoka.NET (Fukuten) #5 23
  24. playbook - hosts: windows tasks: - name: Install git win_chocolatey:

    name: git - name: Install SourceTree win_chocolatey: name: sourcetree - name: Install Notepad++ win_chocolatey: name: notepadplusplus.install 2017/1/27 Fukuoka.NET (Fukuten) #5 24
  25. ଞʹ΋ 4 VagrantϓϩϏδϣχϯά 4 DockerΠϝʔδϏϧυ 4 ֤छΫϥ΢υͷૢ࡞ʢAzure/AWS/OpenStackͳͲʣ ͳͲͳͲ 2017/1/27 Fukuoka.NET

    (Fukuten) #5 25
  26. Ansible࢖͍͍ͨʗڵຯ͕͋Δʁ 4 ͸͍ 4 ͍͍͑ 2017/1/27 Fukuoka.NET (Fukuten) #5 26

  27. 2/16ൃച✨ http://amzn.to/2jwgzVb 2017/1/27 Fukuoka.NET (Fukuten) #5 27

  28. ߪೖ͢Δʁ 4 ͸͍ 4 ͍͑͢ http://amzn.to/2jwgzVb 2017/1/27 Fukuoka.NET (Fukuten) #5

    28