レガシーなAnsibleを改善していくための方針/How to improve the legacy Ansible
by
tom-256
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
ϨΨγʔͳ"OTJCMFΛ վળ͍ͯͨ͘͠Ίͷํ "OTJCMF/JHIUJO5PLZP
Slide 2
Slide 2 text
XIPBNJ 5XJUUFSUB 8FCۀք όοΫΤϯυΤϯδχΞ GSPNۚࢢ
Slide 3
Slide 3 text
Զͷʢࢲͷʣ"OTJCMFܦݧஊ
Slide 4
Slide 4 text
ϨΨγʔͳ"OTJCMFΛͲ͏͍͔ͬͯͯ͘͠ʁ
Slide 5
Slide 5 text
ͳ͢͜ͱ
Slide 6
Slide 6 text
ɾഎܠ ɾΊ͟͢ͱ͜Ζ ɾϦϑΝΫλ·ͰͷಓͷΓ ɾϦϑΝΫλํ ɾ·ͱΊ
Slide 7
Slide 7 text
എܠ
Slide 8
Slide 8 text
ߏਤ ΦϯϓϨ IPTUT QSETUHEFW $POUSPM.BDIJOF .BOBHFNFOU/PEF TTI
Slide 9
Slide 9 text
ɾαʔόʹखಈͰมߋΛՃ͑ͯ͋Δ ɾ݅Λ͑ΔDIBOHFE ɾ$IFDLNPEF͕GBJMFE͢Δ ɾҎલ͍࣮ͭߦ͞Ε͔ͨఆ͔Ͱͳ͍ ɾTUHͱQSEͰࠩҟ͕͋Δ ɾWFSTJPO य़࣌
Slide 10
Slide 10 text
Ί͟͢ͱ͜Ζ
Slide 11
Slide 11 text
Ί͟͢ͱ͜Ζ QMBZCPPLͱαʔόͷ͕ࠩͳ͍ ႈੑ͕୲อ͞Ε͍ͯΔ ճҎ߱DIBOHFE ɹ͘͠ɺDIBOHFE͕ආ͚ΒΕͳ͍߹ OBNFͳͲͰͦΕ͕Θ͔ΔΑ͏ʹͳ͍ͬͯΔ
Slide 12
Slide 12 text
Ί͟͢ͱ͜Ζ ఆظతʹ࣮ߦ͞Ε͍ͯΔ ࣮ߦཤྺ͕ཧ͞Ε͍ͯΔ
Slide 13
Slide 13 text
ϦϑΝΫλ·ͰͷಓͷΓ
Slide 14
Slide 14 text
Քಇ͍ͯ͠ΔαʔόͱͷࠩΛͳ͘͢ αʔόͷίϐʔΛͱͬͯݕূڥΛ࡞Δ ݱࡏՔಇ͍ͯ͠ΔαʔόͷઃఆΛίʔυʹө͢Δ "OTJCMFΛ࣮ߦݕূ͢Δ ͳ͍͜ͱ͕֬ೝͰ͖ͨΒຊ൪αʔόͰ࣮ߦ͢Δ
Slide 15
Slide 15 text
Քಇ͍ͯ͠ΔαʔόͱͷࠩΛͳ͘͢ ɾҰ୴݅ͷDIBOHFEແࢹ ɾ$IFDLNPEF͕GBJMFE͢ΔͷΛमਖ਼
Slide 16
Slide 16 text
"OTJCMFͷόʔδϣϯΛ্͛Δ ɾ࠷৽ͷ҆ఆ൛ʹ্͛Δ ɾಈ࡞ݕূΛ͢Δ
Slide 17
Slide 17 text
͜ΕͰαʔόͱQMBZCPPL͕ಉ͡ঢ়ଶʹͳͬͨ ࣍ํΛܾΊΔ
Slide 18
Slide 18 text
ϦϑΝΫλํ
Slide 19
Slide 19 text
ͳΔ͘UBTLͷத৮Βͣʹ֎ງΛຒΊ͍ͯ͘
Slide 20
Slide 20 text
·ͣ$*ڥΛ͑Δ ɾ"89ͷಋೖ ɾ$*ͷಋೖ
Slide 21
Slide 21 text
"89ͷಋೖ ɾ࣮ߦཤྺ͕ͬͯͳ͍ ɾ"OTJCMFͷϗετʹ44)ͯ͠࡞ۀͨ͘͠ͳ͍ &$Ͱ"OTJCMF"89ΛཱͯΔ &$ &*1ͷ࠷খݶߏͰ࡞Δ
Slide 22
Slide 22 text
"89ͷಋೖ ެࣜʹ$'OςϯϓϨʔτ͕͋Δ͕ɺࠓճͷέʔεʹରͯ͠ ͳͷͰݟૹΓ https://aws.amazon.com/jp/quickstart/architecture/awx/
Slide 23
Slide 23 text
$POUSPM.BDIJOF "89 .BOBHFNFOU/PEF
Slide 24
Slide 24 text
$*ͷಋೖ $JSDMF$*&OUFSQSJTFͰύΠϓϥΠϯ࡞ (JU)VC"DUJPOT(JU)VC&OUFSQSJTFʹରԠͯ͠ͳ͍ͨΊ ݟૹΓ
Slide 25
Slide 25 text
$*ͷಋೖ Γ͍ͨ͜ͱ ϦϞʔτCSBODIʹQVTI ͍ܰॲཧ ɾ੩తղੳ TZOUBYDIFDL BOTJCMFMJOU ɾςετ Ϣχοτςετ
Slide 26
Slide 26 text
QVTISFNPUFCSBODI BOTJCMFQMBZCPPL ɾTZOUBYDIFDL ɾBOTJCMFMJOU ɾVOJUUFTU
Slide 27
Slide 27 text
$*ͷಋೖ Γ͍ͨ͜ͱ ඇಉظPSεέδϡʔϧ࣮ߦ ॏ͍ॲཧ ɾႈੑͷݕূ ɾςετ ౷߹ςετ
Slide 28
Slide 28 text
$POUSPM.BDIJOF "89 .BOBHFNFOU/PEF 13NBSHF UPXFSDMJ ݕূ༻αʔό ɾEFQMPZ ɾ*OUFHSBUJPOUFTU
Slide 29
Slide 29 text
͜ΕͰݕূαΠΫϧ͕ͬͨ ͔͜͜ΒϦϑΝΫλϦϯά
Slide 30
Slide 30 text
ɾΘΕ͍ͯͳ͍SPMFͷআ ɾϢχοτςετͷಋೖ ɾϩʔΧϧݕূڥΛ࡞Δ ɾσΟϨΫτϦߏΛϕετϓϥΫςΟεʹ ɾSPMF୯ҐͰλά͚ ɾ࣮ߦ࣌ؒͷܭଌ ɾύϑΥʔϚϯενϡʔχϯά ɾႈੑͷमਖ਼
Slide 31
Slide 31 text
ΘΕ͍ͯͳ͍SPMFΛআ ߏਤΛݩʹલऀʹಓʹ֬ೝ
Slide 32
Slide 32 text
ϢχοτςετͷՃ ɾϦϑΝΫλ͍ͯ͘͠ࡍʹ࠷ݶͷηʔϑωοτΛઃ͚͍ͨ 1"5)ɺϓϩηεͷঢ়ଶɺϙʔτͷ֬ೝ "OTJCMFͷUBTLͱͯ͠ϢχοτςετՃ ɹUFTUJOGSBֶशίετͷ͔ΒݟૹΓ
Slide 33
Slide 33 text
ϩʔΧϧݕূڥΛ࡞Δ ɾUBTLʹมߋΛՃ͑ͨͱ͖ɺ ɹຖճϦϞʔταʔόʹରͯ͠ݕূ͢Δͷେม ɾႈੑ֬ೝͷͨΊ࡞ͬͯյͤΔڥ͕΄͍͠
Slide 34
Slide 34 text
ϩʔΧϧݕূڥΛ࡞Δ ݕূ༻%PDLFSڥΛ༻ҙ͢Δ ɾ$*Ͱ༻͢Δ͜ͱߟྀ͠ɺ7BHSBOUͰͳ͘%PDLFSΛબ ɾύεϫʔυ͋ΓͩͱTVEPͰ͖ͳ͍όά͕͋Δ https://github.com/ansible/ansible/issues/31759 ɾطଘΦϯϓϨαʔόͱͷࠩҟߟྀͷඞཁ͋Γ
Slide 35
Slide 35 text
σΟϨΫτϦߏΛϕετϓϥΫςΟεʹ ɾSPMFTσΟϨΫτϦ͕ͳ͍ IPHF@SPMFTDFOUPTʜͷΑ͏ͳσΟϨΫτϦߏ ɾSPMF͕̎ͭͷσΟϨΫτϦʹผΕ͍ͯΔ ɾ૬ରύεࢦఆͩΒ͚
Slide 36
Slide 36 text
σΟϨΫτϦߏΛϕετϓϥΫςΟεʹ https://docs.ansible.com/ansible/latest/user_guide/ playbooks_best_practices.html#alternative-directory-layout HSPVQIPTU͝ͱʹม͕ҟͳ͍ͬͯͨͷͰɺ"MUFSOBUJWF %JSFDUPSZ-BZPVUΛ༻
Slide 37
Slide 37 text
σΟϨΫτϦߏΛϕετϓϥΫςΟεʹ SPMFͷ૬ରύεࢦఆ͕ͳ͘ͳͬͨ QMBZCPPL࣮ߦ࣌ͷίϚϯυ͘ͳͬͨ QMBZCPPL͕ڥ͝ͱʹผΕ͓ͯΓཧ͕େม͕ͩ·ͱΊΔͷ ϘϦϡʔϜ͕େ͖͍ͷͰޙճ͠ʜ
Slide 38
Slide 38 text
SPMF୯ҐͰλά͚ ్தͰGBJMFEͨ͠ͱ͖ʹGBJMFEͨ͠SPMF͔Β࣮ࢪ͍ͨ͠ SPMF୯ҐͰλάΛ͚ͭΔ UBHTIPHF BOTJCMFQMBZCPPLTJUFZNMUBHTIPHF
Slide 39
Slide 39 text
࣮ߦ࣌ؒͷܭଌ ႈੑΛ͢ࡍʹɺ͕͔͔͍࣌ؒͬͯΔͷ͔Β͍ͨ͠ $BMMCBDL1MVHJOTͷQSPpMF@UBTLTΛ͏ ansible.cfg [defaults] callback_whitelist = profile_tasks
Slide 40
Slide 40 text
ύϑΥʔϚϯενϡʔχϯά ެࣜ#MPHΛࢀরͯ͠ઃఆ͢Δ IUUQTXXXBOTJCMFDPNCMPHBOTJCMFQFSGPSNBODF UVOJOHBOTJCMFDGH ansible.cfg [defaults] pipelining = True ssh_args = -o ControlMaster=auto -o ControlPersist=300s
Slide 41
Slide 41 text
ႈੑͷमਖ਼ ࣌ؒͷ͔͔Δͷ͔Βमਖ਼͍ͯ͘͠ ຖճιʔεͷ%-ͱίϯύΠϧΛ͍ͯ͠ΔUBTLͳͲ ɾTIFMM DPNNBOENPEVMFΛସͰ͖ͳ͍͔ݕ౼͢Δ ɾXIFOTUBUFNFOUΛ༻͢Δ
Slide 42
Slide 42 text
·ͱΊ
Slide 43
Slide 43 text
ϨΨγʔͳ"OTJCMFͱૺ۰ͨ͠ͱ͖ ɾ$*ڥΛͭͬͯ͘ΛݻΊΑ͏ ɾςετΛॻ͍ͯ֎ງΛຒΊΑ͏ ɾஈ֊తʹվળ͠Α͏ ɾܭଌɾվળαΠΫϧΛճͦ͏ ɾͳΔ͘#FTU1SBDUJDFTʹد͍ͤͯ͜͏ ɾϓϩμΫτͷϑΣʔζΛݟࣺͯͯΔํੑߟ͑Α͏
Slide 44
Slide 44 text
͓ΘΓ