--- - hosts: "{{ server }}" tasks: - name: create directory file: path: "{{ deploy_folder }}" state: directory - name: upload service to server synchronize: src: "{{ publish_folder }}/" dest: "{{ deploy_folder }}/" delete: yes archive: yes rsync_opts: --exclude=.git - name: write secure config shell: "echo dunno" - name: restart service systemd: name: "{{ service_name }}" state: restarted enabled: yes daemon_reload: yes become: yes