Skip to content

Commit

Permalink
Cleaned up example playbooks
Browse files Browse the repository at this point in the history
Details:

* Renamed the existing create_partition.yml playbook to
  create_partition_full.yml since it does not just create a partition but
  does more.

* Added a new create_partition.yml playbook that just creates a partition.

* Made sure that all playbooks register and display their result
  fully instead of displaying just a summary.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
  • Loading branch information
andy-maier committed Nov 20, 2020
1 parent ef742b7 commit 2d63bb0
Show file tree
Hide file tree
Showing 17 changed files with 138 additions and 122 deletions.
1 change: 0 additions & 1 deletion playbooks/attach_crypto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
adapter_count: 4
domain_range: 2,-1
access_mode: usage
log_file: crypto.log
register: result

- name: Print the result
Expand Down
1 change: 0 additions & 1 deletion playbooks/attach_crypto_byname.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
- CRYP01
domain_range: 2,-1
access_mode: usage
log_file: crypto.log
register: result

- name: Print the result
Expand Down
10 changes: 4 additions & 6 deletions playbooks/create_hipersockets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
properties:
type: hipersockets
description: "This is Hipersockets adapter {{ hs_adapter_name }}"
register: adapter1
register: result

- debug:
var: adapter1

- debug:
msg: "Adapter: description = '{{ adapter1['adapter']['description'] }}', name = '{{ adapter1['adapter']['name'] }}'"
- name: Print the result
debug:
var: result
80 changes: 4 additions & 76 deletions playbooks/create_partition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,80 +22,8 @@
minimum_ifl_processing_weight: 50
maximum_ifl_processing_weight: 800
initial_ifl_processing_weight: 200
register: part1
register: result

- name: Ensure HBA exists in the partition
zhmc_hba:
hmc_host: "{{ hmc_host }}"
hmc_auth: "{{ hmc_auth }}"
cpc_name: "{{ cpc_name }}"
partition_name: "{{ partition_name }}"
name: "{{ hba_name }}"
state: present
properties:
adapter_name: "{{ hba_adapter_name }}"
adapter_port: "{{ hba_adapter_port }}"
description: The HBA to our storage
device_number: "023F"
register: hba1

- name: Ensure NIC exists in the partition
zhmc_nic:
hmc_host: "{{ hmc_host }}"
hmc_auth: "{{ hmc_auth }}"
cpc_name: "{{ cpc_name }}"
partition_name: "{{ partition_name }}"
name: "{{ nic_name }}"
state: present
properties:
adapter_name: "{{ nic_adapter_name }}"
adapter_port: "{{ nic_adapter_port }}"
description: The NIC to our data network
device_number: "013F"
register: nic1

- name: Ensure virtual function exists in the partition
zhmc_virtual_function:
hmc_host: "{{ hmc_host }}"
hmc_auth: "{{ hmc_auth }}"
cpc_name: "{{ cpc_name }}"
partition_name: "{{ partition_name }}"
name: "{{ vfunction_name }}"
state: present
properties:
adapter_name: "{{ vfunction_adapter_name }}"
description: The virtual function for our accelerator adapter
device_number: "043F"
register: vfunction1

- name: Configure partition for booting via HBA
zhmc_partition:
hmc_host: "{{ hmc_host }}"
hmc_auth: "{{ hmc_auth }}"
cpc_name: "{{ cpc_name }}"
name: "{{ partition_name }}"
state: stopped
properties:
boot_device: storage-adapter
boot_storage_hba_name: "{{ hba_name }}"
boot_logical_unit_number: "0001"
boot_world_wide_port_name: "00cdef01abcdef01"
register: part1

- name: Ensure crypto config for partition
zhmc_partition:
hmc_host: "{{ hmc_host }}"
hmc_auth: "{{ hmc_auth }}"
cpc_name: "{{ cpc_name }}"
name: "{{ partition_name }}"
state: stopped
properties:
crypto_configuration:
crypto_adapter_names:
- "{{ crypto_adapter_name }}"
crypto_domain_configurations:
- domain_index: "17"
access_mode: "control-usage"
- domain_index: 20
access_mode: "control"
register: part1
- name: Print the result
debug:
var: result
86 changes: 86 additions & 0 deletions playbooks/create_partition_full.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
- hosts: localhost
vars_files:
- vars.yml
- vault.yml
collections:
- ibm.zhmc
tasks:

- name: Ensure partition exists and is stopped
zhmc_partition:
hmc_host: "{{ hmc_host }}"
hmc_auth: "{{ hmc_auth }}"
cpc_name: "{{ cpc_name }}"
name: "{{ partition_name }}"
state: stopped
properties:
description: "zhmc Ansible modules: partition 1"
ifl_processors: 2
initial_memory: 1024
maximum_memory: 1024
minimum_ifl_processing_weight: 50
maximum_ifl_processing_weight: 800
initial_ifl_processing_weight: 200
register: part1

- name: Ensure NIC exists in the partition
zhmc_nic:
hmc_host: "{{ hmc_host }}"
hmc_auth: "{{ hmc_auth }}"
cpc_name: "{{ cpc_name }}"
partition_name: "{{ partition_name }}"
name: "{{ nic_name }}"
state: present
properties:
adapter_name: "{{ nic_adapter_name }}"
adapter_port: "{{ nic_adapter_port }}"
description: The NIC to our data network
device_number: "013F"
register: nic1

- name: Ensure virtual function exists in the partition
zhmc_virtual_function:
hmc_host: "{{ hmc_host }}"
hmc_auth: "{{ hmc_auth }}"
cpc_name: "{{ cpc_name }}"
partition_name: "{{ partition_name }}"
name: "{{ vfunction_name }}"
state: present
properties:
adapter_name: "{{ vfunction_adapter_name }}"
description: The virtual function for our accelerator adapter
device_number: "043F"
register: vfunction1

- name: Configure partition for booting via HBA
zhmc_partition:
hmc_host: "{{ hmc_host }}"
hmc_auth: "{{ hmc_auth }}"
cpc_name: "{{ cpc_name }}"
name: "{{ partition_name }}"
state: stopped
properties:
boot_device: storage-adapter
boot_storage_hba_name: "{{ hba_name }}"
boot_logical_unit_number: "0001"
boot_world_wide_port_name: "00cdef01abcdef01"
register: part1

- name: Ensure crypto config for partition
zhmc_partition:
hmc_host: "{{ hmc_host }}"
hmc_auth: "{{ hmc_auth }}"
cpc_name: "{{ cpc_name }}"
name: "{{ partition_name }}"
state: stopped
properties:
crypto_configuration:
crypto_adapter_names:
- "{{ crypto_adapter_name }}"
crypto_domain_configurations:
- domain_index: "17"
access_mode: "control-usage"
- domain_index: 20
access_mode: "control"
register: part1
5 changes: 5 additions & 0 deletions playbooks/delete_hipersockets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@
cpc_name: "{{ cpc_name }}"
name: "{{ hs_adapter_name }}"
state: absent
register: result

- name: Print the result
debug:
var: result
5 changes: 5 additions & 0 deletions playbooks/delete_partition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@
cpc_name: "{{ cpc_name }}"
name: "{{ partition_name }}"
state: absent
register: result

- name: Print the result
debug:
var: result
5 changes: 5 additions & 0 deletions playbooks/delete_storage_group.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@
cpc_name: "{{ cpc_name }}"
name: "{{ sg_name }}"
state: absent
register: result

- name: Print the result
debug:
var: result
5 changes: 5 additions & 0 deletions playbooks/delete_storage_volume.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@
storage_group_name: "{{ sg_name }}"
name: "{{ sv_name }}"
state: absent
register: result

- name: Print the result
debug:
var: result
1 change: 0 additions & 1 deletion playbooks/detach_crypto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
cpc_name: "{{ cpc_name }}"
partition_name: "{{ partition_name }}"
state: detached
log_file: crypto.log
register: result

- name: Print the result
Expand Down
10 changes: 4 additions & 6 deletions playbooks/facts_adapter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
cpc_name: "{{ cpc_name }}"
name: "{{ adapter_name }}"
state: facts
register: adapter1
register: result

- debug:
var: adapter1

- debug:
msg: "Adapter: description = '{{ adapter1['adapter']['description'] }}', name = '{{ adapter1['adapter']['name'] }}'"
- name: Print the result
debug:
var: result
11 changes: 4 additions & 7 deletions playbooks/facts_cpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
hmc_auth: "{{ hmc_auth }}"
name: "{{ cpc_name }}"
state: facts
log_file: cpc.log
register: cpc1
register: result

# - debug:
# var: cpc1

- debug:
msg: "CPC description = '{{ cpc1['cpc']['description'] }}'"
- name: Print the result
debug:
var: result
1 change: 0 additions & 1 deletion playbooks/facts_crypto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
cpc_name: "{{ cpc_name }}"
partition_name: "{{ partition_name }}"
state: facts
log_file: crypto.log
register: result

- name: Print the result
Expand Down
7 changes: 4 additions & 3 deletions playbooks/facts_partition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
cpc_name: "{{ cpc_name }}"
name: "{{ partition_name }}"
state: facts
register: part1
register: result

- debug:
var: part1
- name: Print the result
debug:
var: result
10 changes: 4 additions & 6 deletions playbooks/set_adapter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
state: set
properties:
description: "This is adapter {{ adapter_name }}"
register: adapter1
register: result

- debug:
var: adapter1

- debug:
msg: "Adapter: description = '{{ adapter1['adapter']['description'] }}', name = '{{ adapter1['adapter']['name'] }}'"
- name: Print the result
debug:
var: result
11 changes: 4 additions & 7 deletions playbooks/set_cpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@
state: set
properties:
description: "This is CPC {{ cpc_name }}"
log_file: cpc.log
register: cpc1
register: result

# - debug:
# var: cpc1

- debug:
msg: "CPC description = '{{ cpc1['cpc']['description'] }}'"
- name: Print the result
debug:
var: result
11 changes: 4 additions & 7 deletions playbooks/set_matched_adapter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@
state: set
properties:
description: "This is adapter {{ adapter_name }}"
# log_file: adapter.log
register: adapter1
register: result

- debug:
var: adapter1

- debug:
msg: "Adapter: description = '{{ adapter1['adapter']['description'] }}', name = '{{ adapter1['adapter']['name'] }}'"
- name: Print the result
debug:
var: result

0 comments on commit 2d63bb0

Please sign in to comment.