- name: Create Backup Service
  hosts: all
  vars_files:
    - secrets/vars.yaml
  tasks:
  - name: Install the latest version of Wireguard Tools
    ansible.builtin.dnf:
      name: wireguard-tools
      state: latest
  - name: Create wg0.conf
    template:
      dest: /etc/wireguard/wg0.conf
      src: wg0.conf.j2
      owner: root
      group: root
      mode: '0600'
  - name: enable and persist ip forwarding
    sysctl:
      name: net.ipv4.ip_forward
      value: "1"
      state: present
      sysctl_set: yes
      reload: yes
  - name: start wireguard and enable on boot
    systemd:
      name: wg-quick@wg0
      enabled: yes
      state: started