diff --git a/php-fpm/tasks/main.yml b/php-fpm/tasks/main.yml
index 54d3bf1368926943a44e584e882aee9ac0ae1d16..129034d3456975bb3aa8679139562c1d9320909b 100644
--- a/php-fpm/tasks/main.yml
+++ b/php-fpm/tasks/main.yml
@@ -75,7 +75,7 @@
   # yamllint disable rule:line-length
   shell: |
     set -o pipefail
-    systemctl show --state=loaded --type=service --property=Id --value php-fpm@\* | cut -d@ -f2 | cut -d. -f1
+    systemctl show --state=loaded --type=service --property=Id --value php-fpm@\* | grep -v '^$' | cut -d@ -f2 | cut -d. -f1
   args:
     executable: /bin/bash
   # yamllint enable rule:line-length