PVE and docker standardization
This commit is contained in:
parent
f8ccf6f053
commit
333d245a53
@ -1,39 +0,0 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
31313561353530643630326363363839636465303566643435316132663163343365303430636461
|
||||
3830656432383635326262363564653034626338626465650a363766373965393238326632323136
|
||||
36656536613736666532386636323533646331333437643437353230636139623637363263636562
|
||||
3766663535386232340a356164306633336366623065323632623638356536373364306236613231
|
||||
31366361373763326561343562616462663066303634633466616164333265366539383366343261
|
||||
38626632666564666539376631303835316531313436616533343864316131323564303666633737
|
||||
61343333376235303637653632393636326333383737306439393664343031653434666130626664
|
||||
32363662353566346164386137633033663738393936316662633030313763316236373833366636
|
||||
32333264383161653931376235316235386333323866633531656561646531383036623565313534
|
||||
32343463313639653730623135313661316434613666393931306165333262306635386635326664
|
||||
61346336393131656663653363333563326663336366643639626534346161643864643366626338
|
||||
33643162653731366332333232363433306332633763623631653064643539326561313631656434
|
||||
63313366633834356634386362363334303562656565623539633535636437356366633236613435
|
||||
31633231613663393234373733643737366334356534383430656536343465333965383431313339
|
||||
31646161333766393965316236373431653737376263383865383338343665653031616533323235
|
||||
32646334636661333565623462366463343737636634616134376637373930633361663762663630
|
||||
66393037306631373662626364663834303765626534363033653331626234623661623033626364
|
||||
39333034353762396664386431313263653161306137323836653635343966656133353463363637
|
||||
36666130343665636332393532323265386138613063383066636230363839643336306434346137
|
||||
32616566666632643335613432633636653261383439326136333833623064643061383065346365
|
||||
37626334353432613835386138623166366162316261333234363262336564636639356330376566
|
||||
31656432653564363764383935353130346439663633313661393232626339616263303962363961
|
||||
37383539663139303464326566303066356463346636313834626166613232616664323831366637
|
||||
34616266333933346333316634303262383938613436333630393133393566656530303461313332
|
||||
36303363313561613264346663656636663033653563303436316665336532343037613765656565
|
||||
38363132616666363766366238643639373136626662353137633936333364616262623432386237
|
||||
36636163363935376363366664373835356535373433343036373137646330353635373931656665
|
||||
30366535353435353338383461343036323764393365353230363735656337663135306337633035
|
||||
39356565616338346332633633653433363662383037613533666536666632333639623332316339
|
||||
34376435393435373238336135636431323436366533363239366530663632356436376266633061
|
||||
62306662316230306164343932353137316266643234363335333235653637656239383439363465
|
||||
65613833666264656463623963306233366662353536666233643038343731663238643461373666
|
||||
63346131363035346136366563303236313664636637626664316666623361623162623730663834
|
||||
31383736663438383839653434623766643736326463633166303163306336306331376634333666
|
||||
39653839336637346266323363336265346630613032633734343632643362333139346237396434
|
||||
65613165383135653536393232353033356363373432613831333932623165313432616132323630
|
||||
31353537366230343339303661623837306566316534393739393430636362623361373337313530
|
||||
3461383431616534646339643330653734346434663230626235
|
50
inventory/group_vars/prod-vms.yml
Normal file
50
inventory/group_vars/prod-vms.yml
Normal file
@ -0,0 +1,50 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
33323963616364363264326139613335633966336166636334396131376331303735613337393738
|
||||
6661636134396161303733643839303632616362633131320a316532313165346266313765623138
|
||||
63626661346139336139313564633063633631393532303736626531376162623232343433373937
|
||||
6136356534626632310a316638633835656634313138313035623532616363633937666139646634
|
||||
62343263313936396434303935316632343462643466646661633732316261363638363263333139
|
||||
36393861303339613830376338643066643337336432663730313964633334336237613164363162
|
||||
37353236356437303432643036343739623235343839376531326638343832303936373763306231
|
||||
62656131643931356561353533326331306265653630636138643333313336303534643166653732
|
||||
38373531363562636330323763313230313833326431356334626434313134383134663239633065
|
||||
66393566396266343361393331323131623262643633353233396338393665353736396533643363
|
||||
39376136613935363135636262663830313537613463656262343135656433333065663035333961
|
||||
30303330653538323265383730363562396565386665373033653465663863623164313062356434
|
||||
35376535323663633532343438626132356563303565613137623638393030356538363534653739
|
||||
61396532336638663730653061616431316439393365376330633130393463646532366463373463
|
||||
63363235333734626564343133623962656632363262323333623464303533366465376564323632
|
||||
34623966393231323465396439616666353862323332303961376339303232623161393736356464
|
||||
65636538366262653839353031663536613666613065643039373535613939663962383436393766
|
||||
36346135356266623861623432646364653336303932633164613562366332633462366638663861
|
||||
61353132656339313135316438613236376563303036666532633731393561373635326333333862
|
||||
35306230303732356633663762396265383864616330666165383564326434386537353865663961
|
||||
32393432346438656361313633386563666361383731313965636562326664376635336163336562
|
||||
62393462626634616331623434613735346638313162366436323137323866366534613061343238
|
||||
61613636646237313237633964376562613533636531666661323833323137336665383632663062
|
||||
38363162626337326562353965643032303266623036633133623465633361306639343164613837
|
||||
36356336363761633637616365353934643435343731646539643265393236363161306664346662
|
||||
39653136663430666637396161663830663330383133303263643933666239656466656464343333
|
||||
64623335313430333861633966626164346661643561353037646436633464343130653638346635
|
||||
34626163376638356163303365303236613034333165643536633438363263653337663036336265
|
||||
30353538646664616566313538303835633963386431363232303032336532343866333036336634
|
||||
31666633613265396330393665633165623136343561656265323333373461616635613833353536
|
||||
36326135366239646530616139643162376462386563353635643965346362656437623036396635
|
||||
66373638613031393739373965326261396633626261383664623334313539393839353834626361
|
||||
65393335386637353165613637666663323235386131663662626430643665393237646533643735
|
||||
38303930613830343562373761383435623661663139616563306335656438623239303766366234
|
||||
38646232333534643165666166373734366464383538646238666338653130333035353838373439
|
||||
63313564376437643134316334393965656666363632646665343239386164383265366236636237
|
||||
62363561613666653866313631346261336633303131623361363138386464663566643734383665
|
||||
36393832396333326533346538313632623961656361323838623464343436636639643765306635
|
||||
37636464343136396534646233643766383530383036643637356234313064623939363832626661
|
||||
39343635666239393239646433663364353664653962626166303936366533393138656563663963
|
||||
35653262616362353466306536613936356264353864346136303264646131303831356561636361
|
||||
31663132623366613530323366656339666431613036343761386534386433663266363734396164
|
||||
30613062366666313332366564666637336464366231396665393462343838663661336235373430
|
||||
35323130386134383638393133356363336433363636326461643635353337386162363535333534
|
||||
31356138383730343038303233336635636432666634653135313437393238663764343631306635
|
||||
63666131393539303534643638353863666361353765313439663233313238323937643964363532
|
||||
39613131326631383966653032316237636263353639663962343337303864643661663234653034
|
||||
66396261343663333263613937323135343863373439303335323532666363323331666564366266
|
||||
3761
|
2
inventory/group_vars/pve-nodes.yml
Normal file
2
inventory/group_vars/pve-nodes.yml
Normal file
@ -0,0 +1,2 @@
|
||||
# Either wheel or sudo, usually
|
||||
admin_group: sudo
|
@ -1,75 +1,96 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
38306461396530653165313836363332613036356566383265636266616662306364633762306637
|
||||
3562656663366234303066313734396163663633356230360a383961313938333664653331626538
|
||||
31353065373963653938653966373835363439633533383065386264303566646237356637303438
|
||||
6662306636323630360a323731303661393630363638613865373235323766613765346530353734
|
||||
37363863653266623136346663313937383539613433313930643063396435386362343436386561
|
||||
64373665393763613135663163613834356536346165666263343136313638346266613638326430
|
||||
64376336366634326639633536323032366531653038366663363734666231383635393765383736
|
||||
63346338326463633865376635323434346265656230306262396364623236613039383530663964
|
||||
34396135323863366235323632666138316134393639386166313732643435366564666561666634
|
||||
39656461653933366336346532326565373430616363393436633364316565383339336361623438
|
||||
34623364326434666563393035636234383362356537326562383434646634643265613838303164
|
||||
33666634353334303738306164316462353365376432656438626435666533363635343332356338
|
||||
64396634396233633030383064326233323962613937363935306235626338316664663466383939
|
||||
66663939623838313266346339663966363132396364363832633637336161373766613166666266
|
||||
34663834373339346166643664656266343162613731303530366536623831646462663937656538
|
||||
62623237616337343465626532363639303531343535633738383266366338623166383434326631
|
||||
64373335383966333561666531646431313939356661383431353531616630306262633435396535
|
||||
39353333323437386563663463306664653664393431623836333834613334326531316661386462
|
||||
37366132393132323336653536653037656333333038363033626232323363366661616361636333
|
||||
34623733373633373338343438633464323161353838633039303762346136656666643234626332
|
||||
38616238643730326434363832333634353932636235396332306463353164643835313130303964
|
||||
33316463666135366433326564663934656337656563623439643162303762393339306535633735
|
||||
36636532343435323362386463386163303737343933623839306233306138636362643838346564
|
||||
37383935386638343262336139373135343137636339643333343730313563666634313262623836
|
||||
34616634336235316532333934663732376634643238303465643763633333636466663733333635
|
||||
61306537373162306137636335646663646134656366636635633437356366636134636439633936
|
||||
64363136313732633566613264306432633234623561306562313863633237633265366637346265
|
||||
35393161376332363038306430313037383832373138333431653266346566333766616139316661
|
||||
37346436356433623535376664313937363263363531616363333738366431326361303062383335
|
||||
63633263613964633137613363313630323066353265633636623763643530333764376664613066
|
||||
61666565333035373562323433343362306166386330356430373039633864656136643133633466
|
||||
36386638313238353737333565306132313135326234316134656365303930366164373564363730
|
||||
63656261613231336332663631343863623235376634663332643563343263623038633863323764
|
||||
66353466343434346136333562653665306164633133386431383638346461363838393363633432
|
||||
39656639393531303562323630663464326262623464653631313134643664653361653565666462
|
||||
35313162396463343464336466613362303566646665373033656362343464663262656239333365
|
||||
36633035633462316166393934333238303931616631363933363766636634663437336563313863
|
||||
32353062646263643966633839643931353562383330353461643765646266336634363333343064
|
||||
37653138326163323865626536643762393234343166666362643431663132393236313637396164
|
||||
66326538643838323765623931393266396431393139393766323164383031633062663761633438
|
||||
39373936393964626630383230636165313937393139326236633632386164386361346161393731
|
||||
38323765393562356635626434343437663165373163643765663834636362353532633262303838
|
||||
64396664333739313832323836396161646536626138313362376663626238366161626561666132
|
||||
39343764633762653234633764636239303139313731616639613532323163643534363130376433
|
||||
61343234386532346633623537643461666562653938396262653734323231623064303439316464
|
||||
63376561316562343066313730376631393032343539313832366365376131313862653966376532
|
||||
63653835646538383466656165626136363061633366376164666462383837643931363764323832
|
||||
34313762663836363433666138343033353432326232383037346130633833346563353463333736
|
||||
33623463386365336666353963633963323034633637623363333163346664663437646338356362
|
||||
31363833373463633033386231653035383161613435346463393433336436373332306634323232
|
||||
37663336623735626532363066303162383563643939323335656565633630646239356339333036
|
||||
61303339346431306335323364663764303232643637303666613330373735303365613738653662
|
||||
39663866323237333739623466316131656437643561623837346336373836353966393663343065
|
||||
32343831323132323430653563366261313036616430663339343336376564383766376165626362
|
||||
35656665643161376234303835373566363131343036363033643935313531343439323464623764
|
||||
39636562303938646466346462383537646566363034313261616635386339623233363431626631
|
||||
36656263623963356332353532613738623935363961623763393536356162653639633763656164
|
||||
35316138366164396637316335656332623266316232343439336332653862373535646166393563
|
||||
66306132653333353562626663313466623335623238616234633563326565653432343337393832
|
||||
30616434643264643937623337343333626265336437613364373064333934663338303331653266
|
||||
66323439306333356433323030393361316533306665633639363032366638356663323064303539
|
||||
65356365323966366366613836613131386663616163616464623238613038646530373032653666
|
||||
32643334323936353536636263333866396665386331363332653435323730313763333732346265
|
||||
37623433323939393263666165666231643731343235623063333037626432356362323265366461
|
||||
34323237306537633630363237323363386464366331333832663132313832353534393736363237
|
||||
33666439643136653966386630326566356462373537626161306464633363383831396233356465
|
||||
38623937303137316339326164363431303931633266316331306263313934376363626662346638
|
||||
61383731373064336431643339356465316662376166303732633765303438323333373133643535
|
||||
30626133343863383961663330653230656565626663303936633037643763303234336562396435
|
||||
65666331323739646531306538366232363034626431633765313739376363313664626566346562
|
||||
38653262623131646233346361646632663436366230623066613963653035353835343439643833
|
||||
30356237333034336331363830346566313433613836393663363937353366626166663233633563
|
||||
30666134343239633035616366353061313937336433353466643631346632643263323535356235
|
||||
3434393032383433326532376663653064363639303430643937
|
||||
62366335643230323366613161383861316439656434313330623464306432356461346231336566
|
||||
6435613935306131376665396137323438643866343237320a316637626430353565386436626265
|
||||
61643937323530323336636431373533306366393336383230656634343730353834366435643130
|
||||
3165303635333336620a346339653238636236336138636438626334663537363166626465663931
|
||||
62306561663364633038353166643134643830623463313864343030353264396631383563326537
|
||||
32626261363738366364333536353466333933313663383464363831313438643966623166643562
|
||||
35633832643832363731616164343235363365396436646262336238666663383437343231323634
|
||||
30346164613735333531366638306362646464363238346636383930353636623561333839643464
|
||||
65613665633438353737313538626137323234363666346335386130396264363665333763633966
|
||||
31326137326666393839306361396164353333306636303431623038626466613337633662363130
|
||||
35633564646361336561303135313135353933376635373965633165653032396430363266333964
|
||||
38653033326435336437336339373866373761336533336432336562633965316663663230343138
|
||||
33656135653238363733313565313837386334613339316432613763386536313437323161376264
|
||||
32386333383933653966666530646339326434656634343563316364393561653262343231343039
|
||||
37656266396330383262616661343239333436396333643665646563653037613835666435393432
|
||||
35643730613830643938646664653231383336653238333137653639373966393830323562623064
|
||||
30383433396265633430303266643839643936373631393164386437633733363430363630323235
|
||||
33636538613634333333396135626633336335343663396336353764383262323231373366383163
|
||||
36366634303465323531653138623564343963656335646134343333333732356262623737356138
|
||||
66313034326537373039373962336333616232663164373736366463646165363530306165316330
|
||||
35656533306464646561616166326466633864386630363636323631663766393932643332623736
|
||||
39323334666264663665336330383739356130373661616532373665643766623939316262313066
|
||||
34623561383861653433363161376334383738623937383535646638646462376238333530386435
|
||||
34646238613334363237303035353963323935393464613437633364343061386562373264633862
|
||||
64393439636162633138653332343237663039316565613730336338343638323034383931663831
|
||||
38663666393831363635613138306439356238313735396439363739316439396465656264653663
|
||||
66356263336331393264353432666463353566653736613035303834396639323330623366653838
|
||||
36313566623066656363636166623133383533376637656262323738656234396262363736343564
|
||||
37363964386338333336646462333865653636393138663738653538306435376435626335303466
|
||||
61373532316138386330303564663038633261363632386531323836646335626566616333626366
|
||||
65616366303131653266626164633838366433623839353863316363396362383564396539376537
|
||||
33626236356438346233333463633137323064373234333633316534653339613830333836343039
|
||||
31313836363361613431326464626365303365393464363765633637373362616438386330633838
|
||||
34373238333761646466353233613431346262666330633631353239623635616538316261663137
|
||||
35616636333861323031343365623937363935656236393861346164306662343832323034623034
|
||||
61656535613836646436393634613462346633393630303634663137333139303737636139633961
|
||||
62393230663164306230363036613365666431623662623632313364333666373361303832363534
|
||||
36383134383662323135613334326633323131646339626439393732386536613764393634333462
|
||||
35643966313231323338666435643037623434626163633362663161653635666161653236343634
|
||||
62353039346633336134346662303531326565636332663764333631303833633436373166326338
|
||||
63396466613161316430626235653962336232376263303231313562373938646637316162316438
|
||||
36636366363634393335633365623435366162636131363762666666656530303765343364656233
|
||||
39653961656564333736326335666462623631363739653938333131366139323566356564393136
|
||||
37396463616138643635306237613238356539643032633963616665383939313337376232616664
|
||||
36623262646639636161353564303135653637333166656231653766313532326439383236356234
|
||||
62623132313739346530643261656535386362613935333063636663653333346632636665333330
|
||||
39343335623738656631393666386433343761336566326235343433353235336436663535343964
|
||||
34336334356531353665363165643165346635343164313137303834336364383735666361663037
|
||||
63386562323533663564333232613466343137393531336633653064373833303966613639363530
|
||||
65633765306230663965373863633935316531653834666662346436383664656463346463383839
|
||||
35323166343937643635633039666530366365623038363437313738393062646233356637363366
|
||||
35303330383538333632616132313632313365313531313665633564343937333833393832626362
|
||||
36333862386537303464623336393737643439626264633532633034656666353638386635373561
|
||||
62313534313531613533623032616163663130393638326566396630373030653437633466326231
|
||||
32396631663864393031643233663139306263356266646266363033336466343535383238313238
|
||||
38366238326235666235383264353331383334653964626538386361373430306332613530616435
|
||||
30393163313434613135633066653861346132373130653639613965363861323131666266323663
|
||||
62333662313862313736346533363934303362633862363632363863323566303334326537633966
|
||||
64356138373465613430303636336631363939383463656565326633353036653436643331343037
|
||||
34396364396365383733366638623765313737326335396539343638613932363765353636303465
|
||||
39323337656566393433656437643437353034316665323836376639353961383031336261386534
|
||||
62393431303939633163376463386365613037653565656639393436383432623434623532623065
|
||||
64636233633539363033613339363238343832393435333639323539643830346433366364346161
|
||||
62366430653237313132353531653135306632393631633139616136643631383239336565613735
|
||||
31636532616465633361353232353562663864376561666233353863326534303334333238396638
|
||||
31316332613363363265343836623335616464366631353035343831663436333863333430313133
|
||||
36353035373865346262376534313565653566663139343165393235356132303130353535333434
|
||||
32376532663732616332376136363137613137386465646133626632346461386266336562316563
|
||||
61373836616434333934623563643133376466316431336561396630353537383631663333316266
|
||||
64656234323463643531343365313338336634396239383264373339303163333830396239393830
|
||||
32646334306138316464376662646539633962356532376361396538313630306237393931616339
|
||||
30383765643666313763663865303465306438336433653362303335633565613466346439646435
|
||||
34323464346430303930303736643761636633316262313737656134373165306165393133613534
|
||||
32623263336634353065356335633536373938656532333139386439323137653633363130653333
|
||||
61323338323735396533383366336637313636373937666163373866313636656164356438303964
|
||||
32643638326565616133396130373039376562663961663563356166666630356538646562353632
|
||||
30656638393066656466626435663635643238353435363765623964633831313538636330343866
|
||||
35616331633933653633396565383530383631616366343939663666316532376436323863366630
|
||||
65336463373162623834663962353534633033323532636463326238306231613461366266316562
|
||||
33373564373436666366646566366335616234653636633165303762343230333131316635646363
|
||||
63313563363137316566393839643236393864643762623665623635376563323365383834643836
|
||||
62393036393261346162623135346435623332653163663732313461613137663339373161373235
|
||||
37323235386337303830306633353839393333353461313839383163383361383962323435373364
|
||||
63336638613861646233653536356131366633643464326432656563343636383230373162336435
|
||||
33373533623164303534643165613435636135376339313338356366616461316133663138643339
|
||||
38366330623561383830313762386634326466663134323164333064376635323865323131313464
|
||||
34316237663066323134656239306533333839616239616663646135323133343433313335323336
|
||||
31373434393236383464303736663935663039643365373431336338383339616663393765616131
|
||||
63353730326636393563366261623736623466346661363366343261353363306466313330373234
|
||||
34613134643966346134363139303161306531396234363865363065316161613438653938326464
|
||||
38333838636635323061633637663563633765313735663232303663633231613939346437343766
|
||||
32646332383535356330663838633866643834343466613731373438653136623831656630313463
|
||||
38323734333861623866363433346231616439376237313562636263613464643632326361623738
|
||||
31633930616238393237633062353535303266333566663265306339616661646639306238653062
|
||||
366566633238363235376430633464656237
|
||||
|
7
playbooks/create-users-and-send-keys.yml
Normal file
7
playbooks/create-users-and-send-keys.yml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
- name: Create users
|
||||
hosts: pve-nodes
|
||||
become: yes
|
||||
roles:
|
||||
- role: server/users
|
||||
- role: server/sshkey
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Export kitty terminfo
|
||||
hosts: prod-vms
|
||||
hosts: pve-nodes
|
||||
become: yes
|
||||
vars:
|
||||
ansible_become_allow_unsafe_writes: true
|
||||
|
@ -1,21 +1,19 @@
|
||||
---
|
||||
- name: Provision AlmaLinux 9 VM
|
||||
hosts: prod-vm
|
||||
hosts: prod_vms
|
||||
become: yes
|
||||
roles:
|
||||
- role: server/hostname
|
||||
# - role: server/hostname
|
||||
# - role: server/users
|
||||
# - role: server/sshkey
|
||||
# - role: server/dnf
|
||||
- role: server/network
|
||||
# - role: server/firewall
|
||||
# - role: server/network
|
||||
- role: server/firewall
|
||||
# - role: provision/alma/common
|
||||
# - role: provision/alma/nfs
|
||||
- role: docker/install
|
||||
# - role: docker/install
|
||||
# - role: docker/migrate-data
|
||||
# - role: docker/setup-lvm
|
||||
# - role: server/fstrim
|
||||
# - role: server/kitty
|
||||
# - role: server/reboot
|
||||
# tasks:
|
||||
# - name: whatever
|
||||
# ansible.builtin.debug:
|
||||
# var: "{{ inventory_hostname }}"
|
||||
# - role: server/reboot
|
0
roles/docker/migrate-data/defaults/main.yml
Normal file
0
roles/docker/migrate-data/defaults/main.yml
Normal file
4
roles/docker/migrate-data/tasks/main.yml
Normal file
4
roles/docker/migrate-data/tasks/main.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
- name: Migrate existing Docker data (if any)
|
||||
ansible.builtin.command: rsync -aHAXx /var/lib/docker/ /docker-data
|
||||
when: docker_migrate_data
|
@ -1,3 +1,4 @@
|
||||
---
|
||||
- name: Pull Portainer Agent image
|
||||
become: true
|
||||
community.docker.docker_image:
|
||||
|
0
roles/docker/setup-lvm/defaults/main.yml
Normal file
0
roles/docker/setup-lvm/defaults/main.yml
Normal file
78
roles/docker/setup-lvm/tasks/main.yml
Normal file
78
roles/docker/setup-lvm/tasks/main.yml
Normal file
@ -0,0 +1,78 @@
|
||||
# roles/setup_docker_storage/tasks/main.yml
|
||||
|
||||
- name: Install LVM tools (if not present)
|
||||
ansible.builtin.package:
|
||||
name: lvm2
|
||||
state: present
|
||||
|
||||
- name: Create physical volume
|
||||
community.general.lvg:
|
||||
pvs: "/dev/{{ docker_disk }}"
|
||||
vg: "{{ docker_vg }}"
|
||||
|
||||
- name: Check if Docker LV exists
|
||||
ansible.builtin.command: "lvs --noheadings -o lv_name {{ docker_vg }}"
|
||||
register: lvs_output
|
||||
|
||||
- name: Create logical volume for Docker
|
||||
community.general.lvol:
|
||||
vg: "{{ docker_vg }}"
|
||||
lv: "{{ docker_lv }}"
|
||||
size: "{{ docker_lv_size }}"
|
||||
state: present
|
||||
# when: docker_lv not in lvs_output.stdout
|
||||
# vars:
|
||||
# docker_lv: "{{ docker_lv }}"
|
||||
|
||||
- name: Format logical volume with XFS
|
||||
community.general.filesystem:
|
||||
fstype: xfs
|
||||
dev: "/dev/{{ docker_vg }}/{{ docker_lv }}"
|
||||
opts: "-n ftype=1"
|
||||
|
||||
- name: Create mount point for Docker volume
|
||||
ansible.builtin.file:
|
||||
path: "{{ docker_mountpoint }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Mount Docker LV to VM filesystem
|
||||
ansible.posix.mount:
|
||||
path: "{{ docker_mountpoint }}"
|
||||
src: "/dev/{{ docker_vg }}/{{ docker_lv }}"
|
||||
fstype: xfs
|
||||
opts: defaults
|
||||
state: mounted
|
||||
|
||||
- name: Stop Docker service
|
||||
ansible.builtin.systemd:
|
||||
name: docker
|
||||
state: stopped
|
||||
enabled: true
|
||||
|
||||
- name: Bind mount new Docker data dir to /var/lib/docker
|
||||
ansible.posix.mount:
|
||||
path: /var/lib/docker
|
||||
src: /docker-data
|
||||
fstype: none
|
||||
opts: bind
|
||||
state: mounted
|
||||
|
||||
# - name: Bind mount new Docker data dir to /var/lib/docker
|
||||
# ansible.builtin.file:
|
||||
# path: /var/lib/docker
|
||||
# state: directory
|
||||
# mode: '0755'
|
||||
|
||||
# - name: Add fstab entry for Docker bind mount
|
||||
# ansible.builtin.blockinfile:
|
||||
# path: /etc/fstab
|
||||
# block: |
|
||||
# /mnt/docker-data /var/lib/docker none bind 0 0
|
||||
# marker: "# {mark} ANSIBLE MANAGED BLOCK - DOCKER BIND"
|
||||
|
||||
- name: Start Docker service
|
||||
ansible.builtin.systemd:
|
||||
name: docker
|
||||
state: started
|
||||
enabled: true
|
@ -50,7 +50,6 @@
|
||||
group: root
|
||||
mode: '0644'
|
||||
|
||||
|
||||
- name: Update apt cache
|
||||
apt:
|
||||
update_cache: yes
|
||||
|
0
roles/pve/lvm/defaults/main.yml
Normal file
0
roles/pve/lvm/defaults/main.yml
Normal file
41
roles/pve/lvm/tasks/main.yml
Normal file
41
roles/pve/lvm/tasks/main.yml
Normal file
@ -0,0 +1,41 @@
|
||||
---
|
||||
- name: Install LVM tools (if not present)
|
||||
ansible.builtin.package:
|
||||
name: lvm2
|
||||
state: present
|
||||
|
||||
- name: Check if Docker LV exists
|
||||
ansible.builtin.command: >
|
||||
"lvs --noheadings -o lv_name {{ hostvars[inventory_hostname]['vmid'] }}"
|
||||
|
||||
register: lvs_output
|
||||
|
||||
- name: Create logical volume for Docker
|
||||
community.general.lvol:
|
||||
vg: "{{ docker_vg }}"
|
||||
lv: "{{ docker_lv }}"
|
||||
size: "{{ docker_lv_size }}"
|
||||
state: present
|
||||
# when: docker_lv not in lvs_output.stdout
|
||||
# vars:
|
||||
# docker_lv: "{{ docker_lv }}"
|
||||
|
||||
- name: Format logical volume with XFS
|
||||
community.general.filesystem:
|
||||
fstype: xfs
|
||||
dev: "/dev/{{ docker_vg }}/{{ docker_lv }}"
|
||||
opts: "-n ftype=1"
|
||||
|
||||
- name: Create mount point for Docker volume
|
||||
ansible.builtin.file:
|
||||
path: "{{ docker_mountpoint }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Mount Docker LV to VM filesystem
|
||||
ansible.posix.mount:
|
||||
path: "{{ docker_mountpoint }}"
|
||||
src: "/dev/{{ docker_vg }}/{{ docker_lv }}"
|
||||
fstype: xfs
|
||||
opts: defaults
|
||||
state: mounted
|
@ -15,5 +15,6 @@
|
||||
- bind-utils
|
||||
- nmap
|
||||
- tcpdump
|
||||
- rsync
|
||||
state: latest
|
||||
update_cache: true
|
||||
|
@ -34,3 +34,39 @@
|
||||
|
||||
- name: Reload firewalld to apply changes
|
||||
ansible.builtin.command: firewall-cmd --reload
|
||||
|
||||
- debug:
|
||||
var: hostvars[inventory_hostname]['roles']
|
||||
|
||||
################ SWARM SETUP ################
|
||||
- name: Open Docker Swarm manager port 2377/tcp
|
||||
ansible.builtin.firewalld:
|
||||
zone: core
|
||||
port: 2377/tcp
|
||||
permanent: true
|
||||
state: enabled
|
||||
when: "'swarm' in hostvars[inventory_hostname]['roles']"
|
||||
|
||||
- name: Open Docker Swarm overlay node discovery port 7946/tcp
|
||||
ansible.builtin.firewalld:
|
||||
zone: core
|
||||
port: 7946/tcp
|
||||
permanent: true
|
||||
state: enabled
|
||||
when: "'swarm' in hostvars[inventory_hostname]['roles']"
|
||||
|
||||
- name: Open Docker Swarm overlay node discovery port 7946/udp
|
||||
ansible.builtin.firewalld:
|
||||
zone: core
|
||||
port: 7946/udp
|
||||
permanent: true
|
||||
state: enabled
|
||||
when: "'swarm' in hostvars[inventory_hostname]['roles']"
|
||||
|
||||
- name: Open Docker Swarm overlay network traffic 4789/udp
|
||||
ansible.builtin.firewalld:
|
||||
zone: core
|
||||
port: 4789/udp
|
||||
permanent: true
|
||||
state: enabled
|
||||
when: "'swarm' in hostvars[inventory_hostname]['roles']"
|
||||
|
@ -10,7 +10,7 @@
|
||||
name: xbazzi
|
||||
create_home: true
|
||||
shell: /bin/bash
|
||||
groups: wheel,xbazzi
|
||||
groups: "{{ admin_group }},xbazzi"
|
||||
uid: 1337
|
||||
state: present
|
||||
|
||||
@ -25,10 +25,18 @@
|
||||
# name: ansible
|
||||
# create_home: true
|
||||
# shell: /bin/bash
|
||||
# groups: wheel,ansible
|
||||
# groups: "{{ admin_group }},ansible"
|
||||
# state: present
|
||||
# uid: 1001
|
||||
|
||||
- name: Add ansible to sudoers w/ no password
|
||||
community.general.sudoers:
|
||||
name: ansible-sudoers
|
||||
user: ansible
|
||||
state: present
|
||||
commands: ALL
|
||||
nopassword: true
|
||||
|
||||
- name: Add nfsuser group
|
||||
ansible.builtin.group:
|
||||
name: nfsuser
|
||||
@ -40,6 +48,6 @@
|
||||
name: nfsuser
|
||||
create_home: true
|
||||
shell: /bin/bash
|
||||
groups: wheel
|
||||
groups: "{{ admin_group }}"
|
||||
state: present
|
||||
uid: 3005
|
||||
|
Loading…
x
Reference in New Issue
Block a user