From 2462d163226a8a1b779e9383c0fb16bed3bff32c Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 15 Oct 2019 15:52:53 +1100 Subject: [PATCH] configure-mirrors: make separate template directories for each platform This keeps each platform's "/etc" template files in a separate top-level directory. Additionally, we add a distro major version match to the task import and rename centos7 (in preparation for centos8). Change-Id: If65d51a27e30311b1da20522afb6dbce7ee6cf35 --- roles/configure-mirrors/tasks/mirror.yaml | 2 ++ .../tasks/mirror/{CentOS.yaml => CentOS-7.yaml} | 2 +- roles/configure-mirrors/tasks/mirror/Debian.yaml | 2 +- roles/configure-mirrors/tasks/mirror/Fedora.yaml | 2 +- roles/configure-mirrors/tasks/mirror/Suse.yaml | 4 ++-- roles/configure-mirrors/tasks/mirror/Ubuntu.yaml | 2 +- .../{ => apt}/etc/apt/apt.conf.d/99unauthenticated.j2 | 0 .../{ => apt}/etc/apt/sources.list.d/backports.list.j2 | 0 .../{ => apt}/etc/apt/sources.list.d/default.list.j2 | 0 .../{ => apt}/etc/apt/sources.list.d/security.list.j2 | 0 .../{ => apt}/etc/apt/sources.list.d/updates.list.j2 | 0 .../templates/{ => apt}/etc/apt/sources.list.j2 | 0 .../{ => centos7}/etc/yum.repos.d/CentOS-Base.repo.j2 | 0 .../templates/{ => centos7}/etc/yum.repos.d/epel.repo.j2 | 0 .../{ => fedora}/etc/yum.repos.d/fedora-updates.repo.j2 | 0 .../templates/{ => fedora}/etc/yum.repos.d/fedora.repo.j2 | 0 .../templates/{ => suse}/etc/zypp/repos.d/repo-oss.repo.j2 | 0 .../templates/{ => suse}/etc/zypp/repos.d/repo-update.repo.j2 | 0 18 files changed, 8 insertions(+), 6 deletions(-) rename roles/configure-mirrors/tasks/mirror/{CentOS.yaml => CentOS-7.yaml} (95%) rename roles/configure-mirrors/templates/{ => apt}/etc/apt/apt.conf.d/99unauthenticated.j2 (100%) rename roles/configure-mirrors/templates/{ => apt}/etc/apt/sources.list.d/backports.list.j2 (100%) rename roles/configure-mirrors/templates/{ => apt}/etc/apt/sources.list.d/default.list.j2 (100%) rename roles/configure-mirrors/templates/{ => apt}/etc/apt/sources.list.d/security.list.j2 (100%) rename roles/configure-mirrors/templates/{ => apt}/etc/apt/sources.list.d/updates.list.j2 (100%) rename roles/configure-mirrors/templates/{ => apt}/etc/apt/sources.list.j2 (100%) rename roles/configure-mirrors/templates/{ => centos7}/etc/yum.repos.d/CentOS-Base.repo.j2 (100%) rename roles/configure-mirrors/templates/{ => centos7}/etc/yum.repos.d/epel.repo.j2 (100%) rename roles/configure-mirrors/templates/{ => fedora}/etc/yum.repos.d/fedora-updates.repo.j2 (100%) rename roles/configure-mirrors/templates/{ => fedora}/etc/yum.repos.d/fedora.repo.j2 (100%) rename roles/configure-mirrors/templates/{ => suse}/etc/zypp/repos.d/repo-oss.repo.j2 (100%) rename roles/configure-mirrors/templates/{ => suse}/etc/zypp/repos.d/repo-update.repo.j2 (100%) diff --git a/roles/configure-mirrors/tasks/mirror.yaml b/roles/configure-mirrors/tasks/mirror.yaml index f550da36e..cf5505a84 100644 --- a/roles/configure-mirrors/tasks/mirror.yaml +++ b/roles/configure-mirrors/tasks/mirror.yaml @@ -7,6 +7,7 @@ - name: Include OS-specific variables include_vars: "{{ item }}" with_first_found: + - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml" - "{{ ansible_distribution }}.{{ ansible_architecture }}.yaml" - "{{ ansible_distribution }}.yaml" - "{{ ansible_os_family }}.yaml" @@ -25,6 +26,7 @@ include: "{{ item }}" static: no with_first_found: + - "mirror/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml" - "mirror/{{ ansible_distribution }}.yaml" - "mirror/{{ ansible_os_family }}.yaml" - "mirror/default.yaml" diff --git a/roles/configure-mirrors/tasks/mirror/CentOS.yaml b/roles/configure-mirrors/tasks/mirror/CentOS-7.yaml similarity index 95% rename from roles/configure-mirrors/tasks/mirror/CentOS.yaml rename to roles/configure-mirrors/tasks/mirror/CentOS-7.yaml index 68d6ba6e5..38847e92e 100644 --- a/roles/configure-mirrors/tasks/mirror/CentOS.yaml +++ b/roles/configure-mirrors/tasks/mirror/CentOS-7.yaml @@ -5,7 +5,7 @@ group: root mode: 0644 owner: root - src: "{{ item }}.j2" + src: "centos7/{{ item }}.j2" with_items: - etc/yum.repos.d/CentOS-Base.repo - etc/yum.repos.d/epel.repo diff --git a/roles/configure-mirrors/tasks/mirror/Debian.yaml b/roles/configure-mirrors/tasks/mirror/Debian.yaml index 7d72205a4..169773f1f 100644 --- a/roles/configure-mirrors/tasks/mirror/Debian.yaml +++ b/roles/configure-mirrors/tasks/mirror/Debian.yaml @@ -5,7 +5,7 @@ group: root mode: 0644 owner: root - src: "{{ item }}.j2" + src: "apt/{{ item }}.j2" with_items: - etc/apt/sources.list.d/default.list - etc/apt/sources.list.d/updates.list diff --git a/roles/configure-mirrors/tasks/mirror/Fedora.yaml b/roles/configure-mirrors/tasks/mirror/Fedora.yaml index 778c87457..fcf664646 100644 --- a/roles/configure-mirrors/tasks/mirror/Fedora.yaml +++ b/roles/configure-mirrors/tasks/mirror/Fedora.yaml @@ -5,7 +5,7 @@ group: root mode: 0644 owner: root - src: "{{ item }}.j2" + src: "fedora/{{ item }}.j2" with_items: - etc/yum.repos.d/fedora.repo - etc/yum.repos.d/fedora-updates.repo diff --git a/roles/configure-mirrors/tasks/mirror/Suse.yaml b/roles/configure-mirrors/tasks/mirror/Suse.yaml index 3df34a51e..8b0fa06db 100644 --- a/roles/configure-mirrors/tasks/mirror/Suse.yaml +++ b/roles/configure-mirrors/tasks/mirror/Suse.yaml @@ -15,7 +15,7 @@ group: root mode: 0644 owner: root - src: "{{ item }}.j2" + src: "suse/{{ item }}.j2" with_items: - etc/zypp/repos.d/repo-oss.repo notify: @@ -28,7 +28,7 @@ group: root mode: 0644 owner: root - src: etc/zypp/repos.d/repo-update.repo.j2 + src: suse/etc/zypp/repos.d/repo-update.repo.j2 notify: - Update zypper cache when: not ansible_distribution | search("Tumbleweed") diff --git a/roles/configure-mirrors/tasks/mirror/Ubuntu.yaml b/roles/configure-mirrors/tasks/mirror/Ubuntu.yaml index eb68a8cd2..8356f53af 100644 --- a/roles/configure-mirrors/tasks/mirror/Ubuntu.yaml +++ b/roles/configure-mirrors/tasks/mirror/Ubuntu.yaml @@ -5,7 +5,7 @@ group: root mode: 0644 owner: root - src: "{{ item }}.j2" + src: "apt/{{ item }}.j2" with_items: - etc/apt/sources.list - etc/apt/apt.conf.d/99unauthenticated diff --git a/roles/configure-mirrors/templates/etc/apt/apt.conf.d/99unauthenticated.j2 b/roles/configure-mirrors/templates/apt/etc/apt/apt.conf.d/99unauthenticated.j2 similarity index 100% rename from roles/configure-mirrors/templates/etc/apt/apt.conf.d/99unauthenticated.j2 rename to roles/configure-mirrors/templates/apt/etc/apt/apt.conf.d/99unauthenticated.j2 diff --git a/roles/configure-mirrors/templates/etc/apt/sources.list.d/backports.list.j2 b/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/backports.list.j2 similarity index 100% rename from roles/configure-mirrors/templates/etc/apt/sources.list.d/backports.list.j2 rename to roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/backports.list.j2 diff --git a/roles/configure-mirrors/templates/etc/apt/sources.list.d/default.list.j2 b/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/default.list.j2 similarity index 100% rename from roles/configure-mirrors/templates/etc/apt/sources.list.d/default.list.j2 rename to roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/default.list.j2 diff --git a/roles/configure-mirrors/templates/etc/apt/sources.list.d/security.list.j2 b/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/security.list.j2 similarity index 100% rename from roles/configure-mirrors/templates/etc/apt/sources.list.d/security.list.j2 rename to roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/security.list.j2 diff --git a/roles/configure-mirrors/templates/etc/apt/sources.list.d/updates.list.j2 b/roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/updates.list.j2 similarity index 100% rename from roles/configure-mirrors/templates/etc/apt/sources.list.d/updates.list.j2 rename to roles/configure-mirrors/templates/apt/etc/apt/sources.list.d/updates.list.j2 diff --git a/roles/configure-mirrors/templates/etc/apt/sources.list.j2 b/roles/configure-mirrors/templates/apt/etc/apt/sources.list.j2 similarity index 100% rename from roles/configure-mirrors/templates/etc/apt/sources.list.j2 rename to roles/configure-mirrors/templates/apt/etc/apt/sources.list.j2 diff --git a/roles/configure-mirrors/templates/etc/yum.repos.d/CentOS-Base.repo.j2 b/roles/configure-mirrors/templates/centos7/etc/yum.repos.d/CentOS-Base.repo.j2 similarity index 100% rename from roles/configure-mirrors/templates/etc/yum.repos.d/CentOS-Base.repo.j2 rename to roles/configure-mirrors/templates/centos7/etc/yum.repos.d/CentOS-Base.repo.j2 diff --git a/roles/configure-mirrors/templates/etc/yum.repos.d/epel.repo.j2 b/roles/configure-mirrors/templates/centos7/etc/yum.repos.d/epel.repo.j2 similarity index 100% rename from roles/configure-mirrors/templates/etc/yum.repos.d/epel.repo.j2 rename to roles/configure-mirrors/templates/centos7/etc/yum.repos.d/epel.repo.j2 diff --git a/roles/configure-mirrors/templates/etc/yum.repos.d/fedora-updates.repo.j2 b/roles/configure-mirrors/templates/fedora/etc/yum.repos.d/fedora-updates.repo.j2 similarity index 100% rename from roles/configure-mirrors/templates/etc/yum.repos.d/fedora-updates.repo.j2 rename to roles/configure-mirrors/templates/fedora/etc/yum.repos.d/fedora-updates.repo.j2 diff --git a/roles/configure-mirrors/templates/etc/yum.repos.d/fedora.repo.j2 b/roles/configure-mirrors/templates/fedora/etc/yum.repos.d/fedora.repo.j2 similarity index 100% rename from roles/configure-mirrors/templates/etc/yum.repos.d/fedora.repo.j2 rename to roles/configure-mirrors/templates/fedora/etc/yum.repos.d/fedora.repo.j2 diff --git a/roles/configure-mirrors/templates/etc/zypp/repos.d/repo-oss.repo.j2 b/roles/configure-mirrors/templates/suse/etc/zypp/repos.d/repo-oss.repo.j2 similarity index 100% rename from roles/configure-mirrors/templates/etc/zypp/repos.d/repo-oss.repo.j2 rename to roles/configure-mirrors/templates/suse/etc/zypp/repos.d/repo-oss.repo.j2 diff --git a/roles/configure-mirrors/templates/etc/zypp/repos.d/repo-update.repo.j2 b/roles/configure-mirrors/templates/suse/etc/zypp/repos.d/repo-update.repo.j2 similarity index 100% rename from roles/configure-mirrors/templates/etc/zypp/repos.d/repo-update.repo.j2 rename to roles/configure-mirrors/templates/suse/etc/zypp/repos.d/repo-update.repo.j2