-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding playbook to 'only' update Satellite Server admin (#316)
* Adding playbook to 'only' update Satellite Server admin * Updated Satellite playbook * Updated Satellite playbook * Updated Activation key tasks * Fixing left-over 'satellite_servers'
- Loading branch information
1 parent
3bf9465
commit ee18953
Showing
10 changed files
with
85 additions
and
53 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
19 changes: 19 additions & 0 deletions
19
playbooks/provision-satellite-server/update-satellite-server-admin.yml
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,19 @@ | ||
--- | ||
|
||
- hosts: satellite-server | ||
tasks: | ||
- import_role: | ||
name: config-satellite | ||
tasks_from: manifest | ||
tags: | ||
- 'update_manifest' | ||
- import_role: | ||
name: config-satellite | ||
tasks_from: repos | ||
tags: | ||
- 'update_repos' | ||
- import_role: | ||
name: config-satellite | ||
tasks_from: activation_keys | ||
tags: | ||
- 'update_activation_keys' |
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 |
---|---|---|
@@ -1,49 +1,11 @@ | ||
--- | ||
|
||
- name: "Get current subscriptions" | ||
shell: hammer -u "{{ satellite_username }}" -p "{{ satellite_password }}" --csv subscription list --organization "{{ satellite_organization }}" | grep "{{ item.value.subscription }}" | awk -F, '{print $1}' | ||
shell: hammer -u "{{ satellite_username }}" -p "{{ satellite_password }}" --output=yaml subscription list --organization "{{ satellite_organization }}" | ||
register: subids | ||
with_dict: "{{ satellite_activation_keys }}" | ||
|
||
- name: "Create activation key(s)" | ||
command: > | ||
hammer | ||
-u "{{ satellite_username }}" | ||
-p "{{ satellite_password }}" | ||
activation-key create | ||
--name {{ item.key }} | ||
--lifecycle-environment Library | ||
--organization "{{ satellite_organization }}" | ||
with_dict: "{{ satellite_activation_keys }}" | ||
register: chk_ak | ||
failed_when: | ||
- chk_ak.rc != 65 | ||
- chk_ak.rc != 0 | ||
|
||
- name: "Add subs to activation key" | ||
command: > | ||
hammer | ||
-u "{{ satellite_username }}" | ||
-p "{{ satellite_password }}" | ||
activation-key add-subscription | ||
--name "{{ item.item.key }}" | ||
--subscription-id "{{ item.stdout }}" | ||
--organization "{{ satellite_organization }}" | ||
with_items: | ||
- "{{ subids.results }}" | ||
register: ak_chk | ||
failed_when: | ||
- ak_chk.rc != 128 | ||
- ak_chk.rc != 0 | ||
|
||
- name: "Turn off autoattach on activation key(s)" | ||
command: > | ||
hammer | ||
-u "{{ satellite_username }}" | ||
-p "{{ satellite_password }}" | ||
activation-key update | ||
--auto-attach false | ||
--name "{{ item.key }}" | ||
--organization "{{ satellite_organization }}" | ||
with_dict: "{{ satellite_activation_keys }}" | ||
- include_tasks: process-one-activation-key.yml | ||
loop: "{{ satellite_activation_keys }}" | ||
loop_control: | ||
loop_var: activation_key | ||
|
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
47 changes: 47 additions & 0 deletions
47
roles/config-satellite/tasks/process-one-activation-key.yml
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,47 @@ | ||
--- | ||
|
||
- name: "Create activation key" | ||
command: > | ||
hammer | ||
-u "{{ satellite_username }}" | ||
-p "{{ satellite_password }}" | ||
activation-key create | ||
--name "{{ activation_key.name }}" | ||
--lifecycle-environment Library | ||
--organization "{{ satellite_organization }}" | ||
register: chk_ak | ||
failed_when: | ||
- chk_ak.rc != 65 | ||
- chk_ak.rc != 0 | ||
|
||
- name: "Add subs to activation key" | ||
command: > | ||
hammer | ||
-u "{{ satellite_username }}" | ||
-p "{{ satellite_password }}" | ||
activation-key add-subscription | ||
--name "{{ activation_key.name }}" | ||
--subscription-id "{{ item.ID }}" | ||
--organization "{{ satellite_organization }}" | ||
when: | ||
- (activation_key.type is defined and | ||
item.Type == activation_key.type and | ||
item.Name == activation_key.subscription) or | ||
(activation_key.type is undefined and | ||
item.Name == activation_key.subscription) | ||
with_items: | ||
- "{{ subids.stdout | from_yaml }}" | ||
register: ak_chk | ||
failed_when: | ||
- ak_chk.rc != 128 | ||
- ak_chk.rc != 0 | ||
|
||
- name: "Turn off autoattach on activation key(s)" | ||
command: > | ||
hammer | ||
-u "{{ satellite_username }}" | ||
-p "{{ satellite_password }}" | ||
activation-key update | ||
--auto-attach false | ||
--name "{{ activation_key.name }}" | ||
--organization "{{ satellite_organization }}" |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
[satellite_servers] | ||
[satellite-server] | ||
sat.example.com ansible_user=root ansible_host=192.168.1.10 |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
|
||
- name: 'Configure Satellite' | ||
hosts: satellite_servers | ||
hosts: satellite-server | ||
roles: | ||
- role: config-satellite | ||
|