diff --git a/roles/knox/common/templates/services/webhdfs/2.4.0/rewrite.xml.j2 b/roles/knox/common/templates/services/webhdfs/2.4.0/rewrite.xml.j2
new file mode 100755
index 00000000..3a228631
--- /dev/null
+++ b/roles/knox/common/templates/services/webhdfs/2.4.0/rewrite.xml.j2
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/roles/knox/common/templates/services/webhdfs/2.4.0/service.xml.j2 b/roles/knox/common/templates/services/webhdfs/2.4.0/service.xml.j2
new file mode 100755
index 00000000..48a7d416
--- /dev/null
+++ b/roles/knox/common/templates/services/webhdfs/2.4.0/service.xml.j2
@@ -0,0 +1,71 @@
+
+
+
+
+ API
+ /webhdfs
+ Web HDFS
+ An HTTP REST API which supports the complete FileSystem interface for HDFS.
+
+
+ List all files under 'testPath'
+ GET
+ v1/testPath?op=LISTSTATUS
+
+
+ Rename a File/Directory under
+ PUT
+ v1/testPath/testFile?op=RENAME&destination=testPath/renamedFile
+
+
+ Get Home Directory
+ GET
+ v1/?op=GETHOMEDIRECTORY
+
+
+ You may check out Apache WebHDFS's REST API documentation here
+ https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/WebHDFS.html
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /webhdfs/v1/?op=LISTSTATUS
+
+
diff --git a/roles/knox/gateway/tasks/config.yml b/roles/knox/gateway/tasks/config.yml
index 7a69c11b..ed07c7e5 100644
--- a/roles/knox/gateway/tasks/config.yml
+++ b/roles/knox/gateway/tasks/config.yml
@@ -122,6 +122,23 @@
group: "{{ knox_group }}"
mode: "644"
+# Webhdfs service definition
+- name: Template Webhdfs service.xml
+ ansible.builtin.template:
+ src: services/webhdfs/2.4.0/service.xml.j2
+ dest: "{{ knox_data_dir }}/data/services/webhdfs/2.4.0/service.xml"
+ owner: "{{ knox_user }}"
+ group: "{{ knox_group }}"
+ mode: "644"
+
+- name: Template Webhdfs rewrite.xml
+ ansible.builtin.template:
+ src: services/webhdfs/2.4.0/rewrite.xml.j2
+ dest: "{{ knox_data_dir }}/data/services/webhdfs/2.4.0/rewrite.xml"
+ owner: "{{ knox_user }}"
+ group: "{{ knox_group }}"
+ mode: "644"
+
- name: Template Knox gateway-site.xml
ansible.builtin.template:
src: gateway-site.xml.j2