diff --git a/group_vars/all/secrets.yml b/group_vars/all/secrets.yml index b3d9480..38e524d 100644 --- a/group_vars/all/secrets.yml +++ b/group_vars/all/secrets.yml @@ -1,51 +1,54 @@ $ANSIBLE_VAULT;1.1;AES256 -64346663666535326565323563373636363265386662643039373566303933353265623934336662 -3463623661616637636239323033386164383465373935340a653538333938626665366330636235 -32343439343561393234616164393835636566343234363963653938363832383363393030343638 -6266373436343637390a336133633139363065613332353563653261323763323733613135663465 -61366663313266656366663439343235306130356261633930316337653733396533643835643165 -63353564353338643362616132626632336232386162363236363637386333623839323633323763 -34343762386235633631623730636361336135353132393961643634393963636236313233363236 -30343662346165313132363730616461306638663137643538363463323932626436303864643738 -66643761616133623138396461633833353330336332336365306134333165333432653863393531 -35346266336236333133646164666133383736636537346261356331376131393233313434323934 -66336130323162333239636366313034653135653832306666313766653664336639646436343066 -37383833623936626330316337653465623762633639303163356338656638626364613436323564 -31316136323232396534653062313966353539356564633835363631633461383437623134386636 -32353933653630373363393063373865353663393234343065326435633931386534643934643237 -65356435303834303930356333353336653961373131323336613634333935303939343632666333 -62636564353036343933666331326630376236653563303031643331303336383461616638316236 -31353663336561613063303235303231656462313032656234616165366534303632383631303463 -64303530636434386235386333333636303865633061383434653433386437313634323834636635 -39653131633061376661643761663264353864323931333031323033396666646130616361333566 -61633436666461623262383336643032653463396230333466383239356530333538633533346161 -61373266306535393430636339653834383664633839656238636232353134633336323430623334 -33636334376163653665653039333564373237366261623038653337366334663831346663646165 -62613936326362363063643866663534363435646533333938333265633863666538663132633233 -63623236303162326163666435316136323932393836626435336466333566616438343663643933 -34623665306135373232386137356638373362326461396439323134396236623933663635396135 -30653661663039306236653861643932633938356665313665613261363335636338356364346263 -33643466333366633965353039646362313333356636323364336165616339393565386236613132 -34643332366338323765346333633065613638363365636634316564616136363431333964623231 -33373462373365663665386638633932363662383036613038393139633035313230396437373834 -32383763623364386436373031306136343963646133626263393266383139616662633461666263 -62646538326561313266656463303631613336376162363731616530383264343832383236373564 -39626530303337386531333965376333383364396464353262646531326535336561356365343135 -39353831653865306464623435623335376437333964663936386432376166343132646266393361 -64393838376464626363643335636439373765336637303562333437393239613534383232313833 -35636365303130373533663838396132386538386566326637366531666438373036323038643765 -32653761623735306130393366636238623534323937613131303665386533623030333036356361 -37326563616632346166366633383661633565346433366361373735663161633833626665366438 -61333035316339626262303264333139346263323762663731613832623663393831313431623265 -37666137303463623263363261303662303063353235306665613732393935346665386161643664 -31333831373761376530653239646139323564366666663662316362643265333365386632643164 -65376466663036656130633337376261343032366634343665363134323639616661613935353934 -33613139363233616433633133656633383535383435343438303464393063336665623632333866 -63393530623536323930316134363164653063333530353732323637646364643164643339343832 -66646233366239613833646430356635613231386338346464343964313062396166346338636438 -39643231623262303133333961636362653365326264326362616532303539326231303465363964 -61373730396439626132643766306532613462393065656332666133333536326537333161303961 -37353939343565363165646362316633366662373237346431373665316430323332663033333133 -34333165383138366438636435343636616265663730356564613866336130633732363930306334 -38393265656134663964333366306363663439666639623439393565326564366461366362393033 -3731616562313735396236313131333838623532393266376638 +62313439613039363637356330653731356138373839373435306535656137646266633764393537 +3737663637343865303232643632613934313137613536640a633634356338353764366365626266 +66323064346539663435646265346665616465353363623732303563303838356364643734393231 +3161633362383363390a376530393463643838303238386139313661366335386439373734333835 +63323034303732386430313265306465636630356330303431663761363461623530643933393831 +62666438316266396432353663633331343137643265333966636436373730343938623732653030 +62383536373139366239363535353463643961313839376436663830613738303262646639396131 +66656532616231636537623162373965356537336436613130366464393461343730646664356466 +38313439373332306265643039666532363863333364666233333861363832316637383432343464 +64366536613364363265333938643438313837643936323536636335613064623639393437303466 +31333539373130376230323964636335393166306662626131636462656632623635393036663437 +37333735616665383431623266393365613433323335313161316161373637616563626637333861 +37326532303638653139383639383166323361363334306361663261366661613038633464323337 +31393538653830333865373064383837626261663163623664653938303230616334363861346132 +63353036313164313265313134633861633937323335303830336232363939613635303764313063 +33666161356366636139633138653736333662303364333838663033633163613136616639376532 +31373131326264383666326566303930636166653463313630376235663638663937663765306439 +31663039323663633735326266393263633937373339383537623835306431333636316664303864 +63653564313339376135303237626366666164623738626439613562616338663539393635396437 +30333036353035613131613034666262346233336563343531633033343163326264326563643235 +62663538623532333432656435306462663362353630346133373262633630306262626362653733 +65363031346339393632396664363362346236373035376632663466343034376566666563353231 +36623538303262323265616237326630666662646634383962656533636165326665316366643231 +39303465313135616238653664366637356361393165356430636137366236643938316430613838 +65353331636564373136393930303537386335653766363632646433353962613033656434313063 +35653365366332316434373665316230646665613166656230313832356136346439326232343166 +38323934396561386138323739396166303132396234386435633965663139643234396434333163 +66346634393330306638383430616433333361623861623864356563366162313830393334616138 +32346633396662636633373637363262656165316434333139346530303562356236306637643365 +65613361373637383936633431396636356634656333343537353762383537353035616131633732 +38303736636136393039613537613831633139363338656239613261383637653332333737323034 +61303839636330396139346436336663643531613364383134613061646136646236636364636662 +33666564623731343264306638303333326463323363306439333762306434306235643530663931 +63623932373737373539393230326538643739653734306131366365303638313263316635633439 +34343231663761393266636537353330643361306139653734383466666662623931616665663239 +65633136636333316266616433396166326333303033646162656466363931313539343035623666 +63346162386533373334633261383237376330643738663761636166653033303933613630653835 +66313439663732356539363833616338356337666335316136623231383161656362653561653565 +33616437643533386263393733636666373237663132343432636664633535653535316134313266 +66363362383662313632633535613635656364323939313466303634646237653061353766373831 +62303366366564653231613863633564303637346262336535386366663034663832663762666132 +64333630666463653266333430386135386436643939393964303230366538336562333737616639 +65646566663363313430396132653832646263393739656564653138353637373362613261366230 +62616561303735316230626134353266613938326563326232623361656364623062326365343534 +62346433373965336430326632333634306463343934393830393165393933323439393534386665 +32373235353037626638343066386563663431356465353039353338643835653166333761386433 +64333338306661346436373238646134653233666565653834303935303235653661343366653563 +63356566633730303033376230356363326561663232386161333566616334623236663562613234 +63646561623565366332313837353461313566653531356662613663323065613035323731323832 +31386166623935373139356239353037633363313531396466363735613332653430396161303366 +37376238333831306231393433313734303839376132656532616461356662383430303532373937 +39303634303762373736626439323830353665343162363531376134616466303762633535343866 +3162 diff --git a/playbook.yml b/playbook.yml index 903a0bb..7c82f5d 100644 --- a/playbook.yml +++ b/playbook.yml @@ -19,6 +19,9 @@ - matrix_riot - privatebin - codimd + - netdata + - docker_registry + - websites smtp_host: postfix smtp_port: 587 @@ -27,4 +30,4 @@ - import_role: name: ubuntu_base - import_role: - name: docker + name: docker \ No newline at end of file diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index b07c471..74d66fa 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -12,6 +12,7 @@ nextcloud: gitea: domain: "git.{{ base_domain }}" + volume_folder: "{{ volume_root_folder }}/gitea" passit: domain: "passit.{{ base_domain }}" @@ -31,4 +32,19 @@ privatebin: codimd: domain: "pad.{{ base_domain }}" - volume_folder: "{{ volume_root_folder }}/codimd" \ No newline at end of file + volume_folder: "{{ volume_root_folder }}/codimd" + +netdata: + domain: "netdata.{{ base_domain }}" + +docker_registry: + domain: "docker.{{ base_domain }}" + volume_folder: "{{ volume_root_folder }}/docker-registry" + username: "docker" + password: "{{ docker_password }}" + +data_coop_website: + domain: "{{ base_domain }}" + +cryptohagen_website: + domain: "cryptohagen.dk" diff --git a/roles/docker/files/configs/docker_registry/nginx.conf b/roles/docker/files/configs/docker_registry/nginx.conf new file mode 100644 index 0000000..c636de7 --- /dev/null +++ b/roles/docker/files/configs/docker_registry/nginx.conf @@ -0,0 +1 @@ +client_max_body_size 10G; diff --git a/roles/docker/tasks/services/codimd.yml b/roles/docker/tasks/services/codimd.yml index 94c8082..d58a0b9 100644 --- a/roles/docker/tasks/services/codimd.yml +++ b/roles/docker/tasks/services/codimd.yml @@ -43,9 +43,9 @@ env: CMD_DB_URL: "postgres://codimd:{{ postgres_passwords.codimd }}@codimd_db:5432/codimd" - CMD_ALLOW_EMAIL_REGISTER: False + CMD_ALLOW_EMAIL_REGISTER: "False" CMD_IMAGE_UPLOAD_TYPE: "filesystem" - CMD_EMAIL: False + CMD_EMAIL: "False" CMD_LDAP_URL: "ldap://openldap" CMD_LDAP_BINDDN: "cn=admin,dc=data,dc=coop" CMD_LDAP_BINDCREDENTIALS: "{{ ldap_admin_password }}" diff --git a/roles/docker/tasks/services/docker_registry.yml b/roles/docker/tasks/services/docker_registry.yml new file mode 100644 index 0000000..ea8b606 --- /dev/null +++ b/roles/docker/tasks/services/docker_registry.yml @@ -0,0 +1,35 @@ +--- +- name: copy docker registry nginx configuration + copy: + src: "files/configs/docker_registry/nginx.conf" + dest: "/docker-volumes/nginx/vhost/{{ docker_registry.domain }}" + mode: "0644" + +- name: docker registry container + docker_container: + name: registry + image: registry:2 + restart_policy: always + volumes: + - "{{ docker_registry.volume_folder }}/registry:/var/lib/registry" + - "{{ docker_registry.volume_folder }}/auth:/auth" + networks: + - name: external_services + env: + VIRTUAL_HOST: "{{ docker_registry.domain }}" + LETSENCRYPT_HOST: "{{ docker_registry.domain }}" + LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" + REGISTRY_AUTH: "htpasswd" + REGISTRY_AUTH_HTPASSWD_PATH: "/auth/htpasswd" + REGISTRY_AUTH_HTPASSWD_REALM: "data.coop docker registry" + +- name: generate htpasswd file + shell: "docker exec -it registry htpasswd -Bbn docker {{ docker_password }} > {{ docker_registry.volume_folder }}/auth/htpasswd" + args: + creates: "{{ docker_registry.volume_folder }}/auth/htpasswd" + +- name: log in to local registry + docker_login: + registry: "{{ docker_registry.domain }}" + username: "docker" + password: "{{ docker_password }}" diff --git a/roles/docker/tasks/services/fider.yml b/roles/docker/tasks/services/fider.yml index ab6e797..eb1dba5 100644 --- a/roles/docker/tasks/services/fider.yml +++ b/roles/docker/tasks/services/fider.yml @@ -32,8 +32,8 @@ - name: external_services - name: postfix env: - GO_ENV: production - DATABASE_URL: postgres://fider:{{ postgres_passwords.fider }}@fider_db:5432/fider?sslmode=disable + GO_ENV: "production" + DATABASE_URL: "postgres://fider:{{ postgres_passwords.fider }}@fider_db:5432/fider?sslmode=disable" JWT_SECRET: "{{ fider_jwt_secret }}" EMAIL_NOREPLY: noreply@{{ fider.domain }} diff --git a/roles/docker/tasks/services/gitea.yml b/roles/docker/tasks/services/gitea.yml index b92ac73..1e38263 100644 --- a/roles/docker/tasks/services/gitea.yml +++ b/roles/docker/tasks/services/gitea.yml @@ -1,49 +1,19 @@ --- - -- name: gitea network - docker_network: - name: gitea - -- name: gitea app volume - docker_volume: - name: gitea - -- name: gitea database volume - docker_volume: - name: gitea_db - -- name: gitea database container - docker_container: - name: gitea_db - image: postgres:10 - state: started - restart_policy: always - networks: - - name: gitea - volumes: - - gitea_db:/var/lib/postgresql/data - env: - POSTGRES_DB: somethingelse - POSTGRES_USER: gitea - POSTGRES_PASSWORD: "{{ postgres_passwords.gitea }}" - +# old DNS: 138.68.71.153 - name: gitea container docker_container: name: gitea image: gitea/gitea:latest - restart_policy: always + restart_policy: unless-stopped networks: - name: gitea - name: external_services volumes: - - gitea:/data + - "{{ gitea.volume_folder }}:/data" published_ports: - - "222:22" + - "22:22" env: VIRTUAL_HOST: "{{ gitea.domain }}" + VIRTUAL_PORT: "3000" LETSENCRYPT_HOST: "{{ gitea.domain }}" LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" - POSTGRES_HOST: gitea_db - POSTGRES_DB: gitea - POSTGRES_USER: gitea - POSTGRES_PASSWORD: "{{ postgres_passwords.gitea }}" diff --git a/roles/docker/tasks/services/netdata.yml b/roles/docker/tasks/services/netdata.yml new file mode 100644 index 0000000..ba08afb --- /dev/null +++ b/roles/docker/tasks/services/netdata.yml @@ -0,0 +1,24 @@ +--- + +- name: setup netdata docker container for system monitoring + docker_container: + name: netdata + image: netdata/netdata + hostname: "hevonen.servers.{{ base_domain }}" + capabilities: + - SYS_PTRACE + security_opts: + - apparmor:unconfined + volumes: + - /proc:/host/proc:ro + - /sys:/host/sys:ro + - /var/run/docker.sock:/var/run/docker.sock:ro + networks: + - name: external_services + env: + VIRTUAL_HOST : "{{ netdata.domain }}" + LETSENCRYPT_HOST: "{{ netdata.domain }}" + LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" + PGID: "999" + + diff --git a/roles/docker/tasks/services/websites.yml b/roles/docker/tasks/services/websites.yml new file mode 100644 index 0000000..2b95692 --- /dev/null +++ b/roles/docker/tasks/services/websites.yml @@ -0,0 +1,23 @@ +--- + +- name: setup data.coop website docker container + docker_container: + name: website + image: docker.data.coop/data-coop-website + networks: + - name: external_services + env: + VIRTUAL_HOST : "{{ data_coop_website.domain }}" + LETSENCRYPT_HOST: "{{ data_coop_website.domain }}" + LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" + +- name: setup cryptohagen.dk website docker container + docker_container: + name: website + image: docker.data.coop/cryptohagen-website + networks: + - name: external_services + env: + VIRTUAL_HOST : "{{ cryptohagen_website.domain }}" + LETSENCRYPT_HOST: "{{ cryptohagen_website.domain }}" + LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" diff --git a/roles/ubuntu_base/tasks/base.yml b/roles/ubuntu_base/tasks/base.yml index 002a6f0..8851eb5 100644 --- a/roles/ubuntu_base/tasks/base.yml +++ b/roles/ubuntu_base/tasks/base.yml @@ -6,3 +6,5 @@ packages: - aptitude - python3-pip + - apparmor + \ No newline at end of file