Adjustments to detect Satellite version/mode

1) Fail if we couldn't figure out what version of Satellite is running.
   Otherwise we end up including a playbook that doesn't exist and the
   error is misleading.

2) Change the Satellite 6 version check, to use /pulp/api/v2/status
   instead of /katello/api/ping; which seems to work better when a
   Capsule is used. This URL should work for both Satellite 6 and
   Capsule.

3) Document that rhsm_rhsm_port needs to be changed to 8443 if a capsule
   is used.

Change-Id: Ibc7c05260f01adf520f5d18f3ea8e23e266e4f6d
This commit is contained in:
Emilien Macchi 2020-07-02 11:47:44 -04:00
parent 5f65ba4a3a
commit bcda84e1c4
3 changed files with 10 additions and 2 deletions

View File

@ -30,7 +30,7 @@ Role Variables
| `rhsm_repos` | `[]` | The list of repositories to enable or disable. |
| `rhsm_repos_state` | `[undefined]` | The state of all repos in `rhsm_repos`. The module default is `enabled`.|
| `rhsm_repos_purge` | `[undefined]` | Whether or not to disable repos not specified in `rhsm_repos`. The module default is `False`. |
| `rhsm_rhsm_port` | `443` | Port to use when connecting to subscription server. |
| `rhsm_rhsm_port` | `443` | Port to use when connecting to subscription server. Must be 8443 if a capsule is used otherwise 443 for Satellite or RHN. |
| `rhsm_server_hostname` | `subscription.rhn.redhat.com` | FQDN of subscription server. |
| `rhsm_server_prefix` | `/subscription` or `/rhsm` | RHS server prefix. `/subscription` when using registering via `portal`, `/rhsm` when registering via `satellite`. |
| `rhsm_insecure` | `False` | Disable certificate validation. |

View File

@ -13,6 +13,7 @@ rhsm_force_register: False
rhsm_repos: []
## /etc/rhsm/rhsm.conf settings
# Port must be changed to 8443 if registration is done against a capsule.
rhsm_rhsm_port: 443
rhsm_server_hostname: subscription.rhn.redhat.com
rhsm_server_prefix: "{{ '/rhsm' if rhsm_method == 'satellite' else '/subscription' }}"

View File

@ -10,7 +10,7 @@
- name: SATELLITE | Check for Satellite 6
uri:
url: "{{ rhsm_satellite_url }}/katello/api/ping"
url: "{{ rhsm_satellite_url }}/pulp/api/v2/status"
validate_certs: no
status_code: 200, 404
register: _sat6_check
@ -41,6 +41,13 @@
tags:
- rhsm_satellite
- name: Fail if Satellite version was not found
fail:
msg: "Satellite version was not found, you should file a bug"
when:
- rhsm_satellite_version is defined
- not (rhsm_satellite_version | length)
- name: SATELLITE | Run Satellite {{ rhsm_satellite_version }} tasks
include_tasks: satellite-{{ rhsm_satellite_version }}.yml
when: rhsm_state == 'present'