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

MacをAnsibleで
構成管理しちゃったお話

 MacをAnsibleで
構成管理しちゃったお話

adachin0817

July 30, 2019
Tweet

More Decks by adachin0817

Other Decks in Programming

Transcript

  1. 2019/07/30 Ansible Night in Tokyo 2019.07
    MacΛAnsibleͰ

    ߏ੒؅ཧͪ͠Ό͓ͬͨ࿩
    Lancers,Inc

    @adachin0817/SRE

    View full-size slide

  2. 2019/07/30 Ansible Night in Tokyo 2019.07
    ΞδΣϯμ
    ɾࣗݾ঺հ
    ɾݸਓతͳ͓࿩
    ɾansible_MacΛ࡞ͬͨΘ͚
    ɾߏ੒
    ɾ࢖͍ํ
    ɾσϞ
    ɾ·ͱΊ

    View full-size slide

  3. 2019/07/30 Ansible Night in Tokyo 2019.07
    ࣗݾ঺հ

    View full-size slide

  4. 2019/07/30 Ansible Night in Tokyo 2019.07
    ࣗݾ঺հ
    - name: Introduction me
    user:
    name: adachi.ryo(adachin)
    work: SRE
    detail: aws analytical base

    skill: ansible terraform embulk shell PHP go

    blog: blog.adachin.me

    oss: Vuls contributor Evangelist
    twitter:adachin0817
    github:RVIRUS0817

    View full-size slide

  5. 2019/07/30 Ansible Night in Tokyo 2019.07
    ݸਓతͳ͓࿩

    View full-size slide

  6. 2019/07/30 Ansible Night in Tokyo 2019.07

    ݸਓϒϩάΛDigitalOceanʹҠߦ
    https://blog.adachin.me/archives/10635
    γϯΨϙʔϧϦʔδϣϯ
    ʹͳΓ·ͨ͠✌
    ౦ژϦʔδϣϯ͔Β

    View full-size slide

  7. 2019/07/30 Ansible Night in Tokyo 2019.07

    ϥϯαʔζΛࢧ͑Δٕज़

    View full-size slide

  8. 2019/07/30 Ansible Night in Tokyo 2019.07
    ansible_MacΛ࡞ͬͨΘ͚

    View full-size slide

  9. 2019/07/30 Ansible Night in Tokyo 2019.07
    Θ͍ͷλʔϛφϧ؀ڥͱΞϓϦέʔγϣϯΒ
    ɾnvim/dein.vim
    ɾzsh
    ɾtmux/powerline
    ɾpeco/ghq (control + h(history),j(ssh)/repo

    ɾ伴͸Google DriveͳͲͰ؅ཧ

    View full-size slide

  10. 2019/07/30 Ansible Night in Tokyo 2019.07
    օ͞Μ͜Μͳܦݧ͋Γ·ͤΜ͔ʁ
    ɾࠓ·Ͱ͸gistΛ࢖ͬͯ؅ཧ(Θ͔Δ)
    ɾίϐϖͰରԠ(μα͍✌)
    ɾԿΛมߋͨ͠ͷ͔๨ΕͯݸਓͷPCͱ૬ҧ͕ग़Δ(ന໨)

    ɾస৬ͨ͠ͱ͖(ങ͍ସ͑)ʹηοτΞοϓ͕μϧ͍
    ɾ͍ͭ΋ೖΕͯΔΞϓϦέʔγϣϯͳΜ͚ͩͬ
    ɾ؂ࠪͳͲͰTime machine͕࢖͑ͳ͍
    ɾTime machineͰ΋͍͍͕ແବͳ΋ͷ͸ೖΕͨ͘ͳ͍

    View full-size slide

  11. 2019/07/30 Ansible Night in Tokyo 2019.07
    ͦͯ͠AnsibleͰ࡞ͬͯ͠·ͬͨ
    ɾ2017೥
    ɾAnsible 2.8.3
    ɾ׬શϦϙδτϦԽ
    ɾϗʔϜσΟϨΫτϦʹ͋ΔઃఆϑΝΠϧΛ؅ཧ
    ɾChromeͳͲͷΞϓϦέʔγϣϯ΋؅ཧ
    ɾhomebrewͷύοέʔδ΋؅ཧ
    ɾ؆୯ʹΧελϚΠζͰ͖ΔΑ͏ʹ
    https://blog.adachin.me/archives/5040

    https://github.com/RVIRUS0817/ansible_Mac
    ansible_Mac

    View full-size slide

  12. 2019/07/30 Ansible Night in Tokyo 2019.07
    ߏ੒

    View full-size slide

  13. 2019/07/30 Ansible Night in Tokyo 2019.07
    ߏ੒
    ɾroles͸3ͭ
    ɾϩʔΧϧϗετͰ࣮ߦ
    ɾgroup_vars/allʹͯύοέʔδ໊Λ؅ཧ

    View full-size slide

  14. 2019/07/30 Ansible Night in Tokyo 2019.07
    ./scripts/first.sh
    ɾ·ͣ͸HomebrewͱAnsibleΛΠϯετʔϧ

    View full-size slide

  15. 2019/07/30 Ansible Night in Tokyo 2019.07
    roles/homebrew/tasks/main.yml

    View full-size slide

  16. 2019/07/30 Ansible Night in Tokyo 2019.07
    roles/homebrew-cask/tasks/main.yml

    View full-size slide

  17. 2019/07/30 Ansible Night in Tokyo 2019.07
    roles/homedirectory/tasks/main.yml

    View full-size slide

  18. 2019/07/30 Ansible Night in Tokyo 2019.07
    group_vars/all
    group_vars/allΛݟΕ͹Կ͕ೖ͍ͬͯΔ͔Θ͔Δʂ

    View full-size slide

  19. 2019/07/30 Ansible Night in Tokyo 2019.07
    ࢖͍ํ

    View full-size slide

  20. 2019/07/30 Ansible Night in Tokyo 2019.07
    ४උ
    $ Fork!!!!!!!!!!!!!!!!!!!!!!!!!
    $ cd ansible_Mac
    $ ./scripts/first.sh
    1. run first.sh
    2. add role/homedirectory/files
    3. add group_vars/all
    4. dry-run
    $ ansible-playbook -i hosts mac.yml -KD -C
    5. run
    $ ansible-playbook -i hosts mac.yml -KD
    6. reboot Mac →ॳΊ࣮ͯߦ͢Δ৔߹

    View full-size slide

  21. 2019/07/30 Ansible Night in Tokyo 2019.07
    group_vars/all

    View full-size slide

  22. 2019/07/30 Ansible Night in Tokyo 2019.07
    σϞ΍Γ·;

    View full-size slide

  23. 2019/07/30 Ansible Night in Tokyo 2019.07
    ·ͱΊ

    View full-size slide

  24. 2019/07/30 Ansible Night in Tokyo 2019.07
    ·ͱΊ
    ɾγϯϓϧʹ࡞Εͨ

    ɾMacͷઃఆ౳ՄࢹԽͰ͖ͨ
    ɾΤϯδχΞಉ࢜ͰಠࣗίϚϯυ౳ڞ༗Ͱ͖ΔΑ͏ʹ
    ɾ৔ॴʹͱΒΘΕͣgit pullɺansible࣮ߦ͢Δ͚ͩ
    ɾ࣮ߦ͢Δͷʹ͕͔͔࣌ؒͬͯ͠·͏
    ɾͥͻStarΛʂʂʂʂ

    View full-size slide

  25. 2019/07/30 Ansible Night in Tokyo 2019.07
    ͝ਗ਼ௌ

    ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ

    View full-size slide