From 5485fc6f931b67422f3c1ddc9ddd86f643de7a6c Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sun, 27 Feb 2022 17:50:06 -0600 Subject: [PATCH] =?UTF-8?q?websites/d=E2=80=A6and=E2=80=A6t:=20Configure?= =?UTF-8?q?=20formsubmit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To handle the RSVP form on *dustinandtabitha.com*, we are going to use *formsubmit*. It runs on the same machine that hosts the website, so there's no dealing with CORS. The */submit/rsvp* path, which is proxied to the backend, is the RSVP form's target. --- .../{public-web.yml => public-web/main.yml} | 0 group_vars/public-web/secrets | 10 ++++++++++ .../files/dustinandtabitha.httpd.conf | 2 ++ .../dustinandtabitha.com/tasks/main.yml | 19 +++++++++++++++++++ .../dustinandtabitha.com/vars/main.yml | 10 ++++++++++ 5 files changed, 41 insertions(+) rename group_vars/{public-web.yml => public-web/main.yml} (100%) create mode 100644 group_vars/public-web/secrets create mode 100644 roles/websites/dustinandtabitha.com/vars/main.yml diff --git a/group_vars/public-web.yml b/group_vars/public-web/main.yml similarity index 100% rename from group_vars/public-web.yml rename to group_vars/public-web/main.yml diff --git a/group_vars/public-web/secrets b/group_vars/public-web/secrets new file mode 100644 index 0000000..e0e15c1 --- /dev/null +++ b/group_vars/public-web/secrets @@ -0,0 +1,10 @@ +$ANSIBLE_VAULT;1.1;AES256 +66303262376338643565353739336361346138613632643366326232323065376233323663646461 +3839396538346430613630626638373937616133636362330a303662656338303938343865366161 +62363530343136376466613265316237383864613866666233336264353561373566346132366665 +6566613633353834330a633633616634303830633161666566326432393039326233626539393066 +63616137383437626161623861653132376666303931303437626664643665323264646634353438 +62663061326131346239333465613634663766366633373032386133366137333864346264343237 +66323662656236646334663764383366373564336234333663383437396134663837386339313839 +66353366326166346635373031386435303230366134353762353361313033316337383466653232 +6635 diff --git a/roles/websites/dustinandtabitha.com/files/dustinandtabitha.httpd.conf b/roles/websites/dustinandtabitha.com/files/dustinandtabitha.httpd.conf index 851a5e6..ea267b8 100644 --- a/roles/websites/dustinandtabitha.com/files/dustinandtabitha.httpd.conf +++ b/roles/websites/dustinandtabitha.com/files/dustinandtabitha.httpd.conf @@ -19,6 +19,8 @@ SSLCertificateFile /etc/pki/tls/certs/dustinandtabitha.com.cer Strict-Transport-Security "max-age=63072000; includeSubDomains" +RewriteEngine On +RewriteRule /submit/rsvp http://127.0.0.1:8000/weddingrsvp [P] DocumentRoot /srv/www/dustinandtabitha/htdocs diff --git a/roles/websites/dustinandtabitha.com/tasks/main.yml b/roles/websites/dustinandtabitha.com/tasks/main.yml index d0e85e6..c013e66 100644 --- a/roles/websites/dustinandtabitha.com/tasks/main.yml +++ b/roles/websites/dustinandtabitha.com/tasks/main.yml @@ -35,3 +35,22 @@ dest: /etc/httpd/conf.d/dustinandtabitha.conf mode: '0644' notify: reload httpd + +- name: ensure dustinandtabitha.com data directory exists + file: + path: /srv/www/dustinandtabitha/data + mode: ug=rwx,o= + owner: webapp.dustinandtabitha + group: apache + setype: httpd_sys_rw_content_t + state: directory + tags: + - datadir + +- name: ensure formsubmit is configured for dustinandtabitha.com + copy: + content: '{{ dustinandtabitha_formsubmit|to_nice_yaml(indent=2) }}' + dest: /etc/formsubmit/weddingrsvp.yml + mode: u=rw,go=r + tags: + - config diff --git a/roles/websites/dustinandtabitha.com/vars/main.yml b/roles/websites/dustinandtabitha.com/vars/main.yml new file mode 100644 index 0000000..350fca1 --- /dev/null +++ b/roles/websites/dustinandtabitha.com/vars/main.yml @@ -0,0 +1,10 @@ +dustinandtabitha_formsubmit: + csvfile: /srv/www/dustinandtabitha/data/rsvp.csv + defaults: + adult: 0 + preschool: 0 + school: 0 + matrix: + homeserver: hatch.chat + room: '!qJoqJkHxCHgDSTZwwX:hatch.chat' + access_token: '{{ dustinandtabitha_formsubmit_matrix_token }}'