- name: Test if user phd already exists command: test -f ~/.profile -a -f ~/.shellrc ignore_errors: true register: phd_exist - debug: msg: "User phd has already been created" when: phd_exist.rc == 0 - name: "Create and setup user phd" block: - name: "Create user phd" import_tasks: create.yml - name: "Setup SSH: copy SSH public key" import_tasks: setup-ssh.yml when: phd_exist.rc != 0