-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhpe_oneview_create_srv_prof_templ.yml
53 lines (43 loc) · 1.61 KB
/
hpe_oneview_create_srv_prof_templ.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
---
- hosts: target_hosts
gather_facts: no
## vars_files:
## FIXME: you could add whichprofile var and source
# - files/{{ whichprofile }}_template.yml
# => still same profiles for all nodes
# => allow for different data sets named e.g. like each host
# within template file
# and choose when using
## - files/standard_template.yml
tasks:
# reads local file no matter what you delegate
- name: read ov_hardware_names from file
include_vars:
file: "{{ tmpdir }}/standard_template.yml"
name: ovsp_template
- name: Create a server profile template
hpe.oneview.oneview_server_profile_template:
hostname: "{{ hostvars[oneview_host].ansible_host }}"
username: "{{ oneview_username }}"
password: "{{ oneview_password }}"
auth_login_domain: "{{ oneview_domain }}"
api_version: "{{ oneview_apiversion }}"
state: present
data:
"{{ovsp_template.profile_data}}"
params:
force: true
delegate_to: localhost
register: result
run_once: true
- debug: msg= "{{ result.msg }}"
- name: Gather facts about the Server Profile Template by name
hpe.oneview.oneview_server_profile_template_facts:
hostname: "{{ hostvars[oneview_host].ansible_host }}"
username: "{{ oneview_username }}"
password: "{{ oneview_password }}"
auth_login_domain: "{{ oneview_domain }}"
api_version: "{{ oneview_apiversion }}"
name: "{{ server_profile_template_name }}"
delegate_to: localhost
- debug: var=server_profile_templates