forked from kubernetes-sigs/kubespray
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RHEL support subscription registration (kubernetes-sigs#6572)
- Loading branch information
1 parent
bd801de
commit eb16986
Showing
13 changed files
with
169 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Red Hat Enterprise Linux (RHEL) | ||
|
||
## RHEL Support Subscription Registration | ||
|
||
In order to install packages via yum or dnf, RHEL 7/8 hosts are required to be registered for a valid Red Hat support subscription. | ||
|
||
You can apply for a 1-year Development support subscription by creating a [Red Hat Developers](https://developers.redhat.com/) account. Be aware though that as the Red Hat Developers subscription is limited to only 1 year, it should not be used to register RHEL 7/8 hosts provisioned in Production environments. | ||
|
||
Once you have a Red Hat support account, simply add the credentials to the Ansible inventory parameters `rh_subscription_username` and `rh_subscription_password` prior to deploying Kubespray. If your company has a Corporate Red Hat support account, then obtain an **Organization ID** and **Activation Key**, and add these to the Ansible inventory parameters `rh_subscription_org_id` and `rh_subscription_activation_key` instead of using your Red Hat support account credentials. | ||
|
||
```ini | ||
rh_subscription_username: "" | ||
rh_subscription_password: "" | ||
# rh_subscription_org_id: "" | ||
# rh_subscription_activation_key: "" | ||
``` | ||
|
||
Either the Red Hat support account username/password, or Organization ID/Activation Key combination must be specified in the Ansible inventory in order for the Red Hat subscription registration to complete successfully during the deployment of Kubespray. | ||
|
||
Update the Ansible inventory parameters `rh_subscription_usage`, `rh_subscription_role` and `rh_subscription_sla` if necessary to suit your specific requirements. | ||
|
||
```ini | ||
rh_subscription_usage: "Development" | ||
rh_subscription_role: "Red Hat Enterprise Server" | ||
rh_subscription_sla: "Self-Support" | ||
``` | ||
|
||
If the RHEL 7/8 hosts are already registered to a valid Red Hat support subscription via an alternative configuration management approach prior to the deployment of Kubespray, the successful RHEL `subscription-manager` status check will simply result in the RHEL subscription registration tasks being skipped. | ||
|
||
## RHEL 8 | ||
|
||
RHEL 8 ships only with iptables-nft (ie without iptables-legacy) | ||
The only tested configuration for now is using Calico CNI | ||
You need to use K8S 1.17+ and to add `calico_iptables_backend: "NFT"` to your configuration | ||
|
||
If you have containers that are using iptables in the host network namespace (`hostNetwork=true`), | ||
you need to ensure they are using iptables-nft. | ||
An example how k8s do the autodetection can be found [in this PR](https://github.com/kubernetes/kubernetes/pull/82966) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
- name: RHEL auto-attach subscription | ||
command: /sbin/subscription-manager attach --auto | ||
become: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
--- | ||
- name: Gather host facts to get ansible_distribution_version ansible_distribution_major_version | ||
setup: | ||
gather_subset: '!all' | ||
filter: ansible_distribution_*version | ||
|
||
- name: Check RHEL subscription-manager status | ||
command: /sbin/subscription-manager status | ||
register: rh_subscription_status | ||
changed_when: "rh_subscription_status != 0" | ||
ignore_errors: true | ||
become: true | ||
|
||
- name: RHEL subscription Organization ID/Activation Key registration | ||
redhat_subscription: | ||
state: present | ||
org_id: "{{ rh_subscription_org_id }}" | ||
activationkey: "{{ rh_subscription_activation_key }}" | ||
auto_attach: true | ||
force_register: true | ||
syspurpose: | ||
usage: "{{ rh_subscription_usage }}" | ||
role: "{{ rh_subscription_role }}" | ||
service_level_agreement: "{{ rh_subscription_sla }}" | ||
sync: true | ||
notify: RHEL auto-attach subscription | ||
ignore_errors: true | ||
become: true | ||
when: | ||
- rh_subscription_org_id is defined | ||
- rh_subscription_status.changed | ||
|
||
- name: RHEL subscription Username/Password registration | ||
redhat_subscription: | ||
state: present | ||
username: "{{ rh_subscription_username }}" | ||
password: "{{ rh_subscription_password }}" | ||
auto_attach: true | ||
force_register: true | ||
syspurpose: | ||
usage: "{{ rh_subscription_usage }}" | ||
role: "{{ rh_subscription_role }}" | ||
service_level_agreement: "{{ rh_subscription_sla }}" | ||
sync: true | ||
notify: RHEL auto-attach subscription | ||
ignore_errors: true | ||
become: true | ||
when: | ||
- rh_subscription_username is defined | ||
- rh_subscription_status.changed | ||
|
||
- name: Check presence of fastestmirror.conf | ||
stat: | ||
path: /etc/yum/pluginconf.d/fastestmirror.conf | ||
register: fastestmirror | ||
|
||
# the fastestmirror plugin can actually slow down Ansible deployments | ||
- name: Disable fastestmirror plugin if requested | ||
lineinfile: | ||
dest: /etc/yum/pluginconf.d/fastestmirror.conf | ||
regexp: "^enabled=.*" | ||
line: "enabled=0" | ||
state: present | ||
become: true | ||
when: | ||
- fastestmirror.stat.exists | ||
- not centos_fastestmirror_enabled | ||
|
||
- name: Add proxy to /etc/yum.conf if http_proxy is defined | ||
ini_file: | ||
path: "/etc/yum.conf" | ||
section: main | ||
option: proxy | ||
value: "{{ http_proxy | default(omit) }}" | ||
state: "{{ http_proxy | default(False) | ternary('present', 'absent') }}" | ||
no_extra_spaces: true | ||
become: true | ||
|
||
# libselinux-python is required on SELinux enabled hosts | ||
# See https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements | ||
- name: Install libselinux python package | ||
package: | ||
name: "{{ ( (ansible_distribution_major_version | int) < 8) | ternary('libselinux-python','python3-libselinux') }}" | ||
state: present | ||
become: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters