Setup httpredir/tor mirrors for Debian Jessie
By default use only httpredir mirrors. Make tor transport configurable as well. W/a apt cache update issues Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
parent
15aec7cd87
commit
3b9097240a
5 changed files with 42 additions and 1 deletions
|
@ -69,12 +69,18 @@
|
||||||
- "/opt/cni/bin"
|
- "/opt/cni/bin"
|
||||||
when: kube_network_plugin in ["calico", "weave"] and "{{ inventory_hostname in groups['k8s-cluster'] }}"
|
when: kube_network_plugin in ["calico", "weave"] and "{{ inventory_hostname in groups['k8s-cluster'] }}"
|
||||||
|
|
||||||
|
- include: setup_jessie_mirrors.yaml
|
||||||
|
when: ansible_distribution == "Debian" and ansible_distribution_release == "jessie"
|
||||||
|
|
||||||
|
- include: update_apt_cache.yaml
|
||||||
|
when: ansible_pkg_mgr == 'apt'
|
||||||
|
|
||||||
- name: Update package management cache (YUM)
|
- name: Update package management cache (YUM)
|
||||||
yum: update_cache=yes name='*'
|
yum: update_cache=yes name='*'
|
||||||
when: ansible_pkg_mgr == 'yum'
|
when: ansible_pkg_mgr == 'yum'
|
||||||
|
|
||||||
- name: Install latest version of python-apt for Debian distribs
|
- name: Install latest version of python-apt for Debian distribs
|
||||||
apt: name=python-apt state=latest update_cache=yes cache_valid_time=3600
|
apt: name=python-apt state=latest
|
||||||
when: ansible_os_family == "Debian"
|
when: ansible_os_family == "Debian"
|
||||||
|
|
||||||
- name: Install python-dnf for latest RedHat versions
|
- name: Install python-dnf for latest RedHat versions
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
- name: install tor transport
|
||||||
|
apt: name=apt-transport-tor
|
||||||
|
when: use_apt_tor
|
||||||
|
|
||||||
|
- name: switch mirrors
|
||||||
|
template:
|
||||||
|
src: apt-repos.j2
|
||||||
|
dest: /etc/apt/sources.list
|
5
roles/kubernetes/preinstall/tasks/update_apt_cache.yaml
Normal file
5
roles/kubernetes/preinstall/tasks/update_apt_cache.yaml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
# w/a https://github.com/ansible/ansible-modules-core/issues/2951
|
||||||
|
- name: Update apt cache
|
||||||
|
become: true
|
||||||
|
shell: apt-get update
|
12
roles/kubernetes/preinstall/templates/apt-repos.j2
Normal file
12
roles/kubernetes/preinstall/templates/apt-repos.j2
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
{% if use_apt_tor %}
|
||||||
|
deb tor+http://{{onion_main}}/debian jessie main
|
||||||
|
deb tor+http://{{onion_updates}}/debian jessie-updates main
|
||||||
|
deb tor+http://{{onion_updates2}}/debian-security jessie/updates main
|
||||||
|
{% if use_backports %}deb tor+http://{{onion_backports}}/debian jessie-backports main{% endif %}
|
||||||
|
{% else %}
|
||||||
|
deb http://httpredir.debian.org/debian jessie main
|
||||||
|
deb http://httpredir.debian.org/debian jessie-updates main
|
||||||
|
{% if use_backports %}deb http://httpredir.debian.org/debian jessie-backports main{% endif %}
|
||||||
|
deb http://security.debian.org jessie/updates main
|
||||||
|
{% endif %}
|
|
@ -3,3 +3,12 @@ required_pkgs:
|
||||||
- aufs-tools
|
- aufs-tools
|
||||||
- apt-transport-https
|
- apt-transport-https
|
||||||
- software-properties-common
|
- software-properties-common
|
||||||
|
|
||||||
|
use_backports: false
|
||||||
|
|
||||||
|
# See https://onion.debian.org and https://onion.torproject.org
|
||||||
|
use_apt_tor: false
|
||||||
|
onion_main: vwakviie2ienjx6t.onion
|
||||||
|
onion_updates: vwakviie2ienjx6t.onion
|
||||||
|
onion_updates2: sgvtcaew4bxjd7ln.onion
|
||||||
|
onion_backports: vwakviie2ienjx6t.onion
|
||||||
|
|
Loading…
Reference in a new issue