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

Pyvmomiとansibleのdynamic inventory

Pyvmomiとansibleのdynamic inventory

大阪Pythonユーザの集まり 2014/10
http://osakapy.connpass.com/event/8994/

Kentaro Kawano

October 22, 2014
Tweet

More Decks by Kentaro Kawano

Other Decks in Programming

Transcript

  1. ࣗݾ঺հ • Տ໺݈ଠ࿕(@kawken) • γφδʔϚʔέςΟϯάʢגʣ • ࢓ࣄ o WEBΞϓϦ։ൃ ▪

    SIͷ͓࢓ࣄ ▪ Ruby on Rails Λओʹ࢖ͬͯΔ o ։ൃ؀ڥͷվળ ▪ ϨΨγʔͳ؀ڥΛϞμϯʹ͢ΔΑ͏ͳ׆ಈ ▪ ࣾ಺ͷ։ൃ༻αʔό؅ཧ
  2. Dynamic Inventory ͱ͸ʁ • ΠϯϕϯτϦϑΝΠϧʹɺ࣮ߦݖݶ͕෇༩͞Ε ͍ͯΔͱ࣮ߦ݁ՌΛ࢖༻͢Δ࢓૊Έ खॱ 1. JSONΛग़ྗ͢ΔεΫϦϓτΛ࡞੒ ˍ

    ࣮ߦݖݶ Λ෇༩ 2. ΠϯϕϯτϦϑΝΠϧͱͯ͠εΫϦϓτΛࢦఆ ͢Δ ansible-playbook -i hosts.py site.yml
  3. Dynamic Inventory ͷϧʔϧ • εΫϦϓτ͸pythonҎ֎Ͱ΋OK • --list, --host ͷίϚϯυϥΠϯҾ਺͕౉ͬͯ͘Δ o

    σϑΥϧτ͸ --list o ϗετ͕ࢦఆ͞Ε͍ͯΔͱ͖͸ --host • εΫϦϓτ༻ͷઃఆϑΝΠϧ͸ iniϑΝΠϧ͕ਪ ঑ʁ • ࣮ߦ࣌ʹઃఆ͍ͨ͠஋͸؀ڥม਺Ͱ౉͢Ҏ֎ͳ ͦ͞͏ https://github.com/ansible/ansible/tree/devel/plugins/inventory
  4. pyvmomiͱ͸ʁ • VMware vSphere APIͷPythonόΠϯσΟϯά o VMware vSphere APIͱ͸ ▪

    VMware ESXͳͲͰ؅ཧ͍ͯ͠ΔԾ૝ϗετΛૢ ࡞ • VMwareެࣜ o https://github.com/vmware/pyvmomi • VMOMI o Virtualization Management Object Management Infrastructure • ಡΈํ͸…ʁ
  5. ·ͱΊ • Dynamic Inventory o ؆୯ͳεΫϦϓτ͔Β࢝ΊΒΕΔ o VMWare΍AWS্ʹߏங͞ΕͨɺIP΍End Point͕Θ ͔Βͳ͍Α͏ͳαʔόΛಛఆͯ͠ɺϓϩϏδϣχϯ

    ά͢Δ͜ͱ͕Ͱ͖Δ • pyvmomi o pyvmomi͸VMwareͷૢ࡞͕؆୯ʹͰ͖Δ o αϯϓϧΛݟΔͱԿͱͳ͘Θ͔ΔͷͰɺPython͕Θ ͔Ε͹؆୯
  6. ࢀߟ AnsibleެࣜυΩϡϝϯτ Dynamic Inventory ͷઆ໌ http://docs.ansible.com/intro_dynamic_inventory.html εΫϦϓτͷ࡞Γํ http://docs.ansible.com/developing_inventory.html Dyanmic Inventory

    ͷαϯϓϧ https://github.com/ansible/ansible/tree/devel/plugins/inventory pyvmomi https://github.com/vmware/pyvmomi VMOMI https://github.com/vmware/pyvmomi/wiki/VMOMI VMware vSphere Web Services SDK Documentation https://www.vmware.com/ support/developer/vc-sdk/