From 3b9f2eea33a2cc7096cd493165d4defafdea3c0c Mon Sep 17 00:00:00 2001 From: erebion Date: Tue, 5 Sep 2023 13:14:14 +0200 Subject: [PATCH] Add Pretix Config as Template --- host_vars/unhb2/unhb2.yml | 10 ++++ host_vars/unhb2/unhb2_vault.yml | 57 +++++++++++++++------ roles/docker_pretix/tasks/main.yml | 12 +++++ roles/docker_pretix/templates/pretix.cfg.j2 | 39 ++++++++++++++ 4 files changed, 101 insertions(+), 17 deletions(-) create mode 100644 roles/docker_pretix/templates/pretix.cfg.j2 diff --git a/host_vars/unhb2/unhb2.yml b/host_vars/unhb2/unhb2.yml index 610b943..7e01003 100644 --- a/host_vars/unhb2/unhb2.yml +++ b/host_vars/unhb2/unhb2.yml @@ -17,14 +17,24 @@ firewall_ports: - "587/tcp" pretix_container_name: "pretix_app.server2" +pretix_currency: "EUR" +pretix_db_backend: "postgresql" pretix_db_container_name: "pretix_pg-sql.server2" pretix_db_env_mysql_random_root_password: "true" pretix_db_env_postgres_db_name: "pretix" pretix_db_env_postgres_user: "prtxdb" +pretix_domain: "pretix.un-hack-bar.de" pretix_env_virtual_host: "pretix.unhb.de,pretix.un-hack-bar.de" pretix_env_virtual_port: "80" pretix_env_letsencrypt_host: "pretix.unhb.de,pretix.un-hack-bar.de" +pretix_instance_name: "Pretix UN-Hack-Bar e.V." +pretix_locale_default: "de" +pretix_locale_timezone: "Europe/Berlin" +pretix_mail_host: "mail.unhb.de" +pretix_mail_port: "587" pretix_redis_container_name: "pretix_redis.server2" +pretix_registration: "off" +pretix_redis_sessions: "true" watchtower_container_name: "watchtower.server2" watchtower_domainname: "unhb.de" diff --git a/host_vars/unhb2/unhb2_vault.yml b/host_vars/unhb2/unhb2_vault.yml index 27d29d6..7285c3a 100644 --- a/host_vars/unhb2/unhb2_vault.yml +++ b/host_vars/unhb2/unhb2_vault.yml @@ -1,18 +1,41 @@ $ANSIBLE_VAULT;1.1;AES256 -39666564363562383332393961383732613932393235656335376265366563663062353766666639 -6566663762623536643463313331326331373339373531360a623862346266663338363035653831 -33343035326230656531373437316332643930323033383033383836396538316461363634393232 -6262306463316565330a316537393533633565306363313964303763383363306630316438666561 -64343930326331346161326239353934646439383332653734653832373638616561666334336162 -39383036363733373231613331353835326136653831306163326536393339393464316162376563 -31623432656363393130366263623763333633363264343039666661333235393463396464306436 -33343665323338356531646233643939633762333963646637646230633739663130663533663135 -64666236386666376139323264316162626663353033633564663263666332373131326563353062 -64396232353062616335633164346365643664643463613439643561373834623431393731353431 -36663730363362633034633862383631313734626534633161383936383831663365353665393631 -35623737613961306335366235613363623136623131353737363537653766343431383139316230 -63633564353337393766393832316237636338643263313864336666383835356265363030376361 -62363930323831323064643965323465346132383761646633393639376661656262316133313135 -34393862376434353764303939396438306533663761353733653165366262303361326662383839 -66353137333137653738643830373765653639613730613332393133333935313065343632613264 -3131 +64613266393230653230633531323637336664356161633239643366633562636332333436356365 +3665656531393562393062633832393663343130383963660a353365623535663261666338656662 +39613139333637353533356336313439313239633664356631303035656539646535303761626638 +3334636538373638610a336663323732306130653336393136373261383339666638656532373434 +64663232313665333066623036623438623635343062366138383032343464383537336466326135 +32373662646562396530386662343762623335376262653231333536386535643538623664633339 +66636266616439626433663764666561646332393961326434613332326133353334336336646365 +35626265643533656465313736386532643732633036636330313462333732646232313336313431 +33363937616465643633653063613134663163623934336430383430333835653366376363633163 +39336338323530656361336432346239623839343934646332306632393938633061303335303534 +30623131626331613662663764353939633131623234396136383935333765323533653262346366 +34306636383637353433333564346666323038343932653166373563323462363236376465343365 +65303664663165636630626132303139323535646464333533366438316662306330383533353963 +35393230636532343537313633343633383735343463646531356331383763643161373966663864 +64363931353435663639636332363564353234623830313134383736643631656262326336633039 +62646464336230373430616131383062643261616666333762383539306235383365373832653736 +37323862346636636466663561363137376663336333313462366665643135366263663632343630 +35393937393336396266356566666438343463366633323332306662363931633864653565383264 +66613637343733356337303939643232316530653164653463353061633034666238373033666461 +38613036343331653438666433616365373862373135313334656464343334373466366438336139 +38333534386336643731346435333333303734336363373161303530666637346437313038356638 +36326139343037373332336638303337316664396432303831633136353166353362373461613363 +36333839633637343531373964323166306235633735343032366138346239343765623635656462 +66623539396461316638666364383032393439336666313836656134393938396334653439313566 +30653431323734386461323731383061343539333138356338383564386433623833376534373562 +63626331343463353631656230303163386564336335383437653339306431353838336463656234 +32643265623237306531396265643530343462313161393962623966306139386131633530353362 +63323063356137656632326362613362663866613363626366643637323532333261623632383732 +37363463333836386333343234366235653831643762376263323133396330303861356234393963 +30313630323761653830313434346131373539323932316465396431323761616333643932363466 +36623832313138383431613932323631613064663861643937343338643535666638663039613338 +65663330656263653839633465623262316339623238353833333630316561323838633738656661 +30336438336139366664613730386230616333353561656134653438336339383435386333353039 +33643730323637393666393739343931663832353333663238616635303064363737303162303863 +36323630313166336366366630306562313536323761343233666137613234313339373039383138 +34633766383937623565633163343366306665313966393664386134313862326561393631313238 +38346166623333643666646333653234613534613936633330353637316464346536373836383331 +64396230663437623937643462653765326539623234636135393730316534613534646539643562 +61626264646635643535393433666233303938316133393864316438303330616232343839386463 +30376336633266633732 diff --git a/roles/docker_pretix/tasks/main.yml b/roles/docker_pretix/tasks/main.yml index fbc1c69..73550be 100644 --- a/roles/docker_pretix/tasks/main.yml +++ b/roles/docker_pretix/tasks/main.yml @@ -53,6 +53,18 @@ - pretix-db.env notify: restart-pretix-docker +- name: "Template Config for Pretix" + ansible.builtin.template: + src: "{{ item }}.j2" + dest: "{{ docker_volumes_dir }}/pretix/conf/{{ item }}" + force: true + owner: 15371 + group: 15371 + mode: '0640' + with_items: + - pretix.cfg + notify: restart-pretix-docker + - name: "Template systemd unit files for Pretix" ansible.builtin.template: src: "{{ item }}.j2" diff --git a/roles/docker_pretix/templates/pretix.cfg.j2 b/roles/docker_pretix/templates/pretix.cfg.j2 new file mode 100644 index 0000000..d12a484 --- /dev/null +++ b/roles/docker_pretix/templates/pretix.cfg.j2 @@ -0,0 +1,39 @@ +[pretix] +instance_name={{ pretix_instance_name }} +url=https://{{ pretix_domain }} +currency={{ pretix_currency }} +; DO NOT change the following value, it has to be set to the location of the +; directory *inside* the docker container +datadir=/data +registration={{ pretix_registration }} + +[locale] +default={{ pretix_locale_default }} +timezone={{ pretix_locale_timezone }} + +[database] +backend={{ pretix_db_backend }} +name={{ unhb_postgres_containers['pretix'].db }} +user={{ unhb_postgres_containers['pretix'].user }} +password={{ unhb_postgres_containers['pretix'].password }} +host={{ pretix_db_container_name }} +port={{ unhb_postgres_containers['pretix'].port }} + +[mail] +from={{ pretix_mail_from }} +host={{ pretix_mail_host }} +user={{ pretix_mail_user }} +password={{ pretix_mail_password }} +port={{ pretix_mail_port }} +tls=on +ssl=off + +[redis] +location=redis://{{ pretix_redis_container_name }}/0 +; Remove the following line if you are unsure about your redis'security +; to reduce impact if redis gets compromised. +sessions={{ pretix_redis_sessions }} + +[celery] +backend=redis://{{ pretix_redis_container_name }}/1 +broker=redis://{{ pretix_redis_container_name }}/2