Merge branch 'vulcain_codimd' into 'master'

Role Ansible pour setup de CodiMD

See merge request erdnaxe/ansible-aurore!2
This commit is contained in:
Alexandre IOOSS 2019-02-09 09:32:33 +01:00
commit 5f194f0e30
10 changed files with 232 additions and 91 deletions

6
codimd.yml Normal file
View File

@ -0,0 +1,6 @@
---
# Install CodiMD on CodiMD containers
- hosts: codimd.adm.auro.re
roles:
- debian-backports
- codimd

View File

@ -9,6 +9,10 @@ ldap_nslcd_passwd: "{{ vault_ldap_nslcd_passwd }}"
ldap_replica_password: "{{ vault_ldap_replica_password }}"
ldap_admin_hashed_passwd: "{{ vault_ldap_admin_hashed_passwd }}"
# Databases
postgresql_services_url: 'services-bdd.adm.auro.re'
postgresql_codimd_passwd: "{{ vault_postgresql_codimd_passwd }}"
# Scripts will tell users to go there to manage their account
intranet_url: 'https://re2o.auro.re/'

View File

@ -1,92 +1,97 @@
$ANSIBLE_VAULT;1.1;AES256
38663939373761333231336438636139303761313131663535633064366163363637313337313935
3931353961366634623033363637356562383464396663330a396566666334666666323733316330
32313930323463313164633238393532613566306136626433316439383064363235346331366432
6438363134333563300a303161393932663032373639326464613664636230306363633837336336
61626132386637343961653534363836346332393731343963663362393630383231306237393032
36616561366530653230663731363565376561336431323764653831636538363938663139356334
39653333663639623335616435613634633634363532353764653031326466303164336135636165
35383033646139323037323437383931613439653864336363366338643237653937663731613437
37623065306231386239343639336464633832373037666431666335623635356630373261656133
33326563643030393265653332303637623536316462343333333461353137646636643533333561
37373135356439363132363762316131366538353435613663363238613933306630646363326632
65333133336133613036353131353463383363663661393933666637656562326634356638353037
32336534666239356664316265336164316564383536336164316236643365613535356438616632
62346234333664333630333435386362383539393134306635653533316265616539633136326133
30356264646437613939353962366639343835643436323661336137393637643762363037323033
31346133346266633465336136326338653532303962306537353464653738366537656363613739
33346535643862326332656166383362306661633962333132623237663338323766633962636631
32626330663730633331643562383762666338313034393464313337386664656137666131336333
36306436323866383865323463393664386634663238646437383965633365653938306166633239
33653930333861613335353966613964346165643838643463653062376436303531613665636231
36333637303362373764363937663731376531663862356662326330303035386361376263306131
64386532653239363961393265633666643663653065316530383532643562643134643763663164
66633332663135643432653766616632613061623935313737373939663565393832333734633063
36623531333865616634653737333531316632386239383738616331653162306435623661356631
36353234643264303061623331326135636533636236303030346461633261653333343866626431
61363839393239313430383437353930303631323933363833373030356333663433383562336631
35623362336533646132393361326535343965313938363665333835653032393937353039356137
30356638626539353166323963353431616462636337343930616537623732636263636139383534
36353437643561666437633662643530663461626638336638343263616366323938613635326566
31643764323137396230333262343235326466373261376566626433643537633863613435393335
61626466306332336665393731386335646665653632646536643038636531616238386431623533
65373161623232663634356433336433333765666266383764393839386165373066616434613762
63653637303062393162306565353037636137373138363839333330303933646538363137623731
62373734343536356261383535333662303963633963363036353038633737616435393661373830
31303338633937376564653436636461656365666530333464353262373831303936373634633534
30383839623032613362303962633934353263336635623930346331343534643434323362623831
62666431363736613338303665343363303236653635343262643137343162323165356331356337
66633834613134313062353863353265623239326239346438316531323563663433626231393435
30363735363332633536623136313537386361636663353238633630656661636462376665346235
36346461303131393435663538343465396230663932636330306330633439343836376532346132
33653537396662393431633538356437613933313131633332356333353764383264363563643330
61616666306531366562313762653230353437666532306536366537636431363964393936393630
61346666313438656533656239303262323235316132373663623033636536663435323932393764
35653030343830383737623964636663353661393939353834663463373839653564626565333239
30333562383864386535666330653764663033336135313239383730646162636161303936303436
65316138666161383766333464356663356132653530326435383639393833303865336165623365
31366563656237333063613833376363386431376266633133353063653364643130316639633236
31613137343166353039663564363935346364333363393463383462343937363139343833626662
35613139313332303963663261356530356464626634616230643532663261346530323365366336
63663361366331633134303564313562363866313066626463633939393064653462373763396634
62306133653961383330646334313638636134633033323736373232346631616363313532326463
61386135663162626433323831323332666563306363633636336330373932613737336664653837
30323833383865323430356663386333393830643539663539353930616231383035383935306430
35313564643432303337313136316563353866336133396266633862303264353134393936316130
36313733366535313663356536373564373439353564303530383236333630663633613939633461
38353538303634303066343366333561386537633430613966303039353135643730386439666337
63663735343935313535303537633734653732306532646132333434643536643432373534613535
66643931373964663634396462303063383066383130623837356366636133633563383437643165
64363864333231346233323838626137643535353739313337376462626263313334663963393636
30316132326531393338623739336432346235396432633862666135396130303964326364613166
66323339666632656666666435386535626565656133386565656238653130303838373935336535
38343462396434393230646437616665633937653138366536356236343936306436306164643736
30363262623538386166326334633937396339333038663733356638633635656161653166346262
35393030323236343034636162393964313538313838333261613362336532373834643139623737
63373466343465383630613531623666663530363364636466316437626165356233313431666365
30306535623631643263303266653538663138626234643833666563323266616533376238373264
31643963333738636633623739386234613065626266376163393765393333353035353765343732
30333262363131373866343434663266636236666439663533313162633165623836366561376462
39366662363335313734336533613337643739393566333464363364366430373537353831343362
38346238643832653939333163323339303962623430646536386230386161663738633166396633
31356663613038636536663237623065656337333066383432616266343336663436656531373863
30663737313133623131633061393930376363663461613766343933623634656138343535326163
34663561353938356462366462663634303366653937623665633266306631333063383233613237
66323737643336336637373861326334353838383466323039363466316238613064336666643264
66326332616637636638356330623430353930336133356539336463656562396535616466306465
61666361363235346537643761663535643330373662316230616664626634356463616362353066
34363064616334326231353232646530323766623865323231376563306231636462396239623063
61356239333465313339613535356233393030333966633965613535653839613533343665303532
38333266343334393930333439633930373830653165363864303462646632393563333039623264
30393265616138326236373231336334323739396438613966306430316530326334633338376361
61643633343130353462333463373230646562376339313832626261346439613632343666353437
33316338303131343266666466393061623031356437396135333065376433636235653563333064
35326637373162346330313030663632386238386433623466643562353035343736316164356234
38323738303465386338373239333364636535613764343333656666316263336233393131633064
34313431333835343235306565373862386534633434363930343763373263613732616565326532
31353133343763633337383739666331353966663931313936653162663835326535366539366266
65313331663163336361633633396534336363333531343932336634333538303636336131336231
38373964326337393733663364353731393430313363653462346163663636623331383435663438
62656262336134393036656362376639373431613531396234353564313566663265626534363531
32663465643464396663623436613330393538633630336666366439363637363363626563653131
656566343338323935306163613366383261
66383762636163616264643034383531303636613566636338376132383666376265313463626462
3064613735313732366239383261623033323366333261640a393765613139303936386137326434
36303662373436333737373237383739356432613334613236313930643737356566666434636233
3835626537306664630a653036396335623334393138306266666134666235343030633834343635
31386133383363386161363164333439613939613730646566643239326532333561623539633530
65616534306332343065303263373039626162386564356238663937316131663666393062356335
63373838393934376664303731613264393338303564373332663165616335613835386632623938
38386438313032653663633333313033306533373130393833323030643064663431663866616162
64376530643237613835396462303734366435643339323961396133663530356562313161633734
38636432356465333265363632356530343631323839623066633738663033623034326330356538
30646338663834333265396534336435313664326132623239653731643837336562613764646463
34373436393966616139633634373162623637363130616465663736643762303737663236373034
38653230663638396532383536626463643639656137633762306166636432376662376562376362
61383463636466663130313032316531373234383339336635633261373764356431303835613136
63666437343963393032323630343537373663323237346137656432663966663031346361313762
35336531353037636533613436336330383239356433373636383631333031343332366664373936
37346335353964386461323437306461636466326430366266313634386433313736393261333365
65343334393239656330326637613563613332663366653339363061313132653566316665323730
34323530613432653966613835366135356161353237343637376262376638353764323962313835
31663133323033396261343463613962613862616466616530396462316361373935386361303138
64616335643065383532363431313031336436633064613934616531393463343436633263393734
63316366633539393838376166386665333161613964346237633932663233356338623062326434
36393437306230366433313165636130393234373839326565623361626330396536313734323939
37613966373265616431376664396162653835663039653966643061383539333739306565353235
66303833336433616333306165386164656462333731356137373931363137363138363361313462
36343264663233616634633534383966663436303637346466616332356630356435326262336263
64333262333066626630373238346535343038663539383932636439653836643934393136623133
35646463336131323434653766306364656634613461363465346237303433393163353763303338
32313265356336353066643432346338633438313662383266323064663166343131343339373739
34313863663033383137363737616461376331636137636636643534333438376637323333386534
30396336613930306139643362373061303561393832313135613936363031313162383864663834
38646665323037393934616638313130646561643639356362383865363730356632396336393063
61383135333834653134343036616266663231616661613439373632623232393133383162353537
66363236383835616565616433356634356537643466346434353537346331363237323036373939
39633036356136336436353035613239303435613532393761376166636530643632353963353732
33333934653665383834613062646236333735346265313061383663663334666631643861323765
30653031326433393830636435333436633661636531316362653339613530333032636238616433
61316462356338323966326365623866386530666363386239383635333765393731353132383161
66363839623461386533356565353835303431343634633432376466343961313135376533383737
66336133663039333564323664373461313164333330633034356533343633366162366531353466
34653966653665356361653830373836646162613339323036323062366132383761393064656432
62396334613563636636656166633761653461313361333161663838336437316231316463303037
65653661313366663336353237316464363733626430333336353066323966613231656437313066
61376130333836323230356562333663663364636663383337386661366661663461646466623331
35663732396365653232386664326336363731323234376133623662313534383232363363373238
61376461643739313436623437303462303066386664383133656161663836373337326562326431
33653861616166623762363436343031643434616233323830643964613063353737336632653133
38623736653165383830613565613038303732353638663436336365376137386333363937386433
32333836633062653762326238353032333962656333613138656335626562336266313531633938
30643334663066373564383233613935653937303937643061633566306131353564386465326435
38373832313439353430353133656365383632343262363834313562333836323237613831653664
62663863656364643334376566643962633866646230326465326661303538383633383137633461
31313134633633626338303035613539636534653230623037343931663836376135393561626662
66346230386661386331376239393564336530343034376132613762376166396131356233316236
34643562336131303532333339333439326464373835643936643931653235623764316334343936
62303163346635313439613031316331336631383937643233303066633334363364643263376162
39363964653735313632366136323836616364346330633963396161376533303332326438663439
64653166646563353837313837306638313836386230303230303032393563323437316230383839
63646332373935363939646638663630626230643765646333373665643137373936623262626336
30393034383639343432343164633133343165653365313666643163616639323530653430656139
31393231653931666233613739363339626532393631643535386264666436386563646265333139
37396239323538653161353430643631343935626461346466636235623664303662613836383334
65363865323837333133386432313439393430353362393433633262653632643262393938643464
35343065653835386636393961663338336539346363383739336638353365666165316433633463
64383561376630343535303532626465323762353063303265353332633766616439306136623166
34313337373862643362316138623433316561346566306131653838393238343039383938326531
65363861363737653263316232323135313038393233383137366564333265363138343761316565
38666262373263666163323164643564363435623363346262323365363831666330663663636363
36313861306665656538616439333335346238613364396239383065663339396333616436656634
37343866333461613437303562356335336465366237333362323863656632326131306164353239
35646431383035646664336135373430383438386166663530623537393463373337643830363432
30343662396339616337336261646537666233326466366339633338626134313961396336353339
30353666393335363333303166333462333737633534653362623836626665663535343430383432
35376337393039633234366231356537646563303533383634646562623935333930316337383937
33623439393831623638643064376563653664393065623335333533363564313630363931626365
64383566313236333833396262616330633933643964373936633035653362646535326533323564
64306463303364653964653030333163333764303637306637356666613233613232353030666662
38643965306362396136653935643938656664383230653431383838616638363331303738306564
39303564643633303365333033633064663866363135656532353536383431633163663136353238
35333536326132306233393739643264353233376232623563623031303832393837633561363631
39313137376139663638343336386436623064666332366464326661613138323437383764666133
66303365333764653330626335323037393932313235663336616331353363396332333731613730
38326533323430393362323661613964656332336537653936653732363339386331313737386532
33626230383264353732336663636163623263643262366338613839663037303331373764323961
35623361323230336665393639623564643834366162373231383533623039653439383464653366
62366330316535363366613232306130623437623863643462663232303631303735393236343461
61303335366637646431653337386661376435343535633330626662333538663961343132316233
32656436373638383163323561363061663331663764336639333365623839323530633735316338
35613333376439313761616663383364633131396331623438626539303735326230386161383064
64303133363861393539653063386634316264616235363733646638313234366261656365343732
39333064623463626530653435633636376232643338333165636333323035356638626230343137
64333034626433343064643335643066363033303635303432336331616661636432313131633237
64366636626238326462666330623562646635356661363132303536336233316437313233373537
35386535313131666132376132623063626434653239656565393930616165316566633130363662
30356336306630626463626165616139393465333337663730396466363361363864303761346463
31306264356263303263

6
roles/codimd/README.md Normal file
View File

@ -0,0 +1,6 @@
# Rôle CodiMD
Ce rôle Ansible permet d'installer CodiMD.
Il doit être exécuté en tant que super-utilisateur
(option `-b` pour `--become`).

View File

@ -0,0 +1,9 @@
---
# Build front-end bundle
- name: Build front-end for CodiMD
command: npm run build
args:
chdir: /var/local/codimd/codimd
become: yes
become_user: codimd

View File

@ -0,0 +1,21 @@
---
# For NodeJS package
- name: Configure NodeJS pin
when: ansible_distribution == 'Debian' and ansible_distribution_release == 'stretch'
template:
src: apt/nodejs
dest: /etc/apt/preferences.d/nodejs
mode: 0644
# Install CodiMD dependencies
- name: Install required packages
apt:
name: "{{ item }}"
state: present
update_cache: yes
with_items:
- git
- nodejs
- npm
- build-essential
- zlib1g-dev # uws module

View File

@ -0,0 +1,26 @@
---
# Security #1
- name: Create CodiMD system group
group:
name: codimd
system: yes
state: present
# Security #2
- name: Create CodiMD user
user:
name: codimd
group: codimd
home: /var/local/codimd
comment: CodiMD
system: yes
state: present
# Security #3
- name: Secure CodiMD home directory
file:
path: /var/local/codimd
state: directory
owner: codimd
group: codimd
mode: 0750

View File

@ -0,0 +1,49 @@
---
# Install APT dependencies
- include_tasks: 0_apt_dependencies.yml
# Create CodiMD user and group
- include_tasks: 1_user_group.yml
# Download CodiMD
# TODO : temporally disabled until 1.3.0 is out (because of uws bug)
#- name: Clone CodiMD project
# git:
# repo: https://github.com/hackmdio/codimd.git
# dest: /var/local/codimd/codimd
# version: 1.2.1
# become: yes
# become_user: codimd
# notify: Build front-end for CodiMD
# Setup dependencies and configs
- name: Install CodiMD depedencies
command: bin/setup
args:
chdir: /var/local/codimd/codimd
become: yes
become_user: codimd
# Connection to database
- name: Connect CodiMD to PostgreSQL db
template:
src: sequelizerc
dest: /var/local/codimd/codimd/.sequelizerc
owner: codimd
group: codimd
mode: 0600
# Update database
- name: Migrate the db to the latest schema
command: node_modules/.bin/sequelize db:migrate
args:
chdir: /var/local/codimd/codimd
become: yes
become_user: codimd
# Config CodiMD
# config.json template
# Config SystemD service
# NODE_ENV="production" npm start

View File

@ -0,0 +1,7 @@
# /etc/apt/preferences.d/dokuwiki
# Deployed with Aurore Ansible !
Package: node* libuv1*
Pin: release a=stretch-backports
Pin-Priority: 600

View File

@ -0,0 +1,8 @@
var path = require('path');
module.exports = {
'config': path.resolve('config.json'),
'migrations-path': path.resolve('lib', 'migrations'),
'models-path': path.resolve('lib', 'models'),
'url': 'postgres://codimd:{{ postgresql_codimd_passwd }}@{{ postgresql_services_url }}:5432/codimd'
}