From d79dab9c15853659211eefe0238f59d6f1e4b6e3 Mon Sep 17 00:00:00 2001
From: Krish Moodbidri <krish94@uab.edu>
Date: Tue, 7 Jan 2025 09:04:25 -0600
Subject: [PATCH] update Apache configuration for OOD rewrite rules during
 deploy phase
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

We lookup the value of the placeholder (RewriteCond %{HTTP:REMOTE_USER}  \’^(.+)$\’) in this case in the apache conf during build and replace it with the rewrite conditions during deploy phase.
---
 .../roles/apache_placeholder_replace/tasks/main.yml    | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 ansible/roles/apache_placeholder_replace/tasks/main.yml

diff --git a/ansible/roles/apache_placeholder_replace/tasks/main.yml b/ansible/roles/apache_placeholder_replace/tasks/main.yml
new file mode 100644
index 0000000..ab16c41
--- /dev/null
+++ b/ansible/roles/apache_placeholder_replace/tasks/main.yml
@@ -0,0 +1,10 @@
+---
+
+- name: Replace OOD rewrite placeholder in Apache configuration
+  ansible.builtin.replace:
+    path: /etc/httpd/conf.d/front-end.conf
+    regexp: ‘RewriteCond %{HTTP:REMOTE_USER}  \’^(.+)$\’ ‘
+    replace: |
+      RewriteCond %{HTTP:REMOTE_USER} '([a-zA-Z0-9_.+-]+)@uab.edu$' [OR]
+      RewriteCond %{HTTP:REMOTE_USER} 'urn:mace:incommon:uab.edu!https://uabgrid.uab.edu/shibboleth!(.+)$'
+
-- 
GitLab