From b8c42d9d126c7ba10b99f77333ea98c4cb1f1a3e Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Mon, 28 Mar 2016 22:48:11 +0200 Subject: [PATCH] Small reorganisation of debian/apt --- debian/apt/files/sources.list | 27 ++++++++++++++++++--------- debian/apt/init.sls | 6 ++++++ debian/apt/map.jinja | 15 +++++++++++---- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/debian/apt/files/sources.list b/debian/apt/files/sources.list index 90cdfd5..7eca748 100644 --- a/debian/apt/files/sources.list +++ b/debian/apt/files/sources.list @@ -1,16 +1,25 @@ -# deb http://{{ debian_mirror }}/debian jessie main +{%- if loc_provider == 'hetzner' -%} +deb http://mirror.hetzner.de/debian/packages {{ debian_release }} main contrib non-free +deb http://mirror.hetzner.de/debian/security {{ debian_release }}/updates main contrib non-free -deb http://{{ debian_mirror }}/debian {{ debian_release }} main contrib non-free -deb-src http://{{ debian_mirror }}/debian {{ debian_release }} main contrib non-free +{% endif -%} -deb http://security.debian.org/ {{ debian_release }}/updates main contrib non-free -deb-src http://security.debian.org/ {{ debian_release }}/updates main contrib non-free +# deb http://{{ debian_mirror }}/debian {{ debian_release }} main -# jessie-updates, previously known as 'volatile' -deb http://{{ debian_mirror }}/debian {{ debian_release }}-updates main contrib non-free -deb-src http://{{ debian_mirror }}/debian {{ debian_release }}-updates main contrib non-free +# main {{ debian_release }} repositories +deb http://{{ debian_mirror }}/debian {{ debian_release }} main contrib non-free +deb-src http://{{ debian_mirror }}/debian {{ debian_release }} main contrib non-free -# jessie-backports, previously on backports.debian.org +# {{ debian_release }} security updates +deb http://security.debian.org/ {{ debian_release }}/updates main contrib non-free +deb-src http://security.debian.org/ {{ debian_release }}/updates main contrib non-free + +# {{ debian_release }}-updates, previously known as 'volatile' +deb http://{{ debian_mirror }}/debian {{ debian_release }}-updates main contrib non-free +deb-src http://{{ debian_mirror }}/debian {{ debian_release }}-updates main contrib non-free + +# {{ debian_release }}-backports, previously on backports.debian.org deb http://{{ debian_mirror }}/debian/ {{ debian_release }}-backports main contrib non-free deb-src http://{{ debian_mirror }}/debian/ {{ debian_release }}-backports main contrib non-free +# vim: noet ts=8 diff --git a/debian/apt/init.sls b/debian/apt/init.sls index 5eca929..be321c3 100644 --- a/debian/apt/init.sls +++ b/debian/apt/init.sls @@ -1,5 +1,8 @@ {%- from "debian/apt/map.jinja" import debian_release with context -%} {%- from "debian/apt/map.jinja" import debian_mirror with context -%} +{%- from "debian/apt/map.jinja" import loc_country with context -%} +{%- from "debian/apt/map.jinja" import loc_provider with context -%} +{%- from "debian/apt/map.jinja" import loc_dc with context -%} /etc/apt/SALTSTACK-GPG-KEY.pub: file.managed: @@ -44,6 +47,9 @@ - defaults: debian_release: {{ debian_release }} debian_mirror: {{ debian_mirror }} + loc_country: {{ loc_country }} + loc_provider: {{ loc_provider }} + loc_dc: {{ loc_dc }} /etc/apt/sources.list.d: file.directory: diff --git a/debian/apt/map.jinja b/debian/apt/map.jinja index 0646de8..1945f03 100644 --- a/debian/apt/map.jinja +++ b/debian/apt/map.jinja @@ -4,10 +4,17 @@ {% set debian_release = 'wheezy' %} {% endif %} -{% if salt['grains.get']('fqdn') == 'ns2.uhu-banane.de' %} - {% set debian_mirror = 'ftp.us.debian.org' %} -{% elif salt['grains.get']('fqdn') == 'ns3.uhu-banane.de' %} - {% set debian_mirror = 'ftp.plusline.de' %} +{% set loc_country = salt['pillar.get']('location:country', 'de') %} +{% set loc_provider = salt['pillar.get']('location:provider', 'profitbricks') %} +{% set loc_dc = salt['pillar.get']('location:dc', 'unknown') %} + +{% if loc_country == 'us' %} + {% set debian_mirror = 'ftp.us.debian.org' %} {% else %} + {% if loc_provider == 'gridscale' %} + {% set debian_mirror = 'ftp.plusline.de' %} + {% else %} {% set debian_mirror = 'ftp-stud.hs-esslingen.de' %} + {% endif %} {% endif %} + -- 2.39.5