elnappo.apt_cacher_ng

ansible-role-apt-cacher-ng

Statut de construction Ansible Galaxy

Installe simplement et démarre apt-cacher-ng au démarrage. Pour plus d'informations sur apt-cacher-ng, rendez-vous sur https://www.unix-ag.uni-kl.de/~bloch/acng/

Exigences

Ubuntu ou Debian

Variables de rôle

  • apt_cacher_ng_port: 3142
  • apt_cacher_ng_cache_dir: /var/cache/apt-cacher-ng
  • apt_cacher_ng_setup_ufw: True Ajoute une règle ufw pour permettre apt-cacher-ng

Dépendances

Aucune.

Exemple de Playbook

- hosts: serveurs
  remote_user: root
  roles:
   - { role: elnappo.apt_cacher_ng }

Configuration du client

avec ansible

Définissez apt_proxy comme une variable d'hôte

[host:vars]
apt_proxy=http://apt.example.com:3142/

Pour tout le système :

- name: Configurer le proxy apt
  template: src=templates/apt_proxy.conf dest=/etc/apt/apt.conf.d/01proxy owner=root group=root mode=0644
    when: ansible_os_family == "Debian" and apt_proxy is defined

templates/apt_proxy.conf :

# {{ ansible_managed }}
Acquire::http { Proxy "{{ apt_proxy }}"; };
Acquire::https { Proxy "https://"; };

Seulement pour une tâche :

- apt: name=ufw state=installed
  environment:
    http_proxy: "{{ apt_proxy }}"

sans ansible

Remplacez l'IP/FQDN du serveur !

$ echo 'Acquire::http { Proxy "http://apt.example.com:3142"; };' > /etc/apt/apt.conf.d/01proxy

Importer le cache local

$ echo 'Acquire::http { Proxy "http://localhost:3142"; };' > /etc/apt/apt.conf.d/01proxy
$ apt-get update
$ apt-get autoclean
$ mkdir -p /var/cache/apt-cacher-ng/_import
$ ln -s /var/cache/apt /var/cache/apt-cacher-ng/_import/apt
$ wget "http://localhost:3142/acng-report.html?abortOnErrors=aOe&doImport=Start+Import&calcSize=cs&asNeeded=an#bottom"

Une fois l'import terminé, vous pouvez supprimer le lien symbolique avec :

$ rm /var/cache/apt-cacher-ng/_import/apt

Licence

MIT

Informations sur l'auteur

elnappo elnappo@nerdpol.io

À propos du projet

Install apt-cacher-ng

Installer
ansible-galaxy install elnappo.apt_cacher_ng
Licence
mit
Téléchargements
23.7k
Propriétaire