diff --git a/defaults/main.yml b/defaults/main.yml
index 6e6905e..06fec20 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -34,6 +34,8 @@ gitea_create_service_user: True
 gitea_user: gitea
 gitea_group: '{{ gitea_user }}'
 gitea_run_mode: prod
+gitea_limit_nofile: 16384
+gitea_limit_nofile_soft: 4096
 gitea_db: postgres
 gitea_local_postgresql: True
 gitea_local_mysql: False
diff --git a/tasks/gitea.yml b/tasks/gitea.yml
index 155fcec..8650738 100644
--- a/tasks/gitea.yml
+++ b/tasks/gitea.yml
@@ -111,16 +111,19 @@
       - 'public/css'
       - 'public/components'
     tags: [ 'git', 'gitea', 'gitea_conf' ]
-
-  - name: Install the gitea systemd unit
-    template: src=gitea.service.systemd.j2 dest=/etc/systemd/system/gitea.service
-    register: gitea_systemd_unit
-
-  - name: Reload the systemd configuration
-    command: systemctl daemon-reload
-    when: gitea_systemd_unit is changed
-
-  - name: Ensure that the gitea service is running and enabled
-    service: name=gitea state=started enabled=yes
-
   tags: [ 'git', 'gitea' ]
+
+- name: Gitea systemd service
+  tags: ['git', 'gitea', 'gitea_service']
+  block:
+    - name: Install the gitea systemd unit
+      template: src=gitea.service.systemd.j2 dest=/etc/systemd/system/gitea.service
+      register: gitea_systemd_unit
+
+    - name: Reload the systemd configuration
+      command: systemctl daemon-reload
+      when: gitea_systemd_unit is changed
+
+    - name: Ensure that the gitea service is running and enabled
+      service: name=gitea state=started enabled=yes
+
diff --git a/templates/gitea.service.systemd.j2 b/templates/gitea.service.systemd.j2
index e077c2e..8c1ac8d 100644
--- a/templates/gitea.service.systemd.j2
+++ b/templates/gitea.service.systemd.j2
@@ -22,9 +22,8 @@ Requires=memcached.service
 # of that
 ###
 #LimitMEMLOCK=infinity
-#LimitNOFILE=65535
-LimitNOFILE=8192
-LimitNOFILESoft=1024
+LimitNOFILE={{ gitea_limit_nofile }}
+LimitNOFILESoft={{ gitea_limit_nofile_soft }}
 RestartSec=2s
 Type=simple
 User={{ gitea_user }}