Skip to content
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
2 changes: 1 addition & 1 deletion plugins/modules/activation_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
auto_attach:
description:
- Set Auto-Attach on or off
- The C(auto_attach) parameter is deprecated since Katello 4.13 and not available after Katello 4.19
type: bool
release_version:
description:
Expand Down Expand Up @@ -187,7 +188,6 @@
override: enabled
- label: ExampleOrganization_ExampleCustomProduct_ExampleRepository
override: enabled
auto_attach: false
release_version: 7Server
service_level: Standard

Expand Down
2 changes: 0 additions & 2 deletions roles/activation_keys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ The following fields are required for an activation key but have defaults which

The following fields are optional in the sense that the server will use default values when they are omitted:

- `auto_attach`: Auto Attach behavior for the activation key. When true, it will attempt to attach a minimum of subscriptions (from the subset of assigned subscriptions on the activation key; selects from all subscriptions in the organization if none are assigned) to cover any present products on the host. When false, it will attempt to attach all subscriptions assigned on the activation key to the host at registration time. server defaults to true.
- `unlimited_hosts`: Allow an unlimited number of hosts to register with the activation key when true. When false, the `max_hosts` parameter which sets a numerical limit on the number of hosts that can be registered becomes required. server defaults to true.

The following fields are optional and will be omitted by default:
Expand Down Expand Up @@ -71,7 +70,6 @@ Define two Activation Keys. The first registers hosts in the "ACME" organization
foreman_organization: "ACME"
foreman_activation_keys:
- name: "ACME_App_Key"
auto_attach: false
subscriptions:
- name: "ACME_App"
- name: "ACME_RHEL7_Base_Test"
Expand Down
2 changes: 0 additions & 2 deletions roles/convert2rhel/tasks/activation_keys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
name: "{{ foreman_convert2rhel_key_rhel7 }}"
lifecycle_environment: "{{ foreman_convert2rhel_lifecycle_env }}"
content_view: "{{ foreman_convert2rhel_content_view }}"
auto_attach: false
when: foreman_content_rhel_enable_rhel7

- name: "Create activation key '{{ foreman_convert2rhel_key_rhel8 }}'"
Expand All @@ -95,7 +94,6 @@
name: "{{ foreman_convert2rhel_key_rhel8 }}"
lifecycle_environment: "{{ foreman_convert2rhel_lifecycle_env }}"
content_view: "{{ foreman_convert2rhel_content_view }}"
auto_attach: false
when: foreman_content_rhel_enable_rhel8

- name: "Add subscriptions to '{{ foreman_convert2rhel_key_rhel7 }}'"
Expand Down
32 changes: 0 additions & 32 deletions tests/test_playbooks/activation_key.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,38 +159,6 @@
activation_key_state: absent
expected_change: true

- name: create AK with auto_attach=true
include_tasks: tasks/activation_key.yml
vars:
activation_key_auto_attach: true
expected_change: true
- name: create AK with auto_attach=true again, no change
include_tasks: tasks/activation_key.yml
vars:
activation_key_auto_attach: true
expected_change: false
- name: remove AK with auto_attach=true
include_tasks: tasks/activation_key.yml
vars:
activation_key_state: absent
expected_change: true

- name: create AK with auto_attach=false
include_tasks: tasks/activation_key.yml
vars:
activation_key_auto_attach: false
expected_change: true
- name: create AK with auto_attach=false again, no change
include_tasks: tasks/activation_key.yml
vars:
activation_key_auto_attach: false
expected_change: false
- name: remove AK with auto_attach=false
include_tasks: tasks/activation_key.yml
vars:
activation_key_state: absent
expected_change: true

- name: create AK with unlimited_hosts=false
include_tasks: tasks/activation_key.yml
vars:
Expand Down
1 change: 0 additions & 1 deletion tests/test_playbooks/activation_keys_role.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@
foreman_activation_keys:
- name: Testkey1
- name: Testkey2
auto_attach: false
38 changes: 19 additions & 19 deletions tests/test_playbooks/fixtures/activation_key-0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ interactions:
uri: https://foreman.example.org/api/status
response:
body:
string: '{"satellite_version":"6.18.1","result":"ok","status":200,"version":"3.16.0.7","api_version":2}'
string: '{"result":"ok","status":200,"version":"3.18.0-develop","api_version":2}'
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '94'
- '71'
Content-Type:
- application/json; charset=utf-8
Foreman_api_version:
Expand All @@ -31,7 +31,7 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 3.16.0.7
- 3.18.0-develop
Keep-Alive:
- timeout=15, max=100
Referrer-Policy:
Expand Down Expand Up @@ -72,16 +72,16 @@ interactions:
body:
string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\":
4294967296,\n \"search\": \"name=\\\"Test Organization\\\"\",\n \"sort\":
{\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"label\":\"Test_Organization\",\"created_at\":\"2025-12-08
10:27:40 UTC\",\"updated_at\":\"2025-12-08 10:27:44 UTC\",\"id\":69,\"name\":\"Test
{\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"label\":\"Test_Organization\",\"created_at\":\"2025-12-13
23:32:34 UTC\",\"updated_at\":\"2025-12-13 23:32:36 UTC\",\"id\":6,\"name\":\"Test
Organization\",\"title\":\"Test Organization\",\"description\":\"A test organization\"}]\n}\n"
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '389'
- '388'
Content-Type:
- application/json; charset=utf-8
Foreman_api_version:
Expand All @@ -91,7 +91,7 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 3.16.0.7
- 3.18.0-develop
Keep-Alive:
- timeout=15, max=99
Referrer-Policy:
Expand Down Expand Up @@ -127,7 +127,7 @@ interactions:
User-Agent:
- apypie (https://github.com/Apipie/apypie)
method: GET
uri: https://foreman.example.org/katello/api/organizations/69/activation_keys?search=name%3D%22Test+Activation+Key%22&per_page=4294967296
uri: https://foreman.example.org/katello/api/organizations/6/activation_keys?search=name%3D%22Test+Activation+Key%22&per_page=4294967296
response:
body:
string: '{"total":0,"subtotal":0,"selectable":0,"page":1,"per_page":4294967296,"error":null,"search":"name=\"Test
Expand All @@ -148,9 +148,9 @@ interactions:
Foreman_current_location:
- ; ANY
Foreman_current_organization:
- 69; Test Organization
- 6; Test Organization
Foreman_version:
- 3.16.0.7
- 3.18.0-develop
Keep-Alive:
- timeout=15, max=98
Referrer-Policy:
Expand All @@ -175,7 +175,7 @@ interactions:
code: 200
message: OK
- request:
body: '{"name": "Test Activation Key", "organization_id": 69}'
body: '{"name": "Test Activation Key", "organization_id": 6}'
headers:
Accept:
- application/json;version=2
Expand All @@ -184,7 +184,7 @@ interactions:
Connection:
- keep-alive
Content-Length:
- '54'
- '53'
Content-Type:
- application/json
User-Agent:
Expand All @@ -193,10 +193,10 @@ interactions:
uri: https://foreman.example.org/katello/api/activation_keys
response:
body:
string: ' {"service_level":null,"content_overrides":[],"id":781,"name":"Test
Activation Key","description":null,"unlimited_hosts":true,"auto_attach":true,"content_view_environment_labels":"","usage_count":0,"user_id":4,"max_hosts":null,"release_version":null,"purpose_usage":null,"purpose_role":null,"organization_id":69,"organization":{"name":"Test
Organization","label":"Test_Organization","id":69},"created_at":"2025-12-08
10:28:27 UTC","updated_at":"2025-12-08 10:28:27 UTC","content_view_environments":[],"products":[],"host_collections":[],"multi_content_view_environment":false,"content_view_id":null,"content_view":null,"environment_id":null,"environment":null,"permissions":{"view_activation_keys":true,"edit_activation_keys":true,"destroy_activation_keys":true}}
string: ' {"service_level":null,"content_overrides":[],"id":22,"name":"Test
Activation Key","description":null,"unlimited_hosts":true,"content_view_environment_labels":"","usage_count":0,"user_id":4,"max_hosts":null,"release_version":null,"purpose_usage":null,"purpose_role":null,"organization_id":6,"organization":{"name":"Test
Organization","label":"Test_Organization","id":6},"created_at":"2025-12-13
23:33:47 UTC","updated_at":"2025-12-13 23:33:47 UTC","content_view_environments":[],"products":[],"host_collections":[],"multi_content_view_environment":false,"content_view_id":null,"content_view":null,"environment_id":null,"environment":null,"permissions":{"view_activation_keys":true,"edit_activation_keys":true,"destroy_activation_keys":true}}

'
headers:
Expand All @@ -205,17 +205,17 @@ interactions:
Connection:
- Keep-Alive
Content-Length:
- '765'
- '743'
Content-Type:
- application/json; charset=utf-8
Foreman_api_version:
- '2'
Foreman_current_location:
- ; ANY
Foreman_current_organization:
- 69; Test Organization
- 6; Test Organization
Foreman_version:
- 3.16.0.7
- 3.18.0-develop
Keep-Alive:
- timeout=15, max=97
Referrer-Policy:
Expand Down
46 changes: 23 additions & 23 deletions tests/test_playbooks/fixtures/activation_key-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ interactions:
uri: https://foreman.example.org/api/status
response:
body:
string: '{"satellite_version":"6.18.1","result":"ok","status":200,"version":"3.16.0.7","api_version":2}'
string: '{"result":"ok","status":200,"version":"3.18.0-develop","api_version":2}'
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '94'
- '71'
Content-Type:
- application/json; charset=utf-8
Foreman_api_version:
Expand All @@ -31,7 +31,7 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 3.16.0.7
- 3.18.0-develop
Keep-Alive:
- timeout=15, max=100
Referrer-Policy:
Expand Down Expand Up @@ -72,16 +72,16 @@ interactions:
body:
string: "{\n \"total\": 2,\n \"subtotal\": 1,\n \"page\": 1,\n \"per_page\":
4294967296,\n \"search\": \"name=\\\"Test Organization\\\"\",\n \"sort\":
{\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"label\":\"Test_Organization\",\"created_at\":\"2025-12-08
10:27:40 UTC\",\"updated_at\":\"2025-12-08 10:27:44 UTC\",\"id\":69,\"name\":\"Test
{\n \"by\": null,\n \"order\": null\n },\n \"results\": [{\"label\":\"Test_Organization\",\"created_at\":\"2025-12-13
23:32:34 UTC\",\"updated_at\":\"2025-12-13 23:32:36 UTC\",\"id\":6,\"name\":\"Test
Organization\",\"title\":\"Test Organization\",\"description\":\"A test organization\"}]\n}\n"
headers:
Cache-Control:
- max-age=0, private, must-revalidate
Connection:
- Keep-Alive
Content-Length:
- '389'
- '388'
Content-Type:
- application/json; charset=utf-8
Foreman_api_version:
Expand All @@ -91,7 +91,7 @@ interactions:
Foreman_current_organization:
- ; ANY
Foreman_version:
- 3.16.0.7
- 3.18.0-develop
Keep-Alive:
- timeout=15, max=99
Referrer-Policy:
Expand Down Expand Up @@ -127,14 +127,14 @@ interactions:
User-Agent:
- apypie (https://github.com/Apipie/apypie)
method: GET
uri: https://foreman.example.org/katello/api/organizations/69/activation_keys?search=name%3D%22Test+Activation+Key%22&per_page=4294967296
uri: https://foreman.example.org/katello/api/organizations/6/activation_keys?search=name%3D%22Test+Activation+Key%22&per_page=4294967296
response:
body:
string: '{"total":1,"subtotal":1,"selectable":1,"page":1,"per_page":4294967296,"error":null,"search":"name=\"Test
Activation Key\"","sort":{"by":"name","order":"asc"},"results":[{"id":781,"name":"Test
Activation Key","description":null,"unlimited_hosts":true,"auto_attach":true,"content_view_environment_labels":"","usage_count":0,"user_id":4,"max_hosts":null,"release_version":null,"purpose_usage":null,"purpose_role":null,"organization_id":69,"organization":{"name":"Test
Organization","label":"Test_Organization","id":69},"created_at":"2025-12-08
10:28:27 UTC","updated_at":"2025-12-08 10:28:27 UTC","content_view_environments":[],"products":[],"host_collections":[],"multi_content_view_environment":false,"content_view_id":null,"content_view":null,"environment_id":null,"environment":null,"permissions":{"view_activation_keys":true,"edit_activation_keys":true,"destroy_activation_keys":true}}]}
Activation Key\"","sort":{"by":"name","order":"asc"},"results":[{"id":22,"name":"Test
Activation Key","description":null,"unlimited_hosts":true,"content_view_environment_labels":"","usage_count":0,"user_id":4,"max_hosts":null,"release_version":null,"purpose_usage":null,"purpose_role":null,"organization_id":6,"organization":{"name":"Test
Organization","label":"Test_Organization","id":6},"created_at":"2025-12-13
23:33:47 UTC","updated_at":"2025-12-13 23:33:47 UTC","content_view_environments":[],"products":[],"host_collections":[],"multi_content_view_environment":false,"content_view_id":null,"content_view":null,"environment_id":null,"environment":null,"permissions":{"view_activation_keys":true,"edit_activation_keys":true,"destroy_activation_keys":true}}]}

'
headers:
Expand All @@ -143,17 +143,17 @@ interactions:
Connection:
- Keep-Alive
Content-Length:
- '890'
- '868'
Content-Type:
- application/json; charset=utf-8
Foreman_api_version:
- '2'
Foreman_current_location:
- ; ANY
Foreman_current_organization:
- 69; Test Organization
- 6; Test Organization
Foreman_version:
- 3.16.0.7
- 3.18.0-develop
Keep-Alive:
- timeout=15, max=98
Referrer-Policy:
Expand Down Expand Up @@ -189,13 +189,13 @@ interactions:
User-Agent:
- apypie (https://github.com/Apipie/apypie)
method: GET
uri: https://foreman.example.org/katello/api/activation_keys/781?organization_id=69
uri: https://foreman.example.org/katello/api/activation_keys/22?organization_id=6
response:
body:
string: ' {"service_level":null,"content_overrides":[],"id":781,"name":"Test
Activation Key","description":null,"unlimited_hosts":true,"auto_attach":true,"content_view_environment_labels":"","usage_count":0,"user_id":4,"max_hosts":null,"release_version":null,"purpose_usage":null,"purpose_role":null,"organization_id":69,"organization":{"name":"Test
Organization","label":"Test_Organization","id":69},"created_at":"2025-12-08
10:28:27 UTC","updated_at":"2025-12-08 10:28:27 UTC","content_view_environments":[],"products":[],"host_collections":[],"multi_content_view_environment":false,"content_view_id":null,"content_view":null,"environment_id":null,"environment":null,"permissions":{"view_activation_keys":true,"edit_activation_keys":true,"destroy_activation_keys":true}}
string: ' {"service_level":null,"content_overrides":[],"id":22,"name":"Test
Activation Key","description":null,"unlimited_hosts":true,"content_view_environment_labels":"","usage_count":0,"user_id":4,"max_hosts":null,"release_version":null,"purpose_usage":null,"purpose_role":null,"organization_id":6,"organization":{"name":"Test
Organization","label":"Test_Organization","id":6},"created_at":"2025-12-13
23:33:47 UTC","updated_at":"2025-12-13 23:33:47 UTC","content_view_environments":[],"products":[],"host_collections":[],"multi_content_view_environment":false,"content_view_id":null,"content_view":null,"environment_id":null,"environment":null,"permissions":{"view_activation_keys":true,"edit_activation_keys":true,"destroy_activation_keys":true}}

'
headers:
Expand All @@ -204,17 +204,17 @@ interactions:
Connection:
- Keep-Alive
Content-Length:
- '765'
- '743'
Content-Type:
- application/json; charset=utf-8
Foreman_api_version:
- '2'
Foreman_current_location:
- ; ANY
Foreman_current_organization:
- 69; Test Organization
- 6; Test Organization
Foreman_version:
- 3.16.0.7
- 3.18.0-develop
Keep-Alive:
- timeout=15, max=97
Referrer-Policy:
Expand Down
Loading