---
  # --------------------------------------------------- 
  # configuration réseau
  # ---------------------------------------------------
  
  - name: Vérification de l enregistrement DNS
    command: nslookup {{ ansible_hostname }}
    register: ns
    ignore_errors: True
    tags: etchosts
  
  - name: Ajout du host dans /etc/hosts si absent
    lineinfile: dest=/etc/hosts regexp='.*{{ ansible_fqdn }}$' 
                line="{{ ansible_default_ipv4.address }} {{ ansible_hostname }} {{ ansible_fqdn }}" 
                state=present
    # when: "'find {{ ansible_hostname }}: NXDOMAIN' in ns.stdout"
    tags: etchosts
  
  - name: Modification resolv.conf pour ajouter attempts et timeout
    lineinfile: dest=/etc/resolv.conf line="{{ item.line }}"
    with_items:
     - { line: "options attempts:2" }
     - { line: "options timeout:1" }
  
  - name: Desactivation de IP v6
    lineinfile: dest=/etc/sysconfig/network line="{{ item.line }}"
    with_items:
     - { line: "NETWORKING_IPV6=no" }
     - { line: "IPV6INIT=no" }

  - name: desactivation permanente
    copy: src=desactivation_ipv6.conf dest=/etc/modprobe.d/desactivation_ipv6.conf
