Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for providing the convert2rhel repos via Satellite. #53

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ ignore: |
rules:
# 80 chars should be enough, but don't fail if a line is longer
line-length: disable
braces:
min-spaces-inside: 0
max-spaces-inside: 1
comments:
require-starting-space: true
ignore-shebangs: true
min-spaces-from-content: 1
comments-indentation: false
colons:
max-spaces-before: 0
max-spaces-after: -1
Expand All @@ -24,6 +28,9 @@ rules:
spaces: 2
indent-sequences: true
check-multi-line-strings: false
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: true
truthy:
level: error
# Allow only YAML 1.2 booleans https://redhat-cop.github.io/automation-good-practices/#_yaml_and_jinja2_syntax
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
minor_changes:
- Add support for hosting convert2rhel repo in Satellite.
- Add option to specify enablerepo parameter to yum when installing convert2rhel package.

...
2 changes: 1 addition & 1 deletion meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
requires_ansible: ">=2.14.0"
requires_ansible: ">=2.15.0"
...
2 changes: 2 additions & 0 deletions roles/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Following variables are recommended to **NOT** be changed.
| common_convert2rhel_repokey_url | String | https://www.redhat.com/security/data/fd431d51.txt | Can be used to override where to get the GPG Key for the convert2rhel repository. |
| common_convert2rhel_7_repofile_url | String | https://cdn-public.redhat.com/content/public/addon/dist/convert2rhel/server/7/7Server/x86_64/files/repofile.repo | Can be used to override where to get the RHEL 7 convert2rhel repo file. |
| common_convert2rhel_8_repofile_url | String | https://cdn-public.redhat.com/content/public/addon/dist/convert2rhel8/8/x86_64/files/repofile.repo | Can be used to override where to get the RHEL 8 convert2rhel repo file. |
| common_convert2rhel_repo_satellite | boolean | false | Set to true if the convert2rhel repo is served from Satellite. |
| common_yum_enable_repos | list of strings | unset | Optionally pass a list of repositories to enable to yum install convert2rhel. |

Dependencies
------------
Expand Down
2 changes: 2 additions & 0 deletions roles/common/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ common_centos8_repos:
common_supported_distribution: ['CentOS', 'OracleLinux', 'AlmaLinux', 'Rocky']
common_supported_major_version: ['7', '8']

common_convert2rhel_repo_satellite: false

common_convert2rhel_repokey_url: https://www.redhat.com/security/data/fd431d51.txt
common_convert2rhel_7_repofile_url: https://cdn-public.redhat.com/content/public/addon/dist/convert2rhel/server/7/7Server/x86_64/files/repofile.repo
common_convert2rhel_8_repofile_url: https://cdn-public.redhat.com/content/public/addon/dist/convert2rhel8/8/x86_64/files/repofile.repo
Expand Down
11 changes: 7 additions & 4 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
loop: "{{ common_centos8_repos }}"
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version | int == 8

- name: Setup & Install Convert2RHEL
- name: Setup Convert2RHEL repository
when: not common_convert2rhel_repo_satellite
block:
- name: Download Red Hat GPG key
ansible.builtin.get_url:
Expand All @@ -42,9 +43,10 @@
dest: "/etc/yum.repos.d/convert2rhel.repo"
mode: '0644'

- name: Install Convert2RHEL
ansible.builtin.yum:
name: convert2rhel
- name: Install Convert2RHEL
ansible.builtin.package:
name: convert2rhel
enablerepo: "{{ common_yum_enable_repos | default(omit) }}"

- name: Create temporary configuration file
ansible.builtin.tempfile:
Expand All @@ -57,4 +59,5 @@
src: configfile.j2
dest: "{{ convert2rhel_configfile.path }}"
mode: '0600'
when: not common_convert2rhel_repo_satellite
...