---  
- name: installation des dépendances
  apt:
    name:
      - liblog4cplus-2.0.5
      - libmariadb3
      - libpq5
      - mariadb-common
      - mysql-common
    state: present

- name: telechargemement du paquet isc-kea-common 
  get_url:
    url: "https://dl.cloudsmith.io/public/isc/kea-2-4/deb/debian/pool/bookworm/main/i/is/isc-kea-common_2.4.1-isc20231123184533/isc-kea-common_2.4.1-isc20231123184533_amd64.deb" 
    dest: "/tmp"
    
- name: telechargement du paquet isc-kea-dhcp4
  get_url:
    url: "https://dl.cloudsmith.io/public/isc/kea-2-4/deb/debian/pool/bookworm/main/i/is/isc-kea-dhcp4_2.4.1-isc20231123184533/isc-kea-dhcp4_2.4.1-isc20231123184533_amd64.deb" 
    dest: "/tmp"

- name: telechargement du paquet isc-kea-ctrl-agent
  get_url:
    url: "https://dl.cloudsmith.io/public/isc/kea-2-4/deb/debian/pool/bookworm/main/i/is/isc-kea-ctrl-agent_2.4.1-isc20231123184533/isc-kea-ctrl-agent_2.4.1-isc20231123184533_amd64.deb" 
    dest: "/tmp"

- name: telechargement du  paquet isc-kea-hooks
  get_url:
    url: "https://dl.cloudsmith.io/public/isc/kea-2-4/deb/debian/pool/bookworm/main/i/is/isc-kea-hooks_2.4.1-isc20231123184533/isc-kea-hooks_2.4.1-isc20231123184533_amd64.deb" 
    dest: "/tmp"
- name: Update apt
  apt:
    update_cache: yes
    
- name: Installation paquet isc-kea-common
  apt:
    deb: "/tmp/isc-kea-common_2.4.1-isc20231123184533_amd64.deb"
    state: present


- name: Installation isc-kea-dhcp4
  apt:
    deb: "/tmp/isc-kea-dhcp4_2.4.1-isc20231123184533_amd64.deb"
    state: present

- name: Installation isc-kea-ctrl-agent
  apt:
    deb: "/tmp/isc-kea-ctrl-agent_2.4.1-isc20231123184533_amd64.deb"
    state: present

- name: Installation isc-kea-hooks
  apt:
    deb: "/tmp/isc-kea-hooks_2.4.1-isc20231123184533_amd64.deb"
    state: present

- name: Copie du repertoire des hooks dans le repertoire /usr/local/bin/kea/hooks
  copy:
    src: /usr/lib/x86_64-linux-gnu/kea/
    dest: /usr/local/lib/kea/

- name: Copie du fichier de configuration kea-dhcp4.conf
  copy:
    src: kea-dhcp4.conf
    dest: /etc/kea/kea-dhcp4.conf

  notify: 
    - restart isc-kea-dhcp4-server

- name: Copie du fichier de configuration kea-ctrl-agent
  copy:
    src: kea-ctrl-agent.conf
    dest: /etc/kea/kea-ctrl-agent.conf
    
  notify:
    - restart isc-kea-ctrl-agent
