Create configure-mirrors role

This will be used to replace our current confgure_mirror.sh script
that we today as a ready-script in nodepool.

This only adds support for ubuntu today. As we move forward and
configuration openstack-infra from JJB to ansible, we'll need to add
more distros.

Attach the role to the unittests base job for now. It should ultimately
be attached to the base job, but adding it to the unittests job lets us
test it more easily.

Co-Authored-By: Monty Taylor <mordred@inaugust.com>
Change-Id: I9bfa28c87390c09bb2c4cd0de6ce4c7890f8d81a
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2017-07-11 09:50:16 -05:00
parent 2dfb08a49e
commit 8638ac3e2a
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
11 changed files with 82 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1 @@
An ansible role to configure mirrors for common services

View File

@ -0,0 +1,2 @@
mirror_host: mirror.example.org
pypi_mirror: "http://{{ mirror_host }}/pypi/simple"

View File

@ -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";

View File

@ -0,0 +1,2 @@
- include: mirror.yaml
when: mirror_host is defined

View 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'

View 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

View 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 %}

View File

@ -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

View 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 }}

View 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"