diff --git a/extraconfig/pre_deploy/rhel-registration/rhel-registration.yaml b/extraconfig/pre_deploy/rhel-registration/rhel-registration.yaml index 845eb7a3e8..fa7bc9eea3 100644 --- a/extraconfig/pre_deploy/rhel-registration/rhel-registration.yaml +++ b/extraconfig/pre_deploy/rhel-registration/rhel-registration.yaml @@ -70,6 +70,10 @@ parameters: default: - CREATE description: Actions when the system profile will be registered, by default we only do this on CREATE of a new server, not for existing nodes. + UseSatelliteOrgMode: + type: boolean + default: false + description: When satellite is used in Organisation mode, this option must be enabled. conditions: unregister_on_delete: @@ -110,6 +114,7 @@ resources: - name: REG_HTTP_PROXY_PORT - name: REG_HTTP_PROXY_USERNAME - name: REG_HTTP_PROXY_PASSWORD + - name: REG_SAT_ORGMODE config: {get_file: scripts/rhel-registration} RHELRegistrationDeployment: @@ -142,6 +147,7 @@ resources: REG_HTTP_PROXY_PORT: {get_param: rhel_reg_http_proxy_port} REG_HTTP_PROXY_USERNAME: {get_param: rhel_reg_http_proxy_username} REG_HTTP_PROXY_PASSWORD: {get_param: rhel_reg_http_proxy_password} + REG_SAT_ORGMODE: {get_param: UseSatelliteOrgMode} RHELUnregistration: type: OS::Heat::SoftwareConfig diff --git a/extraconfig/pre_deploy/rhel-registration/scripts/rhel-registration b/extraconfig/pre_deploy/rhel-registration/scripts/rhel-registration index 309dfca100..f9397c4a48 100755 --- a/extraconfig/pre_deploy/rhel-registration/scripts/rhel-registration +++ b/extraconfig/pre_deploy/rhel-registration/scripts/rhel-registration @@ -272,8 +272,17 @@ case "${REG_METHOD:-}" in fi rpm -Uvh katello-ca-consumer-latest.noarch.rpm || true - retry subscription-manager register $opts - retry subscription-manager $repos + if [ "$REG_SAT_ORGMODE" = "True" ]; then + subscription-manager register $opts || true + subscription-manager $repos || true + if [ $(subscription-manager status |grep -c "Content Access Mode is set to Organization/Environment") = 0 ]; then + echo "Fail to register the node to satellite in Organization mode" + exit 1 + fi + else + retry subscription-manager register $opts + retry subscription-manager $repos + fi yum install -y katello-agent || true # needed for errata reporting to satellite6 katello-package-upload