forked from HewlettPackard/oneview-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request HewlettPackard#159 from GustavoHennig/server_creat…
…ion_example Adding an example to create Server Profile from Template using NIC Custom Attributes
- Loading branch information
Showing
2 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
examples/synergy_create_server_profile_with_deployment_plan.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,58 @@ | ||
### | ||
# Copyright (2017) Hewlett Packard Enterprise Development LP | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# You may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
### | ||
--- | ||
### | ||
# This playbook is only compatible with HPE Synergy Enclosures | ||
### | ||
- name: Deploy Server Profile from Template, selecting the right connection for Management NIC | ||
hosts: all | ||
gather_facts: no | ||
vars: | ||
- config: "{{ playbook_dir }}/oneview_config.json" | ||
- deployment_plan_name: 'update-nodejs-stack-RHEL7.2' | ||
- management_network_name: 'mgmt' | ||
- server_template_name: 'webserver-template' | ||
|
||
tasks: | ||
- name: Gather facts about the Server Profile Template to retrieve connection information | ||
oneview_server_profile_template_facts: | ||
config: "{{ config }}" | ||
name: "{{ server_template_name }}" | ||
delegate_to: localhost | ||
|
||
- name: Find the connection by management network name | ||
set_fact: connection={{ server_profile_templates.0.connections | selectattr('name', 'equalto', management_network_name) | first }} | ||
|
||
- name : "Create server profile with deployment plan {{ deployment_plan_name }}" | ||
delegate_to: localhost | ||
oneview_server_profile: | ||
config: "{{ config }}" | ||
data: | ||
name: "{{ inventory_hostname }}" | ||
server_template: "{{ server_template_name }}" | ||
osDeploymentSettings: | ||
osDeploymentPlanName: "{{ deployment_plan_name }}" | ||
osCustomAttributes: | ||
- name: MgmtNIC1.connectionid | ||
value: '{{ connection.id }}' | ||
- name: MgmtNIC1.dhcp | ||
value: false | ||
- name: MgmtNIC1.ipv4disable | ||
value: false | ||
- name: MgmtNIC1.networkuri | ||
value: '{{ connection.networkUri }}' | ||
- name: MgmtNIC1.constraint | ||
value: auto |
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