Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ov60_added_image_streamer_resource #80

Merged
merged 10 commits into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# Ansible Collections for HPE OneView Change Log

## v6.0.0(unreleased)
This release extends the planned support of the collections to OneView REST API version 2600 (OneView v6.0)
This release extends the planned support of the collections to OneView REST API version 2600 (OneView v6.0) and ImageStreamer REST API version 2010 (I3S v6.0)

#### Bug fixes & Enhancements
- [#66] (https://github.com/HewlettPackard/oneview-ansible-collection/issues/66) module_utils _merge_connections_boot fails with TypeError

### Modules supported in this release
- image_streamer_build_plan
- image_streamer_build_plan_facts
- image_streamer_golden_image
- image_streamer_golden_image_facts
- image_streamer_plan_script
- image_streamer_plan_script_facts
- oneview_appliance_configuration_timeconfig_facts
- oneview_appliance_device_snmp_v1_trap_destination
- oneview_appliance_device_snmp_v1_trap_destination_facts
Expand Down
39 changes: 30 additions & 9 deletions endpoints-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
| --------------------------------------------------------------------------------------- | -------- | :------------------: | :------------------: | :-----------------: |
| **Appliance Configuration Timeconfig**
|<sub>/rest/appliance/configuration/timeconfig/locales</sub> |GET | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |


| **Appliance SNMPv1 Trap Destinations** |
|<sub>/rest/appliance/trap-destinations</sub> |GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/appliance/trap-destinations/validation</sub> |POST | :white_check_mark: | :white_check_mark: | :white_check_mark: |
Expand All @@ -38,18 +36,13 @@
|<sub>/rest/appliance/snmpv3-trap-forwarding/destinations/{id}}</sub> |GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/appliance/snmpv3-trap-forwarding/destinations/{id}</sub> |PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/appliance/snmpv3-trap-forwarding/destinations/{id}</sub> |DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: |

| **Appliance SNMPv3 Users** |
|<sub>/rest/appliance/snmpv3-trap-forwarding/users</sub> |GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/appliance/snmpv3-trap-forwarding/users</sub> |GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/appliance/snmpv3-trap-forwarding/users</sub> |POST | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/appliance/snmpv3-trap-forwarding/users</sub> |DELETE |
:white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/appliance/snmpv3-trap-forwarding/users</sub> |DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/appliance/snmpv3-trap-forwarding/users/{id}}</sub> |GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/appliance/snmpv3-trap-forwarding/users/{id}</sub> |PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/appliance/snmpv3-trap-forwarding/users/{id}</sub> |DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: |



| **Appliance SSH Access**
|<sub>/rest/appliance/ssh-access</sub> |GET | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
|<sub>/rest/appliance/ssh-access</sub> |PUT | :heavy_minus_sign: | :white_check_mark: | :white_check_mark: |
Expand Down Expand Up @@ -339,3 +332,31 @@
|<sub>/rest/storage-volumes/{id}/snapshots</sub> | POST | :white_check_mark: | :white_check_mark: |
|<sub>/rest/storage-volumes/{id}/snapshots/{snapshotId}</sub> | GET | :white_check_mark: | :white_check_mark: |
|<sub>/rest/storage-volumes/{id}/snapshots/{snapshotId}</sub> | DELETE | :white_check_mark: | :white_check_mark: |

## HPE Synergy Image Streamer

| Endpoints | Verb |V1600 |V2000 |V2010 |
| ------------------------------------------------------------------------ | -------- | :------------------: | :------------------: | :------------------: |
| **Golden Images** |
|<sub> /rest/golden-images</sub> | POST(create) | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/golden-images</sub> | POST(upload) | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/golden-images</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/golden-images/{id}</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/golden-images/archive/{id}</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/golden-images/download/{id}</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/golden-images/{id}</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/golden-images/{id}</sub> | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| **OS Build Plan** |
|<sub> /rest/build-plans</sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/build-plans</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/build-plans/{id}</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/build-plans/{id}</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/build-plans/{id}</sub> | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| **Plan Scripts** |
|<sub> /rest/plan-scripts</sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/plan-scripts/differences/{id}</sub> | POST | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/plan-scripts</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/plan-scripts/{id}</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/plan-scripts/{id}</sub> | PUT | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/plan-scripts/{id}</sub> | DELETE | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|<sub> /rest/plan-scripts/{id}/usedby/readonly</sub> | GET | :white_check_mark: | :white_check_mark: | :white_check_mark: |
139 changes: 139 additions & 0 deletions plugins/modules/image_streamer_build_plan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
###
# Copyright (2016-2021) 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.
###
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'}

DOCUMENTATION = '''
---
module: image_streamer_build_plan
short_description: Manages Image Stream OS Build Plan resources.
description:
- "Provides an interface to manage Image Stream OS Build Plans. Can create, update, and remove."
version_added: "2.9.0"
requirements:
- "python >= 3.4.2"
- "hpeOneView >= 6.0.0"
author: "Venkatesh Ravula (@VenkateshRavula)"
options:
state:
description:
- Indicates the desired state for the OS Build Plan resource.
C(present) will ensure data properties are compliant with Synergy Image Streamer.
C(absent) will remove the resource from Synergy Image Streamer, if it exists.
choices: ['present', 'absent']
required: true
type: str
data:
description:
- List with OS Build Plan properties and its associated states.
required: true
type: dict
extends_documentation_fragment:
- hpe.oneview.oneview
- hpe.oneview.oneview.params
'''

EXAMPLES = '''
- name: Create an OS Build Plan
image_streamer_build_plan:
hostname: 172.16.101.48
username: administrator
password: my_password
api_version: 600
state: present
data:
name: 'Demo OS Build Plan'
description: "oebuildplan"
oeBuildPlanType: "deploy"
delegate_to: localhost
- name: Update the OS Build Plan description and name
image_streamer_build_plan:
hostname: 172.16.101.48
username: administrator
password: my_password
api_version: 600
state: present
data:
name: 'Demo OS Build Plan'
description: "New description"
newName: 'OS Build Plan Renamed'
delegate_to: localhost
- name: Remove an OS Build Plan
image_streamer_build_plan:
hostname: 172.16.101.48
username: administrator
password: my_password
api_version: 600
state: absent
data:
name: 'Demo OS Build Plan'
delegate_to: localhost
'''

RETURN = '''
build_plan:
description: Has the OneView facts about the OS Build Plan.
returned: On state 'present'.
type: dict
'''

from ansible_collections.hpe.oneview.plugins.module_utils.oneview import OneViewModuleBase, OneViewModuleValueError


class BuildPlanModule(OneViewModuleBase):
MSG_CREATED = 'OS Build Plan created successfully.'
MSG_UPDATED = 'OS Build Plan updated successfully.'
MSG_ALREADY_PRESENT = 'OS Build Plan is already present.'
MSG_DELETED = 'OS Build Plan deleted successfully.'
MSG_ALREADY_ABSENT = 'OS Build Plan is already absent.'

argument_spec = dict(
state=dict(
required=True,
choices=['present', 'absent']
),
data=dict(required=True, type='dict')
)

def __init__(self):
super(BuildPlanModule, self).__init__(additional_arg_spec=self.argument_spec)
self.i3s_client = self.oneview_client.create_image_streamer_client()
self.resource_client = self.i3s_client.build_plans

def execute_module(self):
resource = self.get_by_name(self.data['name'])
result = {}

if self.state == 'present':
result = self.resource_present(resource, 'build_plan')
elif self.state == 'absent':
result = self.resource_absent(resource)

return result


def main():
BuildPlanModule().run()


if __name__ == '__main__':
main()
128 changes: 128 additions & 0 deletions plugins/modules/image_streamer_build_plan_facts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
###
# Copyright (2016-2021) 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.
###
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type

ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'}

DOCUMENTATION = '''
---
module: image_streamer_build_plan_facts
short_description: Retrieve facts about one or more of the Image Streamer Build Plans.
description:
- Retrieve facts about one or more of the Image Streamer Build Plans.
version_added: "2.9.0"
requirements:
- "python >= 3.4.2"
- "hpeOneView >= 6.0.0"
author:
- "Venkatesh Ravula (@VenkateshRavula)"
options:
name:
description:
- Build Plan name.
required: false
type: str
params:
description:
- List of params to delimit, filter and sort the list of resources.
- "params allowed:
C(start): The first item to return, using 0-based indexing.
C(count): The number of resources to return.
C(sort): The sort order of the returned data set."
required: false
type: dict

extends_documentation_fragment:
- hpe.oneview.oneview
- hpe.oneview.oneview.params
- hpe.oneview.oneview.factsparams
'''

EXAMPLES = '''
- name: Gather facts about all Build Plans
image_streamer_build_plan_facts:
hostname: 172.16.101.48
username: administrator
password: my_password
api_version: 600
delegate_to: localhost
- debug: var=build_plans
- name: Gather paginated, filtered and sorted facts about Build Plans
image_streamer_build_plan_facts:
hostname: 172.16.101.48
username: administrator
password: my_password
api_version: 600
params:
start: 0
count: 3
sort: name:ascending
filter: oeBuildPlanType=capture
delegate_to: localhost
- debug: var=build_plans
- name: Gather facts about a Build Plan by name
image_streamer_build_plan_facts:
hostname: 172.16.101.48
username: administrator
password: my_password
api_version: 600
name: "{{ name }}"
delegate_to: localhost
- debug: var=build_plans
'''

RETURN = '''
build_plans:
description: The list of Build Plans.
returned: Always, but can be null.
type: list
'''

from ansible_collections.hpe.oneview.plugins.module_utils.oneview import OneViewModuleBase, OneViewModuleResourceNotFound


class BuildPlanFactsModule(OneViewModuleBase):
argument_spec = dict(
name=dict(required=False, type='str'),
params=dict(required=False, type='dict')
)

def __init__(self):
super(BuildPlanFactsModule, self).__init__(additional_arg_spec=self.argument_spec)
self.i3s_client = self.oneview_client.create_image_streamer_client()

def execute_module(self):
name = self.module.params.get("name")

if name:
build_plans = self.i3s_client.build_plans.get_by("name", name)
else:
build_plans = self.i3s_client.build_plans.get_all(**self.facts_params)

return dict(changed=False, ansible_facts=dict(build_plans=build_plans))


def main():
BuildPlanFactsModule().run()


if __name__ == '__main__':
main()
Loading