-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcreate_sno_lpar.yml
84 lines (71 loc) · 2.1 KB
/
create_sno_lpar.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
- name: Store known hosts of all HMCs
hosts: localhost
gather_facts: no
connection: local
become: false
vars_files:
- vars/hmcs.yml
- vars/lpar.yml
tasks:
- name: Scan ssh public keys of HMC
shell: "ssh-keyscan {{ hmc[lpar.hmc].ip }}"
register: ssh_key
- name: Update known hosts for HMC {{ hmc[lpar.hmc].ip }}
known_hosts:
name: "{{ hmc[lpar.hmc].ip }}"
key: "{{ item }}"
loop: "{{ ssh_key.stdout_lines }}"
- name: Create SNO LPAR
hosts: localhost
gather_facts: no
collections:
- ibm.power_hmc
vars_files:
- vars/hmcs.yml
- vars/lpar.yml
# Variables:
# - lpar: configuration of single LPAR to create
# - hmc: configuration of all HMC
# - debug: true/false
tasks:
- name: Create LPAR {{ lpar.name }} on {{ lpar.managed_system }}
powervm_lpar_instance:
hmc_host: '{{ hmc[lpar.hmc].ip }}'
hmc_auth: "{{ hmc[lpar.hmc].hmc_auth }}"
system_name: "{{ lpar.managed_system }}"
vm_name: "{{ lpar.name }}"
proc: "{{ lpar.proc }}"
proc_unit: "{{ lpar.proc_unit }}"
mem: "{{ lpar.mem }}"
os_type: "{{ lpar.os_type }}"
max_virtual_slots: "{{ lpar.max_virtual_slots }}"
virt_network_config: "{{ lpar.network }}"
npiv_config: "{{ lpar.npiv }}"
state: present
register: testout
connection: local
become: false
- name: "{{ lpar.name }}: get facts"
powervm_lpar_instance:
hmc_host: '{{ hmc[lpar.hmc].ip }}'
hmc_auth: "{{ hmc[lpar.hmc].hmc_auth }}"
system_name: "{{ lpar.managed_system }}"
vm_name: "{{ lpar.name }}"
state: facts
advanced_info: true
register: lpar_data
connection: local
become: false
- name: "{{ lpar.name }}: reset variable WWPN"
set_fact:
wwpn: ''
- name: "{{ lpar.name }}: Detect WWPN"
set_fact:
wwpn: "{{ wwpn | default('') }} {{ item.WWPNs }}"
loop: "{{ lpar_data.partition_info.VirtualFiberChannelAdapters }}"
loop_control:
label: "{{ item.WWPNs }}"
become: false
- debug:
msg: "Please create a single boot disk LUN for WWPNs: {{ wwpn }}"