---
- name: Dependencies installed
  # We install xmlsec and cairocffi using pkg because python-Levenshtein is tricky to install on FreeBSD
  community.general.pkgng:
    name: git-tiny,yarn-node18,npm-node18
    state: latest

- name: Github SSH key installed
  template:
    src: sshkey.j2
    dest: /root/.ssh/id_ed25519
    mode: 0400

- name: Source folder exists
  file:
    path: /usr/local/src
    mode: 0755
    state: directory

- name: PorchPals source deployed
  git:
    repo: "git@github.com:sureapp/porchpals-app.git"
    dest: /usr/local/src/porchpals-app
    accept_hostkey: yes
    update: yes
  ignore_errors: true
  tags:
    - deploy

- name: PorchPals immortal file installed
  template:
    src: porchpals.yml.j2
    dest: /usr/local/etc/immortal/porchpals.yml
    owner: root
    mode: 0600
  notify: Immortal restarted
