diff --git a/group_vars/all/secrets.yml b/group_vars/all/secrets.yml index fe938a3..c2f9dac 100644 --- a/group_vars/all/secrets.yml +++ b/group_vars/all/secrets.yml @@ -1,130 +1,144 @@ $ANSIBLE_VAULT;1.1;AES256 -61323133323862626633633435646431343564633238646365393335366237613031656239333865 -3866376365386635616332303537633736643530376631620a646135643565343163316232393437 -61643038326566303362343163633965343164613332396436656663356433336264393133326632 -6664376531353534660a313532633464313638623734366364663963613363363933646337396231 -65383065616162353465633132363833393963396463663465383333646336613765663331336163 -37656364396362663066373562666538383436616330316164653434623038306238363861646233 -32666433643663613463303461666332353765326138393966316462633166356666326365346230 -64663334613032623734373661383066623931663533306139333930396635326230353233343737 -30383763323566656561333435613362363436636136313264373063316531366531633733373939 -36396262393030343939613431653635333738306137616130666234616363313665393132346661 -34366463343034653934383532346530376365316164326665643535333639333965376439626230 -38343133336331386266643034623238323461353136323463383931323165366331666133363438 -64353336653832393664303561303137623830393432653661363633353438646339303930343333 -36313935386262353862336363363034363738636234626333303031316338633761623835363662 -33623465336236303539393039363431383937363062666262303737393663633133306135383936 -36316432396161653037363535653061376561356436333533616339656661313238613964636362 -66363162656262333033306262396132383331623032326631383138346361376132303263626138 -32643964336332363133316264336365396239353533356666393563313733373939613463373837 -61643966666337306266313131393866636532343561336464366239393834306138373436366337 -63383030346163626536363433623965333166393562666430623736643635633038663563343633 -30313438623036346137623262386636643232366533346239623631326631613662333932663936 -31363136363035313238336239303561386239666162333365333864643439376566343062623839 -61623163333362666339326337326333373134323836613263343437316439343963663537313832 -32376534663166313939393633313936663438333063396239633666326338346239316662646635 -65306631396664613765373733636435373135316231363232396662666238376539303564343164 -33663264303738393933643231396539376564633930356165613861616162386535626663336131 -38666633663765366335336462366630613137616463343432643661376163393061666239623531 -35353335313761346432313266356138363231373132343863666165666362663065636163323866 -34396662656137626336623465653864393530336237386134373033336563386461373563666238 -30363537376565313263363631303638643664633937393938353337386630313533353636393434 -38396162386563616166393463666431666265396361663530386462343062643036623064363236 -36336163633436373036306539636132333735643131623462383230313430643861653466393434 -36383033623235653665666265336239306533363737306466666265323439383966346666346434 -61323537366662633064646162333965306161316137333131383362653637343531336262633238 -38336533313435303465333732363230623662653662346136343765633066333031323537653961 -36353262653334393339653037316135386638653231626564363139373637663336373839623337 -63663036356563613430373662336631666163333932343562313261323663333961666638376531 -35376238303966636236356566633130666231663139623137336136633537336433393230383165 -61393234663832646638316639613637623632316666333537393737306366333863306361376161 -65613265656536666539643061386366346230323230623466373233626138643261356465653833 -39616265383865313763316339653830313630303861643031386330386239323235373537303663 -33323937306538333137343036656164353630373430633231323832633630666133303866356437 -37326632326634306630653936323166343361346363653964663866313030646137613564316534 -33393937396237336463316164303733306630636564623837383163666166396630613037343337 -33336634303639616536373436666666396438643863363564343533373261333135646133373539 -63363732393664366566336232663630636239353664666461633138336164363433363534356363 -38633034303832376530336462366164613538303136333161313230643138616130376132376337 -33643939666430323037373631383064316465396462613765376539613535643330353239333233 -32323134353438323834336465373230346666636366363938363339353765313238636464303063 -66663661663765366663336435633630613134613661306334356333663430663337663732393832 -64613066396539333231353131346137373936383939316566316435303466666133313437313463 -61373836643536363835633835313263613533303761623135616365646237336564323334363934 -65666631383331393131393363303066396134303964326561396536633562663737326235383938 -32323763643162393133363134396564643032353562343831313765653961663131393166616265 -62653030363232363938633532393262653834626565336432663437376361613537646432633561 -63343133396665636636616137313239653635616564373130366139656337313433303835623563 -63373361396363373932386432646562316230313730333230323364653230343666633636323535 -63313132303436306263653666396234396566343637383562353435663663356566666264313331 -61623632393131303130666437343633666339393562316564333064376631333662373561643261 -36343634353732316631396163643135396566653030376332346261656638363864623966326538 -32356663636333306163653966323965363863316261313532353362376235353330343532353639 -66353439666161666335373437323137366261336530326537393934633139313234656165306662 -36383233313436633930363133313531636235333939393363653038336331616163636433353232 -32646633373562353138326631333038386464653166313038666335643132653664376139343363 -31383666373539316438363661663536653934323466346662626465326434653763393938666563 -65663262643935626436343933366464343738633762636637323338356132363739313765663137 -62343161373466653166666538306133363039353565353635346366343730643537396466306165 -30626638366662383466303137363834393862643435636537346165353935393431356533396464 -37636161373030346536333635633935656663376661313566643464376438643834666161363635 -64656137356335623533353738396137356361396130353966646337353631346263626635316533 -37363066653063616539323430346439333464663766346566323865353235646534303063613433 -30323633626263613038383638313438363932613333336130656234353830636463336437313963 -34376462323361366463646239626238633639666263663031386263643930653461333437643436 -38663136353230653636343966393131313265383962636365633237646537303866646139636130 -37346133343630653932326465396363386431313235666365653366343638633539663865333462 -66343831363438646438376434353131633666613633346563613732343066646239613730653937 -35663035326465613537353566633066336131633765643732386631643732313663363639373462 -32333564386338313766656331653761326231636239303031373138376563636166373930613332 -37356137343462306133656461363130623937633233356638303530636139643038636163623634 -39363735383661346235626662333337343838626463333761303737363464353730356634656138 -30623961353964343462623464313363663462366265303139366263663637653236613439393032 -65313833666232646465323936343862613638326666383938366139373836316462353435303561 -36626366653130613666656662336637313562396236373966613165303834313866383634666637 -64623865316335623836336537313036383562306438326263356138613730333337626461623536 -32663163386138653966323666346162373834666566663233313665333934653863376336636335 -35363862646565623261336634613637323865336437326662666135343763313030336531386537 -65626266616562323139326461376363343336376364363061316333643139356130306264383335 -31656265353566376464666233336333613036643934376239333331313264306462663730376664 -37653937363833313132303164656336653036633961303031306665316634386534393263656337 -65363666643331393262336462346663396638346430333966343261323535623339376131643061 -35326535663934326563376130306539636262353966363731323135366133623337386235386136 -65633935643061336162353436323061336332363535643564326430626664626438393536653639 -34616635363666326530616361336433313530653436663838636666323231623236626637366530 -30626433346433313762333661306632366162396437316135393137343235383161353637366265 -61633538343030636532633239653335653538323962613165353835363538666265646661393330 -61626135666535313262643137333935333730623734356637313933353638646232633637643139 -63313233333831386335643134393332336261643735336263633864336235303634656530613537 -35323962613165313862643033623930393931353932326133373866363734643137386434636533 -36646361323866353736646135633261666338303230623338396236383130303238626464346565 -38383738316235353837363863366339613862633230636662313437653533363863333763313532 -38636130643165383833313563336435646136656333643238646161363966626436393338396632 -37376563363632376437323430643361656365653366663339613661343263356438623831383233 -33633734623735613530383932653735386639383665303666336631383735653364663761643363 -34303633666461633330623263653831376435323934613266653162633732356662636534376464 -30353361333634326631353464303034636135306662373439313239653530626463623637323939 -63383936343865346561353364636130383438376133643938346139353434373230666639663438 -36626630343736363466303364336535353930303562623437653933613233346564373365356661 -35303866623764663634613931643831383862393662373935336233646435643635343937356232 -35343239353465616363383535646664343035306564663463316638653163303237396239613936 -65356466613264626434346262363462653739623630336136306163396333313762333436633136 -37636535386566386530616164616332376536323061613562306534656132393763643132626230 -65633030666262326433346338663030666662333033343034313864666137383137636435613533 -63383365333733366436653735626464613362333162333966366533623961383735316432613965 -38393532383763396134633763633063653762626234333933353263303866636137303766393633 -33386665613935373132363537376632393132623662633362376135333838656431633835333333 -63623933663639376566366131303537666562653730343235386563306336616263336239383037 -61326562303761643562653035616531323130393164333538396432306661663630633038623038 -32326439653131626539376135616463666166356233323836623261356663613836616433303966 -30353562643365646662313366376538646534333839363965313565616532613964366635636530 -32343163643531323034346531313639633431643330306437336363333337396638316633343964 -39343331366364356430616463636662356432386438386239353733306535376536333933376439 -34363931393361633835346236616637376234326239383162633436393863316662633233653333 -33333632643033356337643533633038323937663132666564396330363633333566356130383566 -66643438346630616634323161623562346661353332353534636236386133653538373966396464 -62323631626436633733306131363365623464326139666666636261313137623432353461333963 -37333437313338343933306137393063393861643761636462376462623063376161376566356435 -30613538643764366161636437383036313962346262633532616463313531366665643637613935 -62333239633736333333303566633062333730643666393561363566363562633636353934376533 -3636 +31306164623264616463396230366434306365373135343931323331383866613138316334316538 +3438343537333866353334646637633731643132323163340a613034626335613934396235666163 +36333730376435393436323937323036366137366231626263376165306137613961383933383436 +3166393134323736390a383666623161316133313163383036356264353733643562663362616161 +31393930613562613735643438303561346538386461333435393334376133376539643139376435 +31363737343234353234356430663531643861306463663739626666373336663339613361393531 +38663237366566663135393661386334316661303163613837313837316666343065643430363535 +61333633616532613033383366386461386638363466323333306532363232333030616563616561 +63346633333666373861333737383934336562613134376632303761363838346630333364643437 +31386332353830333036326530656530653339316137396538386639396638643231396237653430 +30303733333337663130333239643161666634613231623066323333373865303730326265646666 +30666430656266343530326133633962613764646335313738333232313334633138366237373339 +61396363343131376237656438343138333031306262383635306564343734663037323634616436 +38306633316262393965336332636466643261666133373166366636306161363839616439343831 +33646262616134626564396237663662343761326366666539626135343365396666666631376363 +32616562336533343733613536373038643862623863616463633537303237363839613830323832 +32323038306266363031656134376636316431663962653731613761363666313437313832363565 +65643339626165663864383035376164323834333762656438656462386234623461663034616330 +35373633626239393966333236613536623230326262633835383635633066393132343964633736 +64353161323630313461323565333535613532663137376461333133633564326665356430303536 +63636135393137346135306339373839336438333334306461366330353264613766366564613933 +66383065343134623564333730656362336662326535643330636533666435643364353665653137 +35346365373735663466373832343431646533663231643461343839643235396239326261303333 +62346463646162646566623838613864303535643834383331346532343134663163653038376463 +30626531646364363763613937386235363136326336386636333337656462303032386239613661 +62656661313538663639393132363862316530396532383538326166626662633765353062396438 +37396666333036343964386139313031393835336362316336626135373561396330383135333238 +65643166656533383138353134633565396435333230306432343834643063303035363435633035 +35636163626130363134383663653834646332666232326236633861346166333266306336353465 +63363263376533303531343164303739663737616433346537653638663334343830323363343731 +38373963666466323664396236326663343334313235346436363933656666613530303231653731 +34323465636135383166333533613431333531626163366137393332643765306461333037616161 +37383737653532626237633331306639343339356238393964353335333637353466393463366235 +31633965303433333631313362626263633334326630653461353666356165333933363735323339 +33333465613962363763653838306630626261613266366237663430353332626661396364396336 +66376564616664363764623566323365313833653931343965613532306362373139323038366336 +62653738303037656639636430383734333634666233363736303065396438306636383364383466 +66303438313536666665633537316432313132356434353864383033343666306162626464626334 +36363036376234663665666664316633383861313365363561383538393061353537633030353265 +66303030306562626565626231663037323939386365393365376537633263343935363136366634 +33613036343439386334333639363637313566623733643437363666333066393262373331666336 +39653662303634343561616162386433653365326530386333366664353237356466333063386332 +32623135336131663236383730636363333038356135633337646464396235373866323739326365 +66313739376538356536396561333033623339306331656561643637316439383363346338636463 +32666161323530643535333366313334323532666435633061333934623462666638383837333537 +37363031303661616366616363633361323031346362393664653039323865656433633262386265 +61383233393033623834353965663837646663633133353936373237356636303037656463323264 +36636161326339313666373134633139326365646265643164623430636138666130663934633037 +63653038373965316535633136663031383230393565396339316538656230646366373435363763 +61383364343566663538323234373633393065633866613338363233373532313232356266333464 +35646239373531373465333564343463616633346633393434363231633438386337663438396233 +64323437346662616431383365636430386537316535303130633539303933303664663764333066 +37306662393463363564373836333533616130646364396532363033626131363836353762616565 +37623537346632633739666138616361636364643262613836646162656564373462386564333736 +66613861646666656632396139316361343333373438366664663639336337366530366561626364 +61646663633666393135613530373064313135613636623462616661353565653931643039626134 +64666537303437653838613463653465643737383962643937343632356565333734373634396465 +37383865313031636164626361346365373530626636343735636261343533636235663863346238 +39353035326464383433633833613739616561336631663537323634623661653965326263633966 +64353232363263323564323464353633343232643133323565653366633035646234666130613364 +37643361373430643064386335636237333839653163623631663230613935613563353433366435 +36303739316663363832316663666263663566373063633632303734333066613135633532346265 +32396466626433383037346465653534643738613130616362396630373131653739373636356163 +39333437393364363130313561303736373038343362636137333537316530363039316261313561 +61343238623731623032346664326639353565386230333565373233333362306665663166666161 +65323436303438663861303735643135336361336332643838393865623539633462396131366536 +65363030376534333263323664353536316239363835343063363662613939656437343733306239 +35663331643463336465313137306631613732623864356233303439343930646430643138643064 +33643963643764393466393963613539363137313634333661356437383231636162396365366239 +31313561373137626434323061343064613862376139303031623735383566343462616265313832 +35623365343037643435343638363836373963383934653434333635346430613763613863636630 +61313533303631333564383530653333326464626536646334323761343131373835323261316466 +64663431376632366437663430316138333238313637666634373132643430306635616331656364 +39666461663830666634363938653638663238343837336466383539656162366332626235303332 +32393738376266323330383932666564333337353866313134326634373263346233646238303639 +62393661636431343663393135656439353137396535663131323264636261393436356234393139 +36623830323435653733353066613461626338626438626533363938666139643037373264393735 +33326363303936346362646532626531343039386133643439613239636232636138636161623861 +37373030656336303430656536396332613763313338653337326334303664356136626336383065 +37326332623231353939623763616464663166336163616235663639353863386238363933616234 +30373737653661626464666233363438343566323530613866346261333262316332303437303239 +61616138303432393566356463643730323765323430303065656532353338636533326438653533 +33613332333664366333663735323332386234376137613837643434646539653964303432393864 +38333332343536313865303331623330393039383136643932373331356436373634663737626239 +34626133363236343931383665333634303763323265613931653865636439353362623264323033 +30633133643933393161306233343734646431326538663164616361626266646565663939366261 +30623932356433303765343730646166653362626463323564656163613131646466323336643938 +64613232666261396232316332386165383465356639663762373138323066643232396266323738 +61633938393131366431613966383133356334383830653264383739346333366564666135326431 +31306230333933656339626461643365316465616334336133666431616461383632383436356534 +39376430616235326337373566383463396131613537643535376230303832333565353737353130 +65383365636362393863373334336366356164346637323231643336393336613636376235333437 +62336562343132623565303130393562383736303439313235323631343539343836623337646331 +65633535373139663231633337626263363936366238633231666533646539343334313964643061 +33623739643262333232653335393561353739323433313466393432353665333339653761393635 +36383238653936383836396436383861353365373033316434353965656635666338626539643638 +36313162376666653933363036666564363563353836613637653266313936333731653563326330 +31626366386535376262626565333034396338326163376237366564336430643765613539613236 +37313036383631663363663064393365313538313663386563613864626365376330356333356562 +37386432393230353666613339343736336236653865353036356536626265636135373431383534 +63346436326131346230326564336436616430636664326231663464616334366461623733353734 +34646633653030366535373961633663353239373162303431303238366133393066663161616361 +62366262626131386163616534383064326466643437366631366464326366306666326637306263 +32663637363562336637333230346432353562323233373065303534666239656263356462393465 +36626436393232646362643731613636643436323261656566396136376538633930383566396139 +66356562613237303533353063616433346231623931656362623733356537663661616361653438 +30383937623565306635663235656239303865643933343231366463636331653337316231383763 +64643332626339386265633965396239383161366133626538346365316130323561656237353164 +33643365353435386632366231343533623964343938336431386462316638333132353231363836 +36666666643335353432353638613663613961343163653039393362396361626162633862363233 +64313865356562643765303739366338313039643738373134326634613532343832366532656136 +34656237376232646565366466336432376264303039333339393538666133313633393761353966 +32636430633137663336353839616431646232636436336661643039643566613835373030626465 +31313630346562313365376539346164313265653934383662663863376434383363323435383364 +32626632333666303232323563613663363063386238303865323935313639623839393331323562 +34666661366139633933366164663532653131666162663632396130333737313663383464316431 +30366133666437363466316536356232353832356136643036663463316338343435316535353762 +31356233633734616134373161316436353938323537663562376230376361653561316139343933 +64346336613764366334666162316533363930623735363461663965646566303530313061623662 +38643964326135363234343762626164353161323962636530656533353032333264333036396265 +39366263643535343731353065336130333430663135323665613638303863343138313033356630 +64363430663537306334636435346335653261643339636436383261346461353034633636373337 +34343534636234306662616564616134636530363362326639346138393430343562386166663539 +65656136373438623436663836646132363530316630393533356539343463616232353938663165 +30306135333130643666616161303530626436626463663931346362303530666665646131656462 +62643037373138313635643939636230663731386565333165333865383936376438323536383666 +64313335653364346664653239633164393133376138333231353032623966393437373064616462 +36336639316463623432653861666261346531623264336535616633646335663837383236343031 +36303237636234356631663538626535356536333336323964313862353432356533633161306439 +61366364643137633839313964383538343763616163346434356633386563323636353138336234 +38393438653637386364613734373837366562356266383238663764656263383737353034343232 +35386166396163323738666137616564666638616532366564366432326532623833313939646665 +64656634336635303235303465396462626565386133623866306532353730323932613361346330 +38376362656466343562636539313264643330353139336139653866383935373930636230393161 +39396662653637636637333965623763343136623632396535623131303764353539393362663165 +64326337663137326432373864643438653836303538653138643534383765653239353633393162 +35653465636437393135303238343664386633396239323437396531656332653534383834356438 +32373463653863333161326266306135356238343737623735383764313366663136363533663936 +64656561646661336261633161633532353766333230306565616638343330643033613366363566 +63396463386266346161376535363339653437306664626134303037656663356432333466393332 +66613365306536333134643763376166646561326330326335363235393437313632326162333136 +35643833376365616337376365343230343437333461356135333338363966666435323831616135 +623538643430323665623033623939656232 diff --git a/group_vars/all/secrets.yml.contents b/group_vars/all/secrets.yml.contents index 8afb93b..45d08ee 100644 --- a/group_vars/all/secrets.yml.contents +++ b/group_vars/all/secrets.yml.contents @@ -47,3 +47,8 @@ mastodon_secrets: otp_secret: xxx vapid_private_key: xxx vapid_public_key: xxx + +mailman_secrets: + postgres_password: xxx + hyperkitty_api_key: xxx + django_secret_key: xxx diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 86472bf..f4593a7 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -81,13 +81,22 @@ drone: domain: "drone.{{ base_domain }}" volume_folder: "{{ volume_root_folder }}/drone" +mail_subnet_base: "192.168.203" + mailu: version: 1.6 domain: "mail.{{ base_domain }}" - dns: 192.168.203.254 - subnet: 192.168.203.0/24 + dns: "{{ mail_subnet_base }}.254" + subnet: "{{ mail_subnet_base }}.0/24" volume_folder: "{{ volume_root_folder }}/mailu" +mailman: + domain: "lists.{{ base_domain }}" + volume_folder: "{{ volume_root_folder }}/mailman" + core_ip: "{{ mail_subnet_base }}.12" + web_ip: "{{ mail_subnet_base }}.13" + database_ip: "{{ mail_subnet_base }}.14" + portainer: domain: "portainer.{{ base_domain }}" volume_folder: "{{ volume_root_folder }}/portainer" diff --git a/roles/docker/files/mailman/mailman-extra.cfg b/roles/docker/files/mailman/mailman-extra.cfg new file mode 100644 index 0000000..99f0a4e --- /dev/null +++ b/roles/docker/files/mailman/mailman-extra.cfg @@ -0,0 +1,10 @@ +[mta] +incoming: mailman.mta.postfix.LMTP +outgoing: mailman.mta.deliver.deliver +# mailman-core hostname or IP from the Postfix server +lmtp_host: localhost +lmtp_port: 8024 +# Postfix server's hostname or IP from mailman-core +smtp_host: smtp +smtp_port: 25 +configuration: /etc/postfix-mailman.cfg \ No newline at end of file diff --git a/roles/docker/files/mailman/postfix.cf b/roles/docker/files/mailman/postfix.cf new file mode 100644 index 0000000..15f709b --- /dev/null +++ b/roles/docker/files/mailman/postfix.cf @@ -0,0 +1,11 @@ +append_at_myorigin=no +append_dot_mydomain=no +recipient_delimiter = + +unknown_local_recipient_reject_code = 550 +owner_request_special = no +virtual_mailbox_maps = regexp:/opt/mailman-core-data/postfix_lmtp \$virtual_alias_maps +transport_maps = regexp:/opt/mailman-core-data/postfix_lmtp +local_recipient_maps = regexp:/opt/mailman-core-data/postfix_lmtp +relay_domains = regexp:/opt/mailman-core-data/postfix_domains +always_add_missing_headers = yes +local_header_rewrite_clients = permit_sasl_authenticated \ No newline at end of file diff --git a/roles/docker/tasks/services/mailman.yml b/roles/docker/tasks/services/mailman.yml new file mode 100644 index 0000000..90abfe7 --- /dev/null +++ b/roles/docker/tasks/services/mailman.yml @@ -0,0 +1,97 @@ +--- + +- name: copy nginx configuration to link static files + template: + src: "templates/mailman/nginx_vhost" + dest: "{{ nginx.volume_folder }}/vhost/lists.data.coop" + mode: "0644" + +- name: run mailman server containers + docker_compose: + project_name: "mailman" + definition: + version: '3' + + services: + + mailman-core: + image: maxking/mailman-core:0.3.11 + volumes: + - "{{ volume_root_folder }}/mailman/core:/opt/mailman" + stop_grace_period: 30s + links: + - mailman-web:mailmain-web + - database:database + depends_on: + - database + environment: + DATABASE_URL: "postgres://mailman:{{ mailman_secrets.postgres_password }}@172.19.199.4/mailmandb" + DATABASE_TYPE: "postgres" + DATABASE_CLASS: "mailman.database.postgresql.PostgreSQLDatabase" + HYPERKITTY_API_KEY: "{{ mailman_secrets.hyperkitty_api_key }}" + HYPERKITTY_URL: http://172.19.199.3:8000/hyperkitty + MTA: "postfix" + SMTP_HOST: "{{ smtp_host }}" + SMTP_PORT: "{{ smtp_port }}" + SMTP_HOST_USER: "noop" + MM_HOSTNAME: "172.19.199.2" + networks: + mailman: + ipv4_address: 172.19.199.2 + postfix: + external_services: + + mailman-web: + image: maxking/mailman-web:0.3.11 + depends_on: + - database + links: + - database:database + volumes: + - "{{ volume_root_folder }}/mailman/web:/opt/mailman-web-data" + environment: + DATABASE_TYPE: "postgres" + DATABASE_URL: "postgres://mailman:{{ mailman_secrets.postgres_password }}@172.19.199.4/mailmandb" + HYPERKITTY_API_KEY: "{{ mailman_secrets.hyperkitty_api_key }}" + DJANGO_ALLOWED_HOSTS: "lists.data.coop" + SERVE_FROM_DOMAIN: "lists.data.coop" + MAILMAN_ADMIN_USER: "valberg" + MAILMAN_ADMIN_EMAIL: "valberg@orn.li" + MAILMAN_REST_URL: "http://172.19.199.2:8001" + SECRET_KEY: "{{ mailman_secrets.django_secret_key }}" + SMTP_HOST: "{{ smtp_host }}" + SMTP_PORT: "{{ smtp_port }}" + VIRTUAL_HOST: "lists.data.coop" + VIRTUAL_PORT: 8000 + LETSENCRYPT_HOST: "lists.data.coop" + LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" + networks: + mailman: + ipv4_address: 172.19.199.3 + postfix: + external_services: + + database: + image: postgres:13 + restart: always + environment: + POSTGRES_DB: mailmandb + POSTGRES_USER: mailman + POSTGRES_PASSWORD: "{{ mailman_secrets.postgres_password }}" + volumes: + - "{{ volume_root_folder }}/mailman/database:/var/lib/postgresql/data" + networks: + mailman: + ipv4_address: 172.19.199.4 + + networks: + mailman: + driver: bridge + ipam: + driver: default + config: + - subnet: 172.19.199.0/24 + postfix: + external: true + external_services: + external: true diff --git a/roles/docker/tasks/services/mailu.yml b/roles/docker/tasks/services/mailu.yml index e53d92c..0cca640 100644 --- a/roles/docker/tasks/services/mailu.yml +++ b/roles/docker/tasks/services/mailu.yml @@ -1,6 +1,6 @@ --- -- name: create mailu volume folders +- name: "[Mailu] create mailu volume folders" file: name: "{{ mailu.volume_folder }}/{{ volume }}" state: directory @@ -17,12 +17,12 @@ loop_control: loop_var: volume -- name: upload mailu.env file +- name: "[Mailu] upload mailu.env file" template: src: mailu.env.j2 dest: "{{ mailu.volume_folder}}/mailu.env" -- name: hard link to Let's Encrypt TLS certificate +- name: "[Mailu] hard link to Let's Encrypt TLS certificate" file: src: "{{ nginx.volume_folder }}/certs/{{ mailu.domain }}/fullchain.pem" dest: "{{ mailu.volume_folder }}/certs/cert.pem" @@ -30,20 +30,40 @@ force: yes -- name: hard link to Let's Encrypt TLS key +- name: "[Mailu] hard link to Let's Encrypt TLS key" file: src: "{{ nginx.volume_folder }}/certs/{{ mailu.domain }}/key.pem" dest: "{{ mailu.volume_folder }}/certs/key.pem" state: hard force: yes -- name: run mail server containers +- name: "[Mailman] copy nginx configuration to link static files" + template: + src: mailman/nginx_vhost.j2 + dest: "{{ nginx.volume_folder }}/vhost/{{ mailman.domain }}" + mode: "0644" + +- name: "[Mailman] copy postfix override" + copy: + src: mailman/postfix.cf + dest: "{{ mailu.volume_folder }}/overrides/postfix.cf" + mode: "0644" + +- name: "[Mailman] copy mailman config" + copy: + src: mailman/mailman-extra.cfg + dest: "{{ mailman.volume_folder }}/core/mailman-extra.cfg" + mode: "0644" + +- name: Start containers docker_compose: project_name: mail_server pull: yes definition: version: '3.6' services: + + ### Mailu containers ### redis: image: redis:alpine restart: always @@ -117,6 +137,7 @@ env_file: "{{ mailu.volume_folder}}/mailu.env" volumes: - "{{ mailu.volume_folder }}/overrides:/overrides" + - "{{ mailman.volume_folder }}/core/var/data:/opt/mailman-core-data/" depends_on: - front - resolver @@ -149,6 +170,73 @@ dns: - "{{ mailu.dns }}" + ### Mailman containers ### + mailman-core: + image: maxking/mailman-core:0.4 + volumes: + - "{{ mailman.volume_folder }}/core:/opt/mailman" + stop_grace_period: 30s + links: + - mailman-web:mailmain-web + - database:database + depends_on: + - database + environment: + DATABASE_URL: "postgres://mailman:{{ mailman_secrets.postgres_password }}@{{ mailman.database_ip }}/mailmandb" + DATABASE_TYPE: "postgres" + DATABASE_CLASS: "mailman.database.postgresql.PostgreSQLDatabase" + HYPERKITTY_API_KEY: "{{ mailman_secrets.hyperkitty_api_key }}" + HYPERKITTY_URL: "http://{{ mailman.web_ip }}:8000/hyperkitty" + MTA: "postfix" + SMTP_HOST: smtp + MM_HOSTNAME: "{{ mailman.core_ip }}" + networks: + default: + ipv4_address: "{{ mailman.core_ip }}" + external_services: + + mailman-web: + image: maxking/mailman-web:0.4 + depends_on: + - database + links: + - database:database + volumes: + - "{{ mailman.volume_folder }}/web:/opt/mailman-web-data" + environment: + DATABASE_TYPE: "postgres" + DATABASE_URL: "postgres://mailman:{{ mailman_secrets.postgres_password }}@{{ mailman.database_ip }}/mailmandb" + HYPERKITTY_API_KEY: "{{ mailman_secrets.hyperkitty_api_key }}" + DJANGO_ALLOWED_HOSTS: "{{ mailman.domain }}" + SERVE_FROM_DOMAIN: "{{ mailman.domain }}" + MAILMAN_ADMIN_USER: "valberg" + MAILMAN_ADMIN_EMAIL: "valberg@orn.li" + MAILMAN_REST_URL: "http://{{ mailman.core_ip }}:8001" + MAILMAN_HOST_IP: "{{ mailman.core_ip }}" + SECRET_KEY: "{{ mailman_secrets.django_secret_key }}" + SMTP_HOST: smtp + VIRTUAL_HOST: "{{ mailman.domain }}" + VIRTUAL_PORT: 8000 + LETSENCRYPT_HOST: "{{ mailman.domain }}" + LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" + networks: + default: + ipv4_address: "{{ mailman.web_ip }}" + external_services: + + mailman-database: + image: postgres:13 + restart: always + environment: + POSTGRES_DB: mailmandb + POSTGRES_USER: mailman + POSTGRES_PASSWORD: "{{ mailman_secrets.postgres_password }}" + volumes: + - "{{ mailman.volume_folder }}/database:/var/lib/postgresql/data" + networks: + default: + ipv4_address: "{{ mailman.database_ip }}" + networks: default: driver: bridge diff --git a/roles/docker/tasks/services/nginx-proxy.yml b/roles/docker/tasks/services/nginx-proxy.yml index 7e8ff41..ec36f0b 100644 --- a/roles/docker/tasks/services/nginx-proxy.yml +++ b/roles/docker/tasks/services/nginx-proxy.yml @@ -29,6 +29,7 @@ - "{{ nginx.volume_folder }}/html:/usr/share/nginx/html" - "{{ nginx.volume_folder }}/dhparam:/etc/nginx/dhparam" - "{{ nginx.volume_folder }}/certs:/etc/nginx/certs:ro" + - "{{ volume_root_folder }}:/docker-volumes/:ro" - /var/run/docker.sock:/tmp/docker.sock:ro - name: nginx letsencrypt container diff --git a/roles/docker/tasks/services/postfix.yml b/roles/docker/tasks/services/postfix.yml index 9fb9ce8..359eb62 100644 --- a/roles/docker/tasks/services/postfix.yml +++ b/roles/docker/tasks/services/postfix.yml @@ -8,6 +8,17 @@ gateway: 172.16.0.1 - name: setup postfix docker container for outgoing mail + vars: + mynetworks: + - 127.0.0.0/8 + - 10.0.0.0/8 + - 172.16.0.0/12 + - 192.168.0.0/16 + - 172.19.199.2 + - 172.19.199.3 + allowed_sender_domains: + - "{{ base_domain }}" + - "lists.data.coop" docker_container: name: postfix image: boky/postfix:v3.5.0 diff --git a/roles/docker/templates/mailman/nginx_vhost.j2 b/roles/docker/templates/mailman/nginx_vhost.j2 new file mode 100644 index 0000000..bb76770 --- /dev/null +++ b/roles/docker/templates/mailman/nginx_vhost.j2 @@ -0,0 +1,3 @@ +location /static/ { + alias {{ volume_root_folder }}/mailman/web/static/; +} \ No newline at end of file