-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zhmc: Restructured sample playbooks #222
Open
andy-maier
wants to merge
1
commit into
main
Choose a base branch
from
andy/restructure-sample-playbooks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
12 changes: 8 additions & 4 deletions
12
z_systems_administration/zhmc/playbooks/inventory_example.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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
--- | ||
# inventory.yml file for the sample playbooks of the IBM Z HMC Collection | ||
|
||
# The HMC inventory the sample playbooks will use: | ||
my_hmc_list: | ||
default: # A group nickname | ||
|
||
hosts: | ||
myhmc13: # must match the key name in the vault file | ||
|
||
myhmc13: # An HMC nickname (must match the nickname in the vault file) | ||
ansible_host: 10.11.12.13 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this ip address belong to IBM? if yes, maybe just set to something generic like 'your_hmc_ip_address' |
||
ansible_connection: local # defaults connection=local for this host on all playbook tasks | ||
|
||
# ... more HMC entries for this group, as needed | ||
|
||
# ... more groups, as needed |
35 changes: 35 additions & 0 deletions
35
z_systems_administration/zhmc/playbooks/module_adapter_facts.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,35 @@ | ||
--- | ||
# Sample playbook for the zhmc_adapter module of the ibm.ibm_zhmc collection: | ||
# | ||
# Get facts for an adapter | ||
# | ||
# Command to run this playbook: | ||
# ansible-playbook -i inventory.yml -e hmc={myhmc} -e cpc={mycpc} -e adapter={myadapter} module_adapter_facts.yml | ||
|
||
- hosts: | ||
- "{{ hmc | default('default') }}" # HMC nickname from inventory entry | ||
gather_facts: no | ||
vars_files: | ||
- vault.yml | ||
vars: | ||
cpc: MYCPC # Adjust or override with -e option | ||
adapter: sample-hs-1 # Adjust or override with -e option | ||
log_file: zhmc.log | ||
collections: | ||
- ibm.ibm_zhmc | ||
tasks: | ||
|
||
- name: "Get facts for adapter {{ adapter }} on CPC {{ cpc }}" | ||
delegate_to: localhost | ||
zhmc_adapter: | ||
hmc_host: "{{ ansible_host }}" | ||
hmc_auth: "{{ hmc_auth[inventory_hostname] }}" | ||
cpc_name: "{{ hmc_auth[inventory_hostname] }}" | ||
name: "{{ adapter }}" | ||
state: facts | ||
log_file: "{{ log_file | default(omit) }}" | ||
register: result | ||
|
||
- name: Print the result | ||
ansible.builtin.debug: | ||
var: result |
38 changes: 38 additions & 0 deletions
38
z_systems_administration/zhmc/playbooks/module_adapter_rename.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,38 @@ | ||
--- | ||
# Sample playbook for the zhmc_adapter module of the ibm.ibm_zhmc collection: | ||
# | ||
# Rename an adapter | ||
# | ||
# Command to run this playbook: | ||
# ansible-playbook -i inventory.yml -e hmc={myhmc} -e cpc={mycpc} -e adapter_id={myid} -e new_adapter_name={mynewname} module_adapter_rename.yml | ||
|
||
- hosts: | ||
- "{{ hmc | default('default') }}" # HMC nickname from inventory entry | ||
gather_facts: no | ||
vars_files: | ||
- vault.yml | ||
vars: | ||
cpc: MYCPC # Adjust or override with -e option | ||
adapter_id: '7c3' # Adjust or override with -e option | ||
new_adapter_name: sample-hs-1 # Adjust or override with -e option | ||
log_file: zhmc.log | ||
collections: | ||
- ibm.ibm_zhmc | ||
tasks: | ||
|
||
- name: "Ensure adapter with PCHID {{ adapter_id }} has name {{ new_adapter_name }}" | ||
delegate_to: localhost | ||
zhmc_adapter: | ||
hmc_host: "{{ ansible_host }}" | ||
hmc_auth: "{{ hmc_auth[inventory_hostname] }}" | ||
cpc_name: "{{ cpc }}" | ||
name: "{{ new_adapter_name }}" | ||
match: | ||
adapter_id: "{{ adapter_id }}" | ||
state: set | ||
log_file: "{{ log_file | default(omit) }}" | ||
register: result | ||
|
||
- name: Print the result | ||
ansible.builtin.debug: | ||
var: result |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use generic hostname instead of a specific ip address?