-
Notifications
You must be signed in to change notification settings - Fork 181
Open
Description
SUMMARY
In documentation for module activation_key it is written:
https://docs.ansible.com/ansible/latest/collections/theforeman/foreman/activation_key_module.html#ansible-collections-theforeman-foreman-activation-key-module
service_level
string
Set the service level
Choices:
"Self-Support"
"Standard"
"Premium"
I used standard and used the following ansible task:
- name: Activation Keys
tags: activation_keys
block:
- name: Ensure activation keys exist
redhat.satellite.activation_key:
server_url: "{{ satellite_server_url | d(omit) }}"
username: "{{ satellite_admin_username | d(omit) }}"
password: "{{ satellite_admin_password | d(omit) }}"
organization: "{{ satellite_organization }}"
name: "{{ item.name }}"
description: "{{ item.description | d(omit, true) }}"
lifecycle_environment: "{{ item.lifecycle_environment | d(omit, true) }}"
content_view: "{{ item.content_view | d(omit, true) }}"
release_version: "{{ item.release_version | d(omit, true) }}"
service_level: "{{ item.service_level | d(omit, true) }}"
auto_attach: "{{ item.auto_attach | d(omit, true) }}"
unlimited_hosts: "{{ item.unlimited_hosts | d(true) }}"
max_hosts: "{{ omit if (item.unlimited_hosts | bool) else item.max_hosts }}"
purpose_role: "{{ item.purpose_role | d(omit, true) }}"
purpose_usage: "{{ item.purpose_usage | d(omit, true) }}"
host_collections: "{{ item.host_collections | d(omit, true) }}"
content_overrides: "{{ item.content_overrides | d(omit, true) }}"
state: present
loop: "{{ satellite_activation_keys }}"
loop_control:
label: "{{ item.name }}"
The task failed with error:
msg: 'Failed to ensure entity state: ForemanApiException: Error while performing create on activation_keys: 500 Server Error: Internal Server Error for url: https://xxx/katello/api/activation_keys - {''displayMessage'': ''Task 459f1187-46e9-4009-a4f1-5405203b8c3c: Katello::Errors::CandlepinError: Service level "Standard" is not available to units of organization xxx.'', ''errors'': [''Task 459f1187-46e9-4009-a4f1-5405203b8c3c: Katello::Errors::CandlepinError: Service level "Standard" is not available to units of organization xxx.'']}'
failed: [localhost] (item=ak-p-rhel9) => changed=false
But the keys were created nonetheless! (same behavior when using hammer)
Now opening the keys in the webinterface I get these errors:
Danger alert:Error
Katello::Resources::Candlepin::CandlepinResource: 404 Not Found {"displayMessage":"Runtime Error RESTEASY003210: Could not find resource for full path: https://localhost:23443/candlepin/activation_keys//content_overrides at org.jboss.resteasy.core.registry.SegmentNode.match:154","requestUuid":"a812fd38-a18b-446d-9e2f-28d12d94a1c5"} (GET /candlepin/activation_keys//content_overrides)
This is all because the service level can only be one of these:
# hammer --csv --no-headers subscription list --organization-id "${ORG_ID:-1}" --fields Support
Layered
Premium
So Standard or Premium is not a choice. It depends on what the subscriptions provides.
ISSUE TYPE
- Bug Report
ANSIBLE VERSION
# ansible --version
ansible [core 2.16.14]
config file = /root/redhat_satellite-master/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.12/site-packages/ansible
ansible collection location = /root/redhat_satellite-master/collections
executable location = /bin/ansible
python version = 3.12.9 (main, Feb 4 2025, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-4)] (/usr/bin/python3.12)
jinja version = 3.1.5
libyaml = True
COLLECTION VERSION
Collection Version
----------------- -------
ansible.posix 1.6.1
community.general 9.5.7
redhat.satellite 5.3.0
KATELLO/FOREMAN VERSION
# rpm -q rubygem-katello foreman
rubygem-katello-4.16.0.2-1.el9sat.noarch
foreman-3.14.0.2-1.el9sat.noarch
STEPS TO REPRODUCE
Specify a service level that is not in the list returned by this command:
# hammer --csv --no-headers subscription list --organization-id "${ORG_ID:-1}" --fields Support
EXPECTED RESULTS
No keys created.
Proper error handling.
Validate service level is available.
ACTUAL RESULTS
Metadata
Metadata
Assignees
Labels
No labels