Streamline configure-mirrors and Ubuntu repository setup
- Improve the structure to support multiple distributions - Use one task to set up the different repository files - Use handler to update the apt cache Change-Id: I90933164cbca9d230cebeb3e2e1263c7806db840
This commit is contained in:
parent
d55de6e54b
commit
d45cfa287d
@ -1 +1,2 @@
|
||||
pypi_mirror: "http://{{ mirror_fqdn }}/pypi/simple"
|
||||
wheel_mirror: "http://{{ mirror_fqdn }}/wheel/{{ ansible_distribution | lower }}-{{ ansible_distribution_version }}-{{ ansible_architecture | lower }}"
|
||||
|
@ -1,4 +0,0 @@
|
||||
# This file is generated by Ansible
|
||||
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
|
||||
#
|
||||
APT::Get::AllowUnauthenticated "true";
|
5
roles/configure-mirrors/handlers/main.yaml
Normal file
5
roles/configure-mirrors/handlers/main.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
# The apt module can not be used for this since it installs python-apt
|
||||
# which can not work until this command fixes the cache.
|
||||
- name: Update apt cache
|
||||
become: yes
|
||||
command: apt-get update
|
@ -1,2 +1,4 @@
|
||||
- include: mirror.yaml
|
||||
- name: Set up infrastructure mirrors
|
||||
include: mirror.yaml
|
||||
when: mirror_fqdn is defined
|
||||
static: no
|
||||
|
@ -1,6 +1,3 @@
|
||||
- name: Include OS-specific variables
|
||||
include_vars: "{{ ansible_distribution | lower }}.yaml"
|
||||
|
||||
- name: Install /etc/pip.conf configuration
|
||||
become: yes
|
||||
template:
|
||||
@ -16,11 +13,17 @@
|
||||
mode: 0644
|
||||
src: .pydistutils.cfg.j2
|
||||
|
||||
- name: Setup distro specific packaging mirrors.
|
||||
include: "packages/{{ ansible_distribution | lower }}.yaml"
|
||||
- name: Include OS-specific variables
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- "{{ ansible_distribution }}.yaml"
|
||||
- "{{ ansible_os_family }}.yaml"
|
||||
- "default.yaml"
|
||||
|
||||
# Make sure OS does not have a stale package cache.
|
||||
- name: Update apt cache
|
||||
become: yes
|
||||
command: apt-get update
|
||||
when: ansible_os_family == 'Debian'
|
||||
- name: Setup distribution specific packaging mirrors
|
||||
include: "{{ item }}"
|
||||
static: no
|
||||
with_first_found:
|
||||
- "mirror/{{ ansible_distribution }}.yaml"
|
||||
- "mirror/{{ ansible_os_family }}.yaml"
|
||||
- "mirror/default.yaml"
|
||||
|
13
roles/configure-mirrors/tasks/mirror/Ubuntu.yaml
Normal file
13
roles/configure-mirrors/tasks/mirror/Ubuntu.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
- name: Install Ubuntu repository files
|
||||
become: yes
|
||||
template:
|
||||
dest: "/{{ item }}"
|
||||
group: root
|
||||
mode: 0644
|
||||
owner: root
|
||||
src: "{{ item }}.j2"
|
||||
with_items:
|
||||
- etc/apt/sources.list
|
||||
- etc/apt/apt.conf.d/99unauthenticated
|
||||
notify:
|
||||
- Update apt cache
|
6
roles/configure-mirrors/tasks/mirror/default.yaml
Normal file
6
roles/configure-mirrors/tasks/mirror/default.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
- name: Warn about unsupported distribution
|
||||
debug:
|
||||
msg: >
|
||||
WARNING: {{ ansible_distribution }} mirrors are not supported either
|
||||
by this role yet. The execution of the job will continue without setting
|
||||
up cached mirrors.
|
@ -1,17 +0,0 @@
|
||||
- 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
|
@ -0,0 +1,2 @@
|
||||
# {{ ansible_managed }}
|
||||
APT::Get::AllowUnauthenticated "true";
|
1
roles/configure-mirrors/vars/Ubuntu.yaml
Normal file
1
roles/configure-mirrors/vars/Ubuntu.yaml
Normal file
@ -0,0 +1 @@
|
||||
package_mirror: "http://{{ mirror_fqdn }}/{{ ansible_distribution | lower }}"
|
1
roles/configure-mirrors/vars/default.yaml
Normal file
1
roles/configure-mirrors/vars/default.yaml
Normal file
@ -0,0 +1 @@
|
||||
package_mirror:
|
@ -1,2 +0,0 @@
|
||||
wheel_mirror: "http://{{ mirror_fqdn }}/wheel/{{ ansible_distribution | lower }}-{{ ansible_distribution_version }}-{{ ansible_architecture | lower }}"
|
||||
package_mirror: "http://{{ mirror_fqdn }}/ubuntu"
|
Loading…
Reference in New Issue
Block a user