-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Details: * Restructured the sample playbooks as follows: - Renamed them so that the resource they work on appears first in the file name, and then the action. This orders them in the directory listing in a more meaningful way. - Changed the variable that selects the inventory entry from 'host' to 'hmc'. - Removed the 'cpc_name' variable from the vault file, since it is different for any HMC anyway, and it is easier to understand if it does not appear defined by magic. The CPC is now defined in each playbook with the 'cpc' variable and thus can be overridden from the command line with '-e cpc=mycpc'. - Simplified the variable names that specify resource names to remove '_name' for easier use with the '-e' option. - Added 'gather_facts: no' to the playbooks. - Added a zhmc log file 'zhmc.log' to the playbooks. * Simplifications in the inventory and vault files: - Added the 'verify' variable to the example vault file. - Removed 'ansible_connection: local' from the example inventory file since it is not needed, when the tasks specify 'delegate_to: local'. - Improved the documentation in the example inventory and vault files. * Major improvements in the z_systems_administration/zhmc/README.md file that documents how to use the sample playbooks. Signed-off-by: Andreas Maier <[email protected]>
- Loading branch information
1 parent
329b10d
commit f3cdab3
Showing
52 changed files
with
1,009 additions
and
804 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
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 | ||
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.