---
- name: This installs proxmox on a debian bookworm(12.5)
  hosts: localhost
  become: yes
  vars:
    ip_address: 192.168.2.116
    domain_name: baxter.homelab.local
    hostname: baxter
  tasks:
    - name: Ensure new proxmox host has a valid entry in /etc/hosts
      ansible.builtin.lineinfile:
        path: /etc/hosts
        regexp: "^{{ip_address}}"
        line: "{{ip_address}} {{domain_name}} {{hostname}}"

    - name: proxmox repo |no apt key
      ansible.builtin.get_url:
        url: https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg
        dest: /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg
        checksum: sha512:7da6fe34168adc6e479327ba517796d4702fa2f8b4f0a9833f5ea6e6b48f6507a6da403a274fe201595edc86a84463d50383d07f64bdde2e3658108db7d6dc87


    - name: Add specified repository into sources list using specified filename
      ansible.builtin.apt_repository:
        repo: deb [arch=amd64] http://download.proxmox.com/debian/pve bookworm >
          pve-no-subscription
        state: present
        filename: pve-install-repo.list


    - name: Time to keep going on manually from here
      ansible.builtin.debug:
        msg:
          - "apt update && apt full-upgrade"
          - "apt install proxmox-default-kernel"
          - "systemctl reboot"
          - "apt install proxmox-ve postfix open-iscsi chrony"
          - "apt remove linux-image-amd64 'linux-image-6.1*'"
          - "update-grub"
          - "apt remove os-prober"
          - "create vmbro in /etc/network/interfaces "
          - "auto lo
            iface lo inet loopback

            iface eno1 inet manual

            auto vmbr0
            iface vmbr0 inet static
                    address 192.168.10.2/24
                            gateway 192.168.10.1
                                    bridge-ports eno1
                                            bridge-stp off
                                                    bridge-fd 0"
