From ba6ab3e4ee5e844f9fce8b5fceb8496a8b9fd568 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 | 16 +++++++++++ roles/satellite_repositories/vars/el7.yml | 10 +++++++ roles/satellite_repositories/vars/el8.yml | 10 +++++++ .../vars/satellite_6.10.yml | 3 ++ .../vars/satellite_6.11.yml | 3 ++ 7 files changed, 73 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/el7.yml create mode 100644 roles/satellite_repositories/vars/el8.yml create mode 100644 roles/satellite_repositories/vars/satellite_6.10.yml create mode 100644 roles/satellite_repositories/vars/satellite_6.11.yml diff --git a/roles/satellite_repositories/README.md b/roles/satellite_repositories/README.md new file mode 100644 index 0000000..9c9cd9f --- /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.10' +``` 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..7e37fa9 --- /dev/null +++ b/roles/satellite_repositories/tasks/main.yml @@ -0,0 +1,16 @@ +--- +- 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: Set Satellite version dependent variables + include_vars: "satellite_{{ satellite_repositories_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/el7.yml b/roles/satellite_repositories/vars/el7.yml new file mode 100644 index 0000000..bc4bd81 --- /dev/null +++ b/roles/satellite_repositories/vars/el7.yml @@ -0,0 +1,10 @@ +--- +satellite_base_repositories: + - rhel-7-server-rpms + - rhel-server-rhscl-7-rpms + - rhel-7-server-satellite-maintenance-{{ satellite_repositories_maintenance_version }}-rpms + - rhel-7-server-ansible-{{ satellite_repositories_ansible_version }}-rpms +satellite_server_repositories: + - rhel-7-server-satellite-{{ satellite_repositories_version }}-rpms +satellite_capsule_repositories: + - rhel-7-server-satellite-capsule-{{ satellite_repositories_version }}-rpms diff --git a/roles/satellite_repositories/vars/el8.yml b/roles/satellite_repositories/vars/el8.yml new file mode 100644 index 0000000..8b78b5c --- /dev/null +++ b/roles/satellite_repositories/vars/el8.yml @@ -0,0 +1,10 @@ +--- +satellite_base_repositories: + - rhel-8-for-x86_64-baseos-rpms + - rhel-8-for-x86_64-appstream-rpms + - satellite-maintenance-{{ satellite_repositories_maintenance_version }}-for-rhel-8-x86_64-rpms + - ansible-{{ satellite_repositories_ansible_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 diff --git a/roles/satellite_repositories/vars/satellite_6.10.yml b/roles/satellite_repositories/vars/satellite_6.10.yml new file mode 100644 index 0000000..e37a9a1 --- /dev/null +++ b/roles/satellite_repositories/vars/satellite_6.10.yml @@ -0,0 +1,3 @@ +--- +satellite_repositories_ansible_version: '2.9' +satellite_repositories_maintenance_version: '6' diff --git a/roles/satellite_repositories/vars/satellite_6.11.yml b/roles/satellite_repositories/vars/satellite_6.11.yml new file mode 100644 index 0000000..399a466 --- /dev/null +++ b/roles/satellite_repositories/vars/satellite_6.11.yml @@ -0,0 +1,3 @@ +--- +satellite_repositories_ansible_version: '2.9' +satellite_repositories_maintenance_version: '6.11'