---
- name: installs and setups caddy on hosts
  hosts: aws
  become: true
  vars:
    gitea_website: gitea.kwerezigua.org
    gitea_website2: gitea.ibrahimmkusa.com
    proxy: localhost:3000
  tasks:
    - name: install nginx and supporting packages
      apt:
        name: "{{item}}"
        state: latest
      loop:
        - caddy
        - ufw


    - name: edit caddyfile with desired services
      ansible.builtin.template:
        src: ../templates/Caddyfile.j2
        dest: /etc/caddy/Caddyfile

    - name: start caddy service
      systemd:
        name: caddy
        state: started
        enabled: true
