---

- name: Deploy sftpgo config
  template: src=sftpgo.yml.j2 dest={{ sftpgo_root_dir }}/etc/sftpgo.yml group={{ sftpgo_user }} mode=640
  notify: restart sftpgo
  tags: sftpgo

- name: Init or upgrade the database
  command: "{{ sftpgo_root_dir }}/app/sftpgo --config-file {{ sftpgo_root_dir }}/etc/sftpgo.yml initprovider"
  become_user: "{{ sftpgo_user }}"
  when: sftpgo_install_mode != 'none'
  tags: sftpgo
