From 14099df159c94790fc647a3f3d45a4ffe5dbab3e Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Tue, 22 Mar 2022 08:17:22 +0100 Subject: [PATCH] add satellite_repositories role --- roles/satellite_repositories/README.md | 28 +++++++++++++++++++ .../satellite_repositories/defaults/main.yml | 3 ++ roles/satellite_repositories/tasks/main.yml | 13 +++++++++ roles/satellite_repositories/vars/el8.yml | 9 ++++++ 4 files changed, 53 insertions(+) create mode 100644 roles/satellite_repositories/README.md create mode 100644 roles/satellite_repositories/defaults/main.yml create mode 100644 roles/satellite_repositories/tasks/main.yml create mode 100644 roles/satellite_repositories/vars/el8.yml diff --git a/roles/satellite_repositories/README.md b/roles/satellite_repositories/README.md new file mode 100644 index 0000000..b9ad34b --- /dev/null +++ b/roles/satellite_repositories/README.md @@ -0,0 +1,28 @@ +redhat.satellite_operations.satellite_repositories +================================================== + +Configure repositories required for deploying Satellite + +Role Variables +-------------- + +Required: + +- `satellite_repositories_version`: The version of Satellite to enable repositories for + +Optional: + +- `satellite_repositories_type`: Enable repositories for `satellite` (default) or `capsule` + +Example Playbooks +----------------- + +Configure repositories for Satellite 6.10: + +```yaml +- hosts: target-host + roles: + - role: redhat.satellite_operations.satellite_repositories + vars: + satellite_repositories_version: '6.13' +``` diff --git a/roles/satellite_repositories/defaults/main.yml b/roles/satellite_repositories/defaults/main.yml new file mode 100644 index 0000000..ce19ddd --- /dev/null +++ b/roles/satellite_repositories/defaults/main.yml @@ -0,0 +1,3 @@ +--- +satellite_repositories_type: satellite +satellite_repositories_version: '{{ undef(hint="You must specify the Satellite version") }}' diff --git a/roles/satellite_repositories/tasks/main.yml b/roles/satellite_repositories/tasks/main.yml new file mode 100644 index 0000000..e1f3459 --- /dev/null +++ b/roles/satellite_repositories/tasks/main.yml @@ -0,0 +1,13 @@ +--- +- name: Check that necessary variables are defined + assert: + that: + - satellite_repositories_version is defined + +- name: Set OS version dependent variables + include_vars: "el{{ ansible_distribution_major_version }}.yml" + +- name: Configure repositories + community.general.rhsm_repository: + name: "{{ satellite_base_repositories + satellite_server_repositories }}" + purge: true diff --git a/roles/satellite_repositories/vars/el8.yml b/roles/satellite_repositories/vars/el8.yml new file mode 100644 index 0000000..987d094 --- /dev/null +++ b/roles/satellite_repositories/vars/el8.yml @@ -0,0 +1,9 @@ +--- +satellite_base_repositories: + - rhel-8-for-x86_64-baseos-rpms + - rhel-8-for-x86_64-appstream-rpms + - satellite-maintenance-{{ satellite_repositories_version }}-for-rhel-8-x86_64-rpms +satellite_server_repositories: + - satellite-{{ satellite_repositories_version }}-for-rhel-8-x86_64-rpms +satellite_capsule_repositories: + - satellite-capsule-{{ satellite_repositories_version }}-for-rhel-8-x86_64-rpms