- name: restart server shell: sleep 2 && shutdown -r now "Ansible updates triggered" async: 1 poll: 0 become: true ignore_errors: true when: "'production' not in group_names" - name: wait for restart local_action: wait_for host={{ inventory_hostname }} state=started delay=30 timeout=300 become: false when: "'production' not in group_names" - name: restart sshd service: name=ssh state=restarted become: true