# squid.yml
---
- hosts: adm
  vars:
    - proxy_port: 8080
    - proxy_mem: 128
    - proxy_localnet: "192.168.0.0/24"

  tasks:
    - name: 1. Installe le proxy Squid sur la machine Infra.
      apt:
        name: squid
        state: present

# Uncomment this on FIRST RUN, comment afterwards !
#    - name: 2. Récupère le fichier squid.conf.
#      ansible.builtin.fetch:
#        src: /etc/squid/squid.conf
#        dest: squid.conf.j2
#        flat: yes

    - name: 3. Envoie squid.conf
      template:
        src: squid.conf.j2
        dest: /etc/squid/squid.conf
      notify: Restart squid
  
  handlers:
    - name: Restart squid
      service: 
        name: squid
        state: restarted
