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

構成管理ツール Ansible 実践 / ansible-seminar-20160715

構成管理ツール Ansible 実践 / ansible-seminar-20160715

勉強会講演資料 構成管理ツール Ansible 実践
Hands on 用のAnsinle Playbookは以下で公開しています。
https://github.com/uorat/ansible-handson/

Taro Hirose

July 15, 2016
Tweet

More Decks by Taro Hirose

Other Decks in Technology

Transcript

  1. ࣗݾ঺հ ኍ੉ ଠ࿠ @ CyberZ ‣ גࣜձࣾ CyberZ - OPENRECࣄۀ෦

    ‣ Πϯϑϥ & αʔόαΠυ ΤϯδχΞ ‣ ܦྺ ‣ ಠཱܥITίϯαϧςΟϯάϑΝʔϜ R&D ‣ גࣜձࣾCyberZ ΞυςΫϊϩδʔࣄۀ෦ / Πϯϑϥہ ‣ גࣜձࣾCyberZ OPENRECࣄۀ෦ (ݱ৬) ‣ ಘҙྖҬ ‣ ӡ༻؂ࢹɺߏ੒؅ཧ/ࣗಈԽ ‣ Contents ‣ http://uorat.hatenablog.com/
  2. ໨࣍ 1. Ansible ֓ཁ ‣ Ansible ͱ͸ ‣ Ansible ͷಛ௃

    ‣ σϞʢ୅දతͳ࢖͍ํͱߏ੒આ໌ʣ 2. Ansible ೖ໳ ‣ ༻ޠઆ໌ ‣ Playbook ͷॻ͖ํ ‣ σϞʢPlaybookαϯϓϧઆ໌ͱ࣮ߦʣ 3. Ansible ࣮ફ ‣ σΟϨΫτϦߏ੒ / Best Practice ‣ Playbook ࡞੒ͷ ίπ ‣ ฐࣾͰͷࣄྫ
  3. Ansibleͱ͸ “Ansible is Simple IT Automation” SIMPLE AGENTLESS POWERFUL Automate

    in hours - not weeks - with Ansible's human-readable IT automation language. Ansible uses SSH instead of agents. More efficient, more secure and less to manage. App deployment, configuration management and orchestration - all from one system. qt: http://www.ansible.com/home
  4. ߏ੒؅ཧͷ͢ʍΊ (1) - ߏ੒؅ཧ ‣ ಉظ͞Εͳ͍υΩϡϝϯτ ‣ هࡌ಺༰͕ݹ͍ ‣ ίϚϯυ͕ؒҧ͍ͬͯΔ

    ‣ ൿ఻ͷλϨͱԽͨ͠Snapshot ‣ ΫϦʔϯΠϯετʔϧ͞Εͨαʔό ͔Βಉ༷ͷ؀ڥΛߏஙͰ͖ͳ͍ ‣ νϡʔχϯά಺༰͕ෆ໌ ‣ Ṗͷdaemon͕ಈ͍͍ͯΔ ߏ੒؅ཧΛߦ͍ɺαʔόͷʮ͋Δ ΂͖࢟ʯΛ؅ཧ͠Α͏
  5. ߏ੒؅ཧͷ͢ʍΊ (2) - ࣗಈԽ ‣ Ճ଎͢ΔϏδωεεϐʔυ ‣ ܹԽ͢Δάϩʔόϧڝ૪ ‣ Ϋϥ΢υͷ୆಄ʹΑΓɺϦιʔεͷௐ

    ୡʹ͔͔ΔϦʔυλΠϜ͕ܹݮ ‣ Մೳͳ͔͗Γ଎͘ੈʹग़͢ ‣ ෇ՃՁ஋ΛߴΊΔۀ຿ʹूத ‣ ఆৗۀ຿͸௿ίετͰ ‣ αʔό / ϛυϧ΢ΣΞ ηοτΞοϓ ‣ ΞϓϦέʔγϣϯσϓϩΠ ‣ ੬ऑੑରԠ ਓґଘͳ࡞ۀΛࣗಈԽ͠ɺߴ଎ͳ σϦόϦΛ࣮ݱ͠Α͏
  6. ࠶ܝ “Ansible is Simple IT Automation” SIMPLE AGENTLESS POWERFUL Automate

    in hours - not weeks - with Ansible's human-readable IT automation language. Ansible uses SSH instead of agents. More efficient, more secure and less to manage. App deployment, configuration management and orchestration - all from one system. qt: http://www.ansible.com/home
  7. Ansibleͷಛ௃ “Ansible is Simple IT Automation” ‣ ఆٛ͸YAMLʢ㲈ઃఆϑΝΠϧʣ ‣ ϓϩάϥϜͰ͢Βແ͍ͨΊֶशোน͕গͳ͍

    SIMPLE Automate in hours - not weeks - with Ansible's human-readable IT automation language. --- - hosts: webservers tasks: - name: yum install nginx yum: pkg=nginx state=installed
  8. Ansibleͷಛ௃ “Ansible is Simple IT Automation” ‣ agentΠϯετʔϧෆཁ ‣ ӡ༻؅ཧαʔόͰansible*ίϚϯυ͕࢖͑Ε͹OK

    ‣ Python͕ೖ͍ͬͯΕ͹ಋೖՄೳ ‣ ઐ༻ͷserver΍agentͷӡ༻؅ཧෆཁ ‣ ৗற͢Δϓϩηε͸ͳ͠ AGENTLESS Ansible uses SSH instead of agents. More efficient, more secure and less to manage.
  9. Ansibleͷಛ௃ “Ansible is Simple IT Automation” ‣ ߏ੒؅ཧ͚ͩͰͳ͘Orchestrationͱͯ͠΋࢖͑ΔͷͰɺͪΐͬͱ͠ ͨૢ࡞΍ௐࠪͷࢧԉπʔϧʹ΋ͳΔ ‣

    ߴػೳ͕ͩɺεϞʔϧελʔτͰ࢝ΊΔ͜ͱ΋Մೳ POWERFUL App deployment, configuration management and orchestration - all from one system. ॊೈͳ࣮ߦํ๏ ‣ ࢦఆͨ͠λΠϛϯάͰ࣮ߦ ‣ ෳ਺ฒྻ࣮ߦ ‣ ඞཁͳॲཧ͚ͩΛone-linerͰadhocʹ࣮ߦ ‣ Pushܕ͚ͩͰͳ͘Pullܕ΋αϙʔτ (ansible-pull)
  10. Ansibleͷಛ௃ “Ansible is Simple IT Automation” ႈ౳ੑ ‣ هࡌͨ͠DSLͷఆٛͷঢ়ଶʹऩଋͯ͘͠ΕΔ ‣

    ͋Δૢ࡞ΛԿճߦͬͯ΋݁Ռ͸ಉ͡ ‣ มߋ͕ͳ͚Ε͹ॲཧΛεΩοϓ͢Δ ҎԼ͕Πϯετʔϧ͞Ε͍ͯΔ͜ͱ ɾnginx ɾjava ɾzabbix_agentd αʔϏε͕ىಈ͍ͯ͠Δ͜ͱ ɾnginx ɾzabbix_agentd
  11. Chef ͱͷൺֱ ‣ ػೳ໘ͷࠩ͸΄΅ແ͍ɻ ‣ ߏ੒ͱఆٛܗࣜ/ςϯϓϨʔτΤϯδϯʹ͕ࠩ͋Δ Ansible Chef Agent Agent

    ෆཁ ؅ཧର৅΁ͷ Agent Πϯετʔϧඞཁ Pull / Push Pushܕ ʢಛఆͷαʔό͔ΒSSHͰૢ࡞ʣ Pullܕ ʢChef server͔Βߏ੒৘ใΛऔಘ࣮ͯ͠ߦʣ ఆٛܗࣜ YAML Ruby DSL ςϯϓϨʔτ Τϯδϯ Jinja2 eRuby ڞ༗ϦϙδτϦ Ansible Galaxy Chef Supermarket ։ൃݴޠ Python Ruby
  12. Ansibleख࢝Ί 1. Inventory HostΛهࡌ 2. AnsibleίϚϯυΛࢼ͠ଧͪ ✤ `ansible TARGET -m

    'ping'` ✤ `ansible TARGET -m 'setup'` # /etc/ansible/hosts [webservers] ansible-target0x
  13. ओͳίϚϯυ ‣ ansible ‣ Adhoc ʹ࣮ߦ͢Δ ‣ ansible-playbook ‣ ࣄલʹ࡞੒ͨ͠ॲཧ܈

    (Playbook) Λ࣮ߦ͢Δ # ίϚϯυ࣮ߦྫ $ ansible -m 'ping' webservers ansible-test02 | success >> { "changed": false, "ping": "pong" } # dry-run $ ansible-playbook hands-on00.yml --check --diff … PLAY RECAP ******************************************************************** ansible-test02 : ok=2 changed=0 unreachable=0 failed=0 # execute $ ansible-playbook hands-on00.yml … PLAY RECAP ******************************************************************** ansible-test02 : ok=2 changed=0 unreachable=0 failed=0
  14. Inventory File ‣ Ansible Ͱ؅ཧ͢ΔϗετΛ ini ܗࣜͰهड़͢Δ ‣ ϗετͷάϧʔϐϯά͕Մೳ ‣

    εΫϦϓτͷ࣮ߦ݁ՌΛInventoryʹར༻͢Δ͜ͱ΋Մೳ (Dynamic Inventory) ‣ ׆༻γʔϯ ‣ AWS΍OpenstackͷΑ͏ͳΫϥ΢υ؀ڥΛར༻͍ͯ͠Δ ‣ αʔό͕ಈతʹ૿ݮ͢ΔͨΊɺϦιʔεʹ͚ͭͨTag Ͱ؅ཧ͍ͨ͠ # ྫ: example.com αΠτΛAnsibleͰ؅ཧ͢Δ mail.example.com [webservers] foo.example.com bar.example.com [dbservers] one.example.com two.example.com three.example.com
  15. Playbook ࣮ߦ͢Δॲཧͷ಺༰ΛYAMLܗࣜͰهࡌ͢Δ ‣ PlaybookͱInventry File͑͞ἧ͑͹ɺऔΓ׶࣮͑ͣߦͰ͖Δ --- - hosts: webservers tasks:

    - name: ensure apache is at the latest version yum: pkg=httpd state=latest - name: write the apache config file template: src=templates/httpd.j2 dest=/etc/httpd.conf notify: - restart apache - name: ensure apache is running (and enable it at boot) service: name=httpd state=started enabled=yes handlers: - name: restart apache service: name=httpd state=restarted
  16. YAML ‣ ߏ଄Խ͞ΕͨσʔλΛදݱ͢ΔϑΥʔϚοτ ‣ “YAML ain't markup language“ ‣ Ruby,

    Python, Java, PHP͸͡Ί֤छݴޠͰར༻Մೳ ‣ ઃఆϑΝΠϧͰར༻͞ΕΔ͜ͱ͕ଟ͍ ‣ ߏ଄Խ͞ΕͨσʔλΛදݱ͢ΔϑΥʔϚοτ ‣ γʔέϯε (഑ྻܗࣜ): “- “ (ϋΠϑϯ + ۭന) ‣ Ϛοϐϯά (ϋογϡܗࣜ): “: “ (ίϩϯ + ۭന) - name: ensure apache is at the latest version yum: pkg=httpd state=latest - name: write the apache config file template: src=templates/httpd.j2 dest=/etc/httpd.conf notify: - restart apache - name: ensure apache is running (and enable it at boot) service: name=httpd state=started enabled=yes ഑ྻ ϋογϡ ϋογϡ ϋογϡ ഑ྻ
  17. Task (Tasks lists) ۩ମతͳॲཧΛɺ࣮ߦ͢Δॱʹ഑ྻͰهࡌ͢Δ ‣ جຊ͸ name ͱ module ͷηοτΛهࡌ͢Δ

    ‣ ࣮ߦ৚݅΍τϦΨʔ (notify/handler) ΛՃ͑Δ͜ͱ΋Մೳ ‣ ࣮ߦ৚݅: [when, changed_when, ignore_errors, always_runͳͲ] ‣ τϦΨʔ: handlers Ͱهࡌͨ͠ॲཧͷ໊લΛnotifyͰࢦఆ --- - hosts: webservers tasks: - name: ensure apache is at the latest version yum: pkg=httpd state=latest - name: write the apache config file template: src=templates/httpd.j2 dest=/etc/httpd.conf notify: - restart apache - name: ensure apache is running (and enable it at boot) service: name=httpd state=started enabled=yes handlers: - name: restart apache service: name=httpd state=restarted
  18. Module TasksͰࢦఆͨ͠ॲཧΛ࣮ߦ͢Δ൚༻ϥΠϒϥϦ ‣ Modules are “idempotent” (ႈ౳ੑ) ‣ Core ModulesͰඞཁͳ࡞ۀ͸େମΧόʔͰ͖Δ

    --- - hosts: webservers tasks: - name: ensure apache is at the latest version yum: pkg=httpd state=latest - name: write the apache config file template: src=templates/httpd.j2 dest=/etc/httpd.conf notify: - restart apache - name: ensure apache is running (and enable it at boot) service: name=httpd state=started enabled=yes handlers: - name: restart apache service: name=httpd state=restarted
  19. ୅දతͳModule ‣ yum / apt : ύοέʔδ؅ཧ (Πϯετʔϧ, ࡟আͳͲ) ‣

    service : αʔϏεૢ࡞ (ىಈ, ఀࢭ, ࠶ىಈͳͲ) ‣ file : ϑΝΠϧૢ࡞ (࡞੒, ࡟আ, ଐੑมߋͳͲ) ‣ copy : ϑΝΠϧΛίϐʔ ‣ get_url: ࢦఆURL͔ΒϑΝΠϧΛμ΢ϯϩʔυ ‣ template : ϑΝΠϧΛ਽ܗͱͯ͠ϑΝΠϧੜ੒ (ޙड़) ‣ shell : ೚ҙͷshellίϚϯυΛ࣮ߦʢ˞ႈ౳ੑ͸ࣗ෼Ͱ୲อʣ ‣ ۩ମతͳૢ࡞ͷଞɺ“register” Λซ༻ͯ͠৚݅෼ذʹར༻͢Δ౳ͷ࢖͍ํ΋͋Δ ެࣜυΩϡϝϯτʹModuleͷҰཡͱઆ໌͕͋ΔͷͰɺৄ͘͠͸ҎԼΛࢀর͍ͩ͘͞ɻ http://docs.ansible.com/ansible/modules_by_category.html
  20. ڞ௨Խ (Template / Variable) ‣ Template: ‣ ਽ܗͷϑΝΠϧʹม਺Λల։ͯ͠ੜ੒ͨ͠ϑΝΠϧΛ഑෍Ͱ͖Δ ‣ IP΍hostnameɺenvͳͲ؀ڥ΍ϗετຖʹҟͳΔϑΝΠϧΛ഑෍͢Δ࣌ͳͲʹ׆༻

    ‣ ॻࣜ͸ “Jinja2” (Python੡ςϯϓϨʔτΤϯδϯ) ‣ ม਺ͷຒΊࠐΈ͸ 2ॏதׅހ “{{ hogefuga }}“ ‣ ifจ΍forจͳͲͷ੍ޚจ΋ར༻Մೳ # files/etc/motd.j2 ################################################## !!! Production server {{ ansible_hostname }} !!! ################################################## __| __|_ ) _| ( / Amazon Linux AMI ___|\___|___| https://aws.amazon.com/amazon-linux-ami/2015.03-release-notes/
  21. ڞ௨Խ (Template / Variable) ‣ Variable: ‣ ৚݅෼ذ΍TemplateͰར༻͢Δม਺Λఆٛ͠ݺग़Մೳ ‣ ॻࣜ͸YAML

    ‣ playbook, inventry host, varsͳͲ༷ʑͳՕॴͰࢦఆՄೳ ‣ OS૚ͷԼճΓͷ৘ใ͸ansible͕ࣗಈͰऔಘ͠ݺग़Մೳ (Gathering Facts) ‣ ར༻Մೳͳม਺͸ `ansible hostname -m setup` Ͱ֬ೝՄೳ ‣ ChefͰݴ͏ ohai # Variables innodb_buffer_pool_size: 6144M innodb_log_file_size: 2048M max_connections: 1000 … $ ansible ansible-test02 -m 'setup' ansible-test02 | success >> { "ansible_facts": { "ansible_all_ipv4_addresses": [ "172.31.xx.xx" ], "ansible_all_ipv6_addresses": [], "ansible_architecture": "x86_64", "ansible_bios_date": "NA", "ansible_bios_version": "NA", "ansible_cmdline": { "KEYTABLE": "us", "LANG": "ja-JP.UTF-8",
  22. ڞ௨Խ (Include / Role) ‣ Include: ‣ tasks΍handerls౳ΛผϑΝΠϧͱͯ͠੾Γग़͠ɺҰͭͷRoleͱͯ͠·ͱΊ͓ͯ͘͜ͱͰ࠶ར༻ ͠΍͘͢͢Δ ---

    - hosts: webservers tasks: - include: apache.yml - include: deploy.yml site=service_A - include: deploy.yml site=service_B
  23. ڞ௨Խ (Include / Role) ‣ Role: ‣ task, vars, files,

    templates, handlersҰࣜΛڞ௨Խ ‣ playbook͔Β͸ roles ҰൃͰݺͼग़͠Ͱ͖Δ ‣ ෳ਺αʔόʹద༻͢Δɺ൚Խͤ͞ΔͳͲͷ༻్Ͱ׆༻ # playbook --- - hosts: webservers roles: - common - webserver # σΟϨΫτϦߏ੒ hosts webservers.yml roles/ common/ files/ templates/ tasks/ handlers/ vars/ defaults/ meta/ webservers/ …
  24. ɹ Webαʔό setup 1. ӡ༻πʔϧΛΠϯετʔϧ ‣ epel-release, telnet, wget, rsync,

    tree, tcpdump, sysstat, dstat, vim- enhanced, git 2. όφʔΛ഑ஔ ‣ /etc/motd 3. Nginx install ‣ yum install ‣ ࣗಈىಈ༗ޮ 4. Deploy ‣ page upload (ద౰ͳhtml)
  25. ɹ Webαʔό setup 1. ࣮૷ྫ1) 1ͭͷPlaybook ‣ αϯϓϧPlaybook (Github) 2.

    ࣮૷ྫ2) RoleΛ׆༻ ‣ αϯϓϧPlaybook (Github)
  26. BestPractice Best Practices Directory Layout - Ansible Documentation ެࣜυΩϡϝϯτʹ঺հ͞Ε ͍ͯΔσΟϨΫτϦߏ੒ͷϕ

    ετϓϥΫςΟεɻ ͜Εʹ४ͯ͡࡞੒͢Δͱɺ pathΛҙࣝͤͣʹRole΍Vars ΛࢀরͰ͖Δɻ production # Inventory Host͸άϧʔϓ͝ͱʹ࡞੒ staging # ʏ group_vars/ # άϧʔϓ༻ͷม਺ͷ֨ೲ৔ॴ group1 # group2 # host_vars/ # ϗετ༻ͷม਺ͷ֨ೲ৔ॴ hostname1 # hostname2 # library/ # ࣗ࡞Moduleͷ֨ೲ৔ॴ (optional) filter_plugins/ # ࣗ࡞Filter Pluginͷ֨ೲ৔ॴ (optional) site.yml # master Playbook webservers.yml # Playbook dbservers.yml # Playbook roles/ # ϩʔϧ (Role) ͷ֨ೲ৔ॴ common/ # “common” ϩʔϧ tasks/ # Taskͷ֨ೲ৔ॴ main.yml # <-- Task͕΋͠ଟ͘ͳΔ৔߹͸খ͘͞෼͚Δ handlers/ # Handlerͷ֨ೲ৔ॴ main.yml # <-- ʏ templates/ # Templateͷ֨ೲ৔ॴ ntp.conf.j2 # <------- TemplateϑΝΠϧ໊͸ *.j2 files/ # Fileͷ֨ೲ৔ॴ bar.txt # foo.sh # vars/ # Varsͷ֨ೲ৔ॴ main.yml # defaults/ # main.yml # VarsͷσϑΥ஋ (group/host_varsͰ্ॻ͖Մ) meta/ # ϩʔϧͷґଘؔ܎͕͋Ε͹ఆٛ main.yml # webtier/ # “webtier” ϩʔϧ monitoring/ # “monitiring" ϩʔϧ fooapp/ # “fooapp” ϩʔϧ
  27. Playbook ࡞੒/࣮ߦͷίπ 1. shell ϞδϡʔϧΛۃྗ࢖Θͳ͍ ‣ ࣮ݱ͍ͨ͜͠ͱ͸େ఍ModuleԽ͞Ε͍ͯΔ ‣ ࣗ࡞ͨ͠ϩδοΫͷɺႈ౳ੑͷ୲อ͕ࠔ೉ʹͳΔ 2.

    AnsibleͰϏϧυ͠ͳ͍ ‣ Shell ModuleͰϏϧυΛͤͣɺRPMύοέʔδΛ࡞Δํʹ଩Λ੾Δ͜ͱ ‣ ͦͷ্ͰύοέʔδϚωʔδϟʔΛAnsibleͰݺͼग़͢ʢYum, Apt, pip, nvm, …etcʣ 3. ม਺Λ׆༻ͯ͠RoleΛ൚Խ͢Δ ‣ σϑΥϧτ஋: $ROLE/defaults/main.yml ‣ ϗετ/άϧʔϓຖʹՄมͳ஋: group_vars, host_vars ‣ ϗετݻ༗ͷ஋: Gathering Facts 4. Roleͷ൚Խʹͩ͜ΘΓ͗͢ͳ͍ ‣ Multi OSରԠͳͲͩ͜ΘΓա͗ΔͱɺPlaybook͕٫ͬͯಡΈͮΒ͘ͳΔ͜ͱ΋ ‣ ඞཁ࠷খݶͷॲཧʹͱͲΊ͓ͯ͘ 5. όʔδϣϯ؅ཧ͢Δʢgit౳ʣ ‣ ίϛοτϩά͕ͦͷ··ߏ੒มߋͷഎܠͷઆ໌ʹͳΔ ‣ ޙʑӾཡͯ͠Ձ஋ͷ͋ΔʮಡΈ෺ʯͱͯ͠ॻ͘͜ͱ
  28. Playbook ࡞੒/࣮ߦͷίπ 6. ڞ௨ॲཧΛूΊͨRoleΛ༻ҙ͢Δ ‣ roles/common ͳͲ ‣ ӡ༻ʹඞཁͳύοέʔδͷΠϯετʔϧɺ؂ࢹΤʔδΣϯτͷઃఆͳͲΛೖΕ͓ͯ͘ 7.

    ႈ౳ੑΛ׶ࣺ͑ͯͯΔɺׂΓ͖Γ΋ඞཁ ‣ OS update, kernel tuning, ੬ऑੑରԠͳͲɺӡ༻தͷαʔόʹྲྀͨ͘͠ͳ͍ॲཧ ‣ ΫϦʔϯΠϯετʔϧ࣌ʹ࣮ߦ͍ͨ͠ॲཧΛ roles/init ʹ·ͱΊ͓ͯ͘ ‣ Snapshotӡ༻ͩͱɺߦͬͨ࡞ۀ͕ൿ఻ͷλϨԽ͢ΔͷͰɻ ‣ kickstart΍cloud-initΛطʹ࢖͍ͬͯΕ͹ɺͦͪΒʹدͤΔͰ΋ྑ͍ɻ 8. Roleͷ਽ܗΛ༻ҙ͓ͯ͘͠ ‣ Role͸ྔ࢈͢Δ͜ͱʹͳΔ ‣ ຖ౓ಉ͡σΟϨΫτϦΛ༻ҙ͢Δͷ͸खؒ ‣ ӈਤͷΑ͏ͳۭRoleΛ࡞͓ͬͯ͘ ‣ ۭRoleΛίϐʔ͢Ε͹ɺ௚͙ʹRole࡞੒ʹྭΊΔ 9. ࣮ߦલʹඞͣdry-run͢Δ ‣ --check ΦϓγϣϯͰ dry-run ࣮ߦ͞ΕΔ ‣ ࣮ߦର৅ͷϗετͷ࠶֬ೝɺॲཧͷ࠶֬ೝ ‣ --diff ΦϓγϣϯΛ͚ͭΔͱɺϑΝΠϧߋ৽࣌diffදࣔ͞ΕΔͷͰ֬ೝʹศར ‣ ࣮ߦ͢Δ·Ͱ -s (sudoϞʔυ) Ͱansible-playbookίϚϯυ࣮ߦ͠ͳ͍͜ͱ ‣ ͳΔ΂͘ࣄނΛ๷͙Α͏ʹ ‣ root ϢʔβͰ͸ग़དྷΔݶΓansible࣮ߦ͠ͳ͍ $ tree -a roles/__model/ roles/__model/ ᵓᴷᴷ defaults ᴹ ᵋᴷᴷ .gitkeep ᵓᴷᴷ files ᴹ ᵋᴷᴷ .gitkeep ᵓᴷᴷ handlers ᴹ ᵋᴷᴷ .gitkeep ᵓᴷᴷ meta ᴹ ᵋᴷᴷ .gitkeep ᵓᴷᴷ tasks ᴹ ᵋᴷᴷ .gitkeep ᵓᴷᴷ templates ᴹ ᵋᴷᴷ .gitkeep ᵋᴷᴷ vars ᵋᴷᴷ .gitkeep
  29. ฐࣾͷࣄྫ ‣ OS਽ܗ࡞੒ ‣ ڞ௨ॲཧྲྀ͠ࠐΈ ‣ ϛυϧ΢ΣΞΠϯετʔϧ ‣ ઃఆϑΝΠϧ഑෍ ‣

    OSϢʔβ௥Ճ/࡟আ ‣ ੬ऑੑରԠ ‣ ͏Δ͏ඵରԠ ‣ ΞυϗοΫௐࠪ
  30. Hands On 1. SwapfileΛ࡞੒ ✤ 512MBͷswapfileΛ࡞੒ ✤ swaponͰεϫοϓ௥Ճ ✤ boot࣌ʹࣗಈϚ΢ϯτ

    ✤ ※ႈ౳ੑ͸୲อ͢Δ͜ͱ 2. ӡ༻πʔϧΛ௥Ճ ✤ htop, glances ✤ ag (the-silver-searcher) 3. Deploy (from github) ✤ yteraoka/ansible-tutorial ✤ /var/www/ ҎԼʹdeploy ✤ NginxઃఆϑΝΠϧฤूˠrestart
  31. ղ౴ྫ ✤ ղ౴ྫ (P.48) ✤ https://github.com/uorat/ansible- handson/blob/master/hands-on02.sh ✤ ղ౴ྫ (P.49)

    ✤ Playbook ✤ https://github.com/uorat/ansible- handson/blob/master/hands- on03.yml ✤ Role ✤ https://github.com/uorat/ansible- handson/tree/master/roles/hands- on3