Nws tsis pub leejtwg paub tias nrog lub neej ntawd nqis Ansible tsis tuaj yeem ua nws txoj haujlwm sai heev. Nyob rau hauv tsab xov xwm kuv yuav taw qhia ob peb lub laj thawj rau qhov no thiab muab qhov muaj txiaj ntsig yam tsawg kawg nkaus ntawm kev teeb tsa uas, muaj peev xwm ua tau, yuav ua rau kom nrawm ntawm koj qhov project.
Ntawm no thiab hauv qab no peb tham txog Ansible 2.9.x, uas tau teeb tsa hauv qhov tshiab tsim virtualenv hauv koj txoj kev nyiam.
Tom qab kev teeb tsa, tsim cov ntaub ntawv "ansible.cfg" ib sab ntawm koj phau ntawv ua si - qhov chaw no yuav tso cai rau koj hloov cov chaw no nrog rau qhov project, ntxiv rau lawv yuav thauj khoom tau zoo heev.
Cov kav dej
Qee tus yuav tau hnov ββββtxog qhov yuav tsum tau siv cov raj xa dej, uas yog, tsis luam cov qauv rau lub hom phiaj cov ntaub ntawv kaw lus, tab sis hloov cov zip archive qhwv hauv Base64 ncaj qha mus rau stdin ntawm tus neeg txhais lus Python, tab sis lwm tus yuav tsis, tab sis qhov tseeb. tseem muaj qhov tseeb:
pipelining = True
Sau qhov tseeb
Koj puas paub tias nrog kev teeb tsa ua ntej, Ansible rau txhua qhov kev ua si pib sau qhov tseeb rau txhua tus tswv uas koom nrog nws? Feem ntau, yog tias koj tsis paub, tam sim no koj paub. Txhawm rau tiv thaiv qhov no los ntawm qhov tshwm sim, koj yuav tsum ua kom ob qho kev thov kom meej meej rau kev sau cov lus tseeb (qhia meej) lossis hom ntse. Hauv nws, qhov tseeb yuav raug sau los ntawm cov tswv uas tsis tau ntsib hauv kev ua yeeb yam dhau los.
UPD. Thaum luam tawm, koj yuav tau xaiv ib qho ntawm cov chaw no.
gathering = smart|explicit
Reusing ssh kev sib txuas
Yog tias koj tau khiav Ansible hauv hom kev debugging (qhov "v" kev xaiv, rov ua dua ib mus rau cuaj zaug), koj tuaj yeem pom tias kev sib txuas ssh tas li ua thiab tawg. Yog li, muaj ob peb subtleties ntawm no thiab.
Koj tuaj yeem zam cov kauj ruam ntawm kev rov tsim qhov kev sib txuas ssh ntawm ob theem ib zaug: ob qho tib si ncaj qha hauv ssh tus neeg siv khoom, thiab thaum hloov cov ntaub ntawv mus rau tus tswv tswj hwm los ntawm tus thawj tswj hwm.
Txhawm rau rov siv qhov qhib ssh txuas, tsuas yog hla cov yuam sij tsim nyog rau tus neeg siv ssh. Tom qab ntawd nws yuav pib ua cov hauv qab no: thaum tsim kev sib txuas ssh thawj zaug, nws tseem yuav tsim kom muaj lub qhov (socket) tswj hwm, tom qab kev teeb tsa tom ntej, nws yuav kuaj xyuas qhov muaj nyob ntawm lub qhov (socket), thiab yog tias ua tiav, rov qab siv lub qhov (socket). ssh kev twb kev txuas uas twb muaj lawm. Thiab txhawm rau ua kom tag nrho qhov no ua rau muaj kev nkag siab, cia peb teem sijhawm rau kev tswj xyuas kev sib txuas thaum tsis ua haujlwm. Koj tuaj yeem nyeem ntxiv hauv
ssh_args = "-o ControlMaster=auto -o ControlPersist=15m"
Txhawm rau rov siv dua qhov kev sib txuas ssh uas twb tau qhib lawm thaum hloov cov ntaub ntawv mus rau tus tswv tswj hwm, tsuas yog qhia lwm qhov tsis paub qhov chaw ssh_tranfer_method. Cov ntaub ntawv hais txog qhov no yog heev
transfer_method = piped
Los ntawm txoj kev, hauv "tsim" ceg qhov teeb tsa no kuj muaj
Txhob ntshai riam, ntshai rab diav rawg
Lwm qhov chaw muaj txiaj ntsig yog rab rawg. Nws txiav txim siab tus naj npawb ntawm cov neeg ua haujlwm cov txheej txheem uas yuav sib txuas rau cov tswv thiab ua haujlwm. Vim lub peculiarities ntawm Python ua ib hom lus, cov txheej txheem yog siv, tsis threads, vim hais tias Ansible tseem txhawb nqa Python 2.7 - tsis muaj asyncio rau koj, tsis muaj qhov taw tes rau kev qhia asynchronous cwj pwm ntawm no! Los ntawm lub neej ntawd Ansible khiav
forks = 20
Kuv tsuas yog ceeb toom koj tam sim ntawd tias tej zaum yuav muaj qee qhov teeb meem ntawm no ntsig txog qhov muaj peev xwm nco tau ntawm lub tshuab tswj. Hauv lwm lo lus, koj tuaj yeem, ntawm chav kawm, teem forks = 100500, tab sis leej twg hais tias nws yuav ua haujlwm?
Muab tag nrho ua ke
Yog li ntawd, rau ansible.cfg (ini hom), qhov tsim nyog qhov chaw yuav zoo li no:
[defaults]
gathering = smart|explicit
forks = 20
[ssh_connection]
pipelining = True
ssh_args = -o ControlMaster=auto -o ControlPersist=15m
transfer_method = piped
Thiab yog tias koj xav zais txhua yam hauv ib txwm YaML-cov lus nug ntawm tus neeg noj qab haus huv, ces nws tuaj yeem zoo li qhov no:
---
all:
vars:
ansible_ssh_pipelining: true
ansible_ssh_transfer_method: piped
ansible_ssh_args: -o ControlMaster=auto -o ControlPersist=15m
Hmoov tsis zoo, qhov no yuav tsis ua haujlwm nrog cov chaw "sib sau ua ke = ntse / meej" thiab "forks = 20": lawv qhov sib npaug YaML tsis muaj nyob. Los yog peb muab lawv tso rau hauv ansible.cfg, lossis peb dhau lawv los ntawm ib puag ncig hloov pauv ANSIBLE_GATHERING thiab ANSIBLE_FORKS.
Hais txog Mitogen
- Qhov no nyob qhov twg txog Mitogen? - koj muaj cai nug, nyob zoo tus nyeem ntawv. Tsis nyob qhov twg hauv kab lus no. Tab sis yog tias koj npaj txhij nyeem nws cov cai tiag tiag thiab paub seb vim li cas koj phau ntawv ua si poob nrog Mitogen, tab sis ua haujlwm zoo nrog vanilla Ansible, lossis vim li cas tib phau ntawv ua si tau ua haujlwm zoo ua ntej, tab sis tom qab hloov tshiab pib ua yam txawv txawv - zoo, Mitogen tuaj yeem yog koj lub cuab yeej. Siv nws, nkag siab nws, sau cov ntawv - Kuv yuav nyeem nws nrog kev txaus siab.
Vim li cas kuv thiaj tsis siv Mitogen? Vim hais tias gladiolus nws ua hauj lwm tsuas yog ntev li ntev raws li cov dej num yog tiag tiag yooj yim thiab txhua yam yog zoo. Txawm li cas los xij, yog tias koj tig me ntsis mus rau sab laug lossis sab xis - qhov ntawd yog nws, peb tau los txog: hauv kev teb, ib qho kev zam ntawm qhov tsis paub meej ya ntawm koj, thiab ua kom tiav daim duab, txhua yam uas ploj lawm yog cov kab lus "ua tsaug rau txhua tus. , txhua tus muaj kev ywj pheej. " Feem ntau, kuv tsuas yog tsis xav nkim sij hawm nrhiav cov laj thawj rau "kawg hauv av" tom ntej.
Qee qhov kev teeb tsa no tau pom thaum lub sijhawm nyeem ntawv
Tsuas yog cov neeg siv sau npe tuaj yeem koom nrog hauv daim ntawv ntsuam xyuas.
Qhov twg ntawm Ansible teeb tsa hauv qab no koj siv los ua kom koj cov phiaj xwm nrawm dua?
-
69,6%pipelining=true32
-
34,8%sib sau ua ke = smart/explicit16
-
52,2%ssh_args = "-o ControlMaster=auto -o ControlPersist=..."24
-
17,4%transfer_method = piped8
-
63,0%XXXXXXXXXXXX = 29
-
6,5%Tsis muaj qhov no, tsuas yog Mitogen3
-
8,7%Mitogen + Kuv yuav nco ntsoov qhov twg ntawm cov chaw no4
Voted los ntawm 46 cov neeg siv. 21 tus neeg siv abstained.
Xav paub ntau ntxiv txog Ansible?
-
78,3%yog 54
-
21,7%yog, Kuv tsuas yog xav tau ntau yam nyuaj!15
-
0,0%tsis yog, thiab nws tsis tsim nyog rau tsis muaj dab tsi 0
-
0,0%tsis, nws nyuaj!!!0
69 cov neeg siv pov npav. 7 cov neeg siv txwv tsis pub siv.
Tau qhov twg los: www.hab.com