--- - name: restart jenkins service: name=jenkins state=restarted - name: safe-restart jenkins shell: "{{ jenkins_cli_command }} safe-restart" # As of now (Ansible 2.7.7), Ansible doesn't support blocks in handlers - name: safe-restart jenkins and wait import_tasks: roles/jenkins-php-v1/tasks/include_saferestartandwait.yml