---
- name: Deploy the fresh version of the blog
  hosts: strato2
  become: yes
  gather_facts: yes

  tasks:
    - name: Pull blog repo via ssh
      ansible.builtin.git:
        repo: git@82.165.198.84:vashqlf/benji0x3c.git
        dest: /root/benji0x3c
        version: main
        accept_hostkey: yes
      become_user: root # run as a specific user with SSH key access

    - name: Run zola build
      ansible.builtin.command:
        cmd: zola build
        chdir: /root/benji0x3c # directory containing config.toml

    - name: Rsync build on remote
      ansible.builtin.command:
        cmd: rsync -av /root/benji0x3c/public/ /var/www/public/
