Merge "Create configure-mirrors role"
This commit is contained in:
commit
0f25a81735
@ -6,6 +6,10 @@
|
||||
gather_subset:
|
||||
- "!all"
|
||||
roles:
|
||||
- role: configure-mirrors
|
||||
# TODO(mordred) When we have site-local variables, these should go there
|
||||
mirror_host: "mirror.{{ nodepool.region | lower }}.{{ nodepool.provider | lower }}.openstack.org"
|
||||
mirror_domain: openstack.org
|
||||
- role: validate-host
|
||||
# TODO(mordred) When we have site-local variables, these should go there
|
||||
zuul_traceroute_host: git.openstack.org
|
||||
|
1
roles/configure-mirrors/README.rst
Normal file
1
roles/configure-mirrors/README.rst
Normal file
@ -0,0 +1 @@
|
||||
An ansible role to configure mirrors for common services
|
2
roles/configure-mirrors/defaults/main.yaml
Normal file
2
roles/configure-mirrors/defaults/main.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
mirror_host: mirror.example.org
|
||||
pypi_mirror: "http://{{ mirror_host }}/pypi/simple"
|
@ -0,0 +1,4 @@
|
||||
# This file is generated by Ansible
|
||||
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
|
||||
#
|
||||
APT::Get::AllowUnauthenticated "true";
|
2
roles/configure-mirrors/tasks/main.yaml
Normal file
2
roles/configure-mirrors/tasks/main.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
- include: mirror.yaml
|
||||
when: mirror_host is defined
|
27
roles/configure-mirrors/tasks/mirror.yaml
Normal file
27
roles/configure-mirrors/tasks/mirror.yaml
Normal file
@ -0,0 +1,27 @@
|
||||
- name: Include OS-specific variables
|
||||
include_vars: "{{ ansible_distribution | lower }}.yaml"
|
||||
|
||||
- name: Install /etc/pip.conf configuration
|
||||
become: yes
|
||||
template:
|
||||
dest: /etc/pip.conf
|
||||
group: root
|
||||
mode: 0644
|
||||
owner: root
|
||||
src: etc/pip.conf.j2
|
||||
|
||||
- name: Install .pydistutils.cfg configuration in homedir
|
||||
template:
|
||||
dest: ~/.pydistutils.cfg
|
||||
mode: 0644
|
||||
src: .pydistutils.cfg.j2
|
||||
|
||||
- name: Setup distro specific packaging mirrors.
|
||||
include: "packages/{{ ansible_distribution | lower }}.yaml"
|
||||
|
||||
# Make sure OS does not have a stale package cache.
|
||||
- name: Update apt cache
|
||||
become: yes
|
||||
apt:
|
||||
update_cache: yes
|
||||
when: ansible_os_family == 'Debian'
|
17
roles/configure-mirrors/tasks/packages/ubuntu.yaml
Normal file
17
roles/configure-mirrors/tasks/packages/ubuntu.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
- name: Install /etc/apt/sources.list
|
||||
become: yes
|
||||
template:
|
||||
dest: /etc/apt/sources.list
|
||||
group: root
|
||||
mode: 0644
|
||||
owner: root
|
||||
src: etc/apt/sources.list.j2
|
||||
|
||||
- name: Install /etc/apt/apt.conf.d/99unauthenticated
|
||||
become: yes
|
||||
copy:
|
||||
dest: /etc/apt/apt.conf.d/99unauthenticated
|
||||
group: root
|
||||
mode: 0644
|
||||
owner: root
|
||||
src: etc/apt/apt.conf.d/99unauthenticated
|
8
roles/configure-mirrors/templates/.pydistutils.cfg.j2
Normal file
8
roles/configure-mirrors/templates/.pydistutils.cfg.j2
Normal file
@ -0,0 +1,8 @@
|
||||
# This file is generated by Ansible
|
||||
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
|
||||
#
|
||||
[easy_install]
|
||||
index_url = {{ pypi_mirror }}
|
||||
{% if mirror_domain is defined %}
|
||||
allow_hosts = *.{{ mirror_domain }}
|
||||
{% endif %}
|
@ -0,0 +1,7 @@
|
||||
# This file is generated by Ansible
|
||||
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
|
||||
#
|
||||
deb {{ package_mirror }} {{ ansible_distribution_release }} main universe
|
||||
deb {{ package_mirror }} {{ ansible_distribution_release }}-updates main universe
|
||||
deb {{ package_mirror }} {{ ansible_distribution_release }}-backports main universe
|
||||
deb {{ package_mirror }} {{ ansible_distribution_release }}-security main universe
|
8
roles/configure-mirrors/templates/etc/pip.conf.j2
Normal file
8
roles/configure-mirrors/templates/etc/pip.conf.j2
Normal file
@ -0,0 +1,8 @@
|
||||
# This file is generated by Ansible
|
||||
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
|
||||
#
|
||||
[global]
|
||||
timeout = 60
|
||||
index-url = {{ pypi_mirror }}
|
||||
trusted-host = {{ mirror_host }}
|
||||
extra-index-url = {{ wheel_mirror }}
|
2
roles/configure-mirrors/vars/ubuntu.yaml
Normal file
2
roles/configure-mirrors/vars/ubuntu.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
wheel_mirror: "http://{{ mirror_host }}/wheel/{{ ansible_distribution | lower }}-{{ ansible_distribution_version }}-{{ ansible_architecture | lower }}"
|
||||
package_mirror: "http://{{ mirror_host }}/ubuntu"
|
Loading…
Reference in New Issue
Block a user