forked from HewlettPackard/oneview-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoneview_scope.yml
74 lines (70 loc) · 2.45 KB
/
oneview_scope.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
###
# Copyright (2016-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 resource is available for API version 300 or later.
- hosts: all
vars:
config: "{{ playbook_dir }}/oneview_config.json"
# Set the URI of existent resources to be added to the scope resource assignments
resource_uri_1: '/rest/fc-networks/faa540ab-a4eb-456c-aa47-98969756d4e7'
resource_uri_2: '/rest/fc-networks/4cf6f8f9-3edb-4ddb-9df8-03b2a8ada0bb'
resource_uri_3: '/rest/fc-networks/4ee791d7-6f2a-4a2e-85ce-994be04fa94a'
tasks:
- name: Create a scope
oneview_scope:
config: '{{ config }}'
state: present
data:
name: 'SampleScope'
delegate_to: localhost
- name: Update the scope name
oneview_scope:
config: '{{ config }}'
state: present
data:
name: 'SampleScope'
newName: 'SampleScopeRenamed'
delegate_to: localhost
- name: Update the scope resource assignments, adding two resources
oneview_scope:
config: '{{ config }}'
state: resource_assignments_updated
data:
name: 'SampleScopeRenamed'
resourceAssignments:
addedResourceUris:
- '{{ resource_uri_1 }}'
- '{{ resource_uri_2 }}'
delegate_to: localhost
- name: Update the scope resource assignments, adding one resource and removing another previously added
oneview_scope:
config: '{{ config }}'
state: resource_assignments_updated
data:
name: 'SampleScopeRenamed'
resourceAssignments:
addedResourceUris:
- '{{ resource_uri_3 }}'
removedResourceUris:
- '{{ resource_uri_1 }}'
delegate_to: localhost
- name: Delete the Scope
oneview_scope:
config: '{{ config }}'
state: absent
data:
name: 'SampleScopeRenamed'
delegate_to: localhost