├── .coveragerc ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── dockerimage.yml │ └── test.yml ├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── Migration Support ├── HPE OneView Ansible Collection Installation and User Guide.docx └── Overview of Migrating from HPE OneView Ansible Module to HPE OneView Ansible Collection Format.DOCX ├── README.md ├── TESTING.md ├── Update-UserScript.py ├── build-doc ├── README.md ├── ansible_module_documentation.py ├── generate_documentation.yml ├── module_docs_fragments │ └── oneview.py ├── oneview_ansible_documentation.j2 ├── run-doc-generation.sh └── test_ansible_module_documentation.py ├── build.sh ├── codecov.yml ├── endpoints-support.md ├── examples ├── ICsp │ ├── icsp_os_deploy.yaml │ └── icsp_server.yaml ├── ImageStreamer │ ├── README.md │ ├── create_server_profile_with_deployment_plan.yml │ ├── data │ │ └── deployment-plans │ │ │ ├── install-RHEL7.2.yml │ │ │ ├── install-nodejs-stack-RHEL7.2.yml │ │ │ ├── install-nodejs4.2-stack-RHEL7.2.yml │ │ │ └── update-nodejs-stack-RHEL7.2.yml │ ├── get_all_deployment_plans.yml │ ├── group_vars │ │ └── nodejs-webservers.yml │ ├── hosts │ ├── power_off_servers .yml │ ├── power_on_servers.yml │ ├── rolling_update_with_revert.yml │ └── update_server_profile_with_deployment_plan.yml ├── README.md ├── c7000_environment_setup.yml ├── demos │ ├── README.md │ ├── boot_from_san_and_migration │ │ ├── README.md │ │ ├── step_1_create_server_profile_boot_from_SAN.yml │ │ ├── step_2_based_on_server_profile_boot_from_SAN_add_another_volume.yml │ │ ├── step_3_create_server_profile_from_template.yml │ │ ├── step_4_migrate_data_volume.yml │ │ └── step_5_migrate_server_profile.yml │ └── oneview-web-farm │ │ ├── README.md │ │ ├── demo │ │ ├── group_vars │ │ │ ├── all │ │ │ ├── dbservers │ │ │ ├── lbservers │ │ │ └── webservers │ │ └── hosts │ │ ├── enable_all_web_servers.yml │ │ ├── make_inventory.yml │ │ ├── ov_site.yml │ │ ├── ov_site_clean.yml │ │ ├── roles │ │ ├── base-apache │ │ │ └── tasks │ │ │ │ └── main.yml │ │ ├── common │ │ │ ├── files │ │ │ │ ├── RPM-GPG-KEY-EPEL-6 │ │ │ │ └── epel.repo │ │ │ ├── handlers │ │ │ │ └── main.yml │ │ │ ├── tasks │ │ │ │ └── main.yml │ │ │ └── templates │ │ │ │ ├── iptables.j2 │ │ │ │ └── ntp.conf.j2 │ │ ├── haproxy │ │ │ ├── handlers │ │ │ │ └── main.yml │ │ │ ├── tasks │ │ │ │ └── main.yml │ │ │ └── templates │ │ │ │ └── haproxy.cfg.j2 │ │ ├── hpe-oneview-server │ │ │ └── tasks │ │ │ │ ├── deploy.yml │ │ │ │ ├── main.yml │ │ │ │ ├── make_compliant.yml │ │ │ │ └── update_firmware.yml │ │ ├── local-yum-repo │ │ │ ├── files │ │ │ │ └── installmedia.repo │ │ │ └── tasks │ │ │ │ └── main.yml │ │ └── web │ │ │ ├── files │ │ │ └── index.php │ │ │ └── tasks │ │ │ └── main.yml │ │ └── rolling_update.yml ├── files │ └── HPE-ImageStreamer-Developer-2016-09-12.zip ├── image_streamer_artifact_bundle.yml ├── image_streamer_artifact_bundle_facts.yml ├── image_streamer_build_plan.yml ├── image_streamer_build_plan_facts.yml ├── image_streamer_deployment_group_facts.yml ├── image_streamer_deployment_plan.yml ├── image_streamer_deployment_plan_facts.yml ├── image_streamer_golden_image.yml ├── image_streamer_golden_image_facts.yml ├── image_streamer_os_volume_facts.yml ├── image_streamer_plan_script.yml ├── image_streamer_plan_script_facts.yml ├── infrastructure_as_code │ ├── README.md │ ├── clean.yml │ ├── infrastructure-as-code.md │ ├── infrastructure-config.yml │ ├── server_profile.yml │ └── server_profile_template.yml ├── oneview_alert_facts.yml ├── oneview_appliance_configuration_timeconfig_facts.yml ├── oneview_appliance_device_read_community.yml ├── oneview_appliance_device_read_community_facts.yml ├── oneview_appliance_device_snmp_v1_trap_destinations.yml ├── oneview_appliance_device_snmp_v1_trap_destinations_facts.yml ├── oneview_appliance_device_snmp_v3_trap_destinations.yml ├── oneview_appliance_device_snmp_v3_trap_destinations_facts.yml ├── oneview_appliance_device_snmp_v3_users.yml ├── oneview_appliance_device_snmp_v3_users_facts.yml ├── oneview_appliance_ssh_access.yml ├── oneview_appliance_ssh_access_facts.yml ├── oneview_appliance_time_and_locale_configuration.yml ├── oneview_appliance_time_and_locale_configuration_facts.yml ├── oneview_certificates_server.yml ├── oneview_certificates_server_facts.yml ├── oneview_config-rename.json ├── oneview_connection_template.yml ├── oneview_connection_template_facts.yml ├── oneview_datacenter.yml ├── oneview_datacenter_facts.yml ├── oneview_drive_enclosure.yml ├── oneview_drive_enclosure_facts.yml ├── oneview_enclosure.yml ├── oneview_enclosure_facts.yml ├── oneview_enclosure_group.yml ├── oneview_enclosure_group_facts.yml ├── oneview_ethernet_network.yml ├── oneview_ethernet_network_facts.yml ├── oneview_event.yml ├── oneview_event_facts.yml ├── oneview_fabric.yml ├── oneview_fabric_facts.yml ├── oneview_fc_network.yml ├── oneview_fc_network_facts.yml ├── oneview_fcoe_network.yml ├── oneview_fcoe_network_facts.yml ├── oneview_firmware_bundle.yml ├── oneview_firmware_driver.yml ├── oneview_firmware_driver_facts.yml ├── oneview_hypervisor_cluster_profile.yml ├── oneview_hypervisor_cluster_profile_facts.yml ├── oneview_hypervisor_manager.yml ├── oneview_hypervisor_manager_facts.yml ├── oneview_id_pools.yml ├── oneview_id_pools_facts.yml ├── oneview_id_pools_ipv4_range.yml ├── oneview_id_pools_ipv4_range_facts.yml ├── oneview_id_pools_ipv4_subnet.yml ├── oneview_id_pools_ipv4_subnet_facts.yml ├── oneview_interconnect.yml ├── oneview_interconnect_facts.yml ├── oneview_interconnect_link_topology_facts.yml ├── oneview_interconnect_type_facts.yml ├── oneview_internal_link_set_facts.yml ├── oneview_label.yml ├── oneview_label_facts.yml ├── oneview_logical_downlinks_facts.yml ├── oneview_logical_enclosure.yml ├── oneview_logical_enclosure_facts.yml ├── oneview_logical_interconnect.yml ├── oneview_logical_interconnect_facts.yml ├── oneview_logical_interconnect_group.yml ├── oneview_logical_interconnect_group_facts.yml ├── oneview_logical_switch.yml ├── oneview_logical_switch_facts.yml ├── oneview_logical_switch_group.yml ├── oneview_logical_switch_group_facts.yml ├── oneview_login_detail_facts.yml ├── oneview_managed_san.yml ├── oneview_managed_san_facts.yml ├── oneview_network_set.yml ├── oneview_network_set_facts.yml ├── oneview_os_deployment_plan_facts.yml ├── oneview_os_deployment_server.yml ├── oneview_os_deployment_server_facts.yml ├── oneview_power_device.yml ├── oneview_power_device_facts.yml ├── oneview_rack.yml ├── oneview_rack_facts.yml ├── oneview_san_manager.yml ├── oneview_san_manager_facts.yml ├── oneview_sas_interconnect.yml ├── oneview_sas_interconnect_facts.yml ├── oneview_sas_interconnect_type_facts.yml ├── oneview_sas_logical_interconnect.yml ├── oneview_sas_logical_interconnect_facts.yml ├── oneview_sas_logical_interconnect_group.yml ├── oneview_sas_logical_interconnect_group_facts.yml ├── oneview_sas_logical_jbod_attachment_facts.yml ├── oneview_sas_logical_jbod_facts.yml ├── oneview_scope.yml ├── oneview_scope_facts.yml ├── oneview_server_hardware.yml ├── oneview_server_hardware_facts.yml ├── oneview_server_hardware_type.yml ├── oneview_server_hardware_type_facts.yml ├── oneview_server_profile.yml ├── oneview_server_profile_facts.yml ├── oneview_server_profile_template.yml ├── oneview_server_profile_template_facts.yml ├── oneview_server_profile_template_with_resource_name.yml ├── oneview_storage_pool.yml ├── oneview_storage_pool_facts.yml ├── oneview_storage_pool_store_serv.yml ├── oneview_storage_system.yml ├── oneview_storage_system_API300.yml ├── oneview_storage_system_facts.yml ├── oneview_storage_volume_attachment.yml ├── oneview_storage_volume_attachment_facts.yml ├── oneview_storage_volume_template.yml ├── oneview_storage_volume_template_facts.yml ├── oneview_storage_volume_template_store_serv.yml ├── oneview_switch.yml ├── oneview_switch_facts.yml ├── oneview_switch_type_facts.yml ├── oneview_task.yml ├── oneview_task_facts.yml ├── oneview_unmanaged_device.yml ├── oneview_unmanaged_device_facts.yml ├── oneview_uplink_set.yml ├── oneview_uplink_set_facts.yml ├── oneview_user.yml ├── oneview_user_facts.yml ├── oneview_version_facts.yml ├── oneview_volume.yml ├── oneview_volume_facts.yml ├── oneview_volume_store_serv.yml ├── synergy_create_server_profile_with_deployment_plan.yml ├── synergy_environment_setup.yml ├── synergy_export_os_deployment_custom_attributes.yml ├── synergy_image_streamer.yml ├── synergy_server_profile_os_deploy.yml └── vars │ └── config.yml.rename ├── library ├── __init__.py ├── hpe_icsp_os_deployment.py ├── hpe_icsp_server.py ├── image_streamer_artifact_bundle.py ├── image_streamer_artifact_bundle_facts.py ├── image_streamer_build_plan.py ├── image_streamer_build_plan_facts.py ├── image_streamer_deployment_group_facts.py ├── image_streamer_deployment_plan.py ├── image_streamer_deployment_plan_facts.py ├── image_streamer_golden_image.py ├── image_streamer_golden_image_facts.py ├── image_streamer_os_volume_facts.py ├── image_streamer_plan_script.py ├── image_streamer_plan_script_facts.py ├── module_utils │ ├── __init__.py │ ├── icsp.py │ └── oneview.py ├── oneview_alert_facts.py ├── oneview_appliance_configuration_timeconfig_facts.py ├── oneview_appliance_device_read_community.py ├── oneview_appliance_device_read_community_facts.py ├── oneview_appliance_device_snmp_v1_trap_destinations.py ├── oneview_appliance_device_snmp_v1_trap_destinations_facts.py ├── oneview_appliance_device_snmp_v3_trap_destinations.py ├── oneview_appliance_device_snmp_v3_trap_destinations_facts.py ├── oneview_appliance_device_snmp_v3_users.py ├── oneview_appliance_device_snmp_v3_users_facts.py ├── oneview_appliance_ssh_access.py ├── oneview_appliance_ssh_access_facts.py ├── oneview_appliance_time_and_locale_configuration.py ├── oneview_appliance_time_and_locale_configuration_facts.py ├── oneview_certificates_server.py ├── oneview_certificates_server_facts.py ├── oneview_connection_template.py ├── oneview_connection_template_facts.py ├── oneview_datacenter.py ├── oneview_datacenter_facts.py ├── oneview_drive_enclosure.py ├── oneview_drive_enclosure_facts.py ├── oneview_enclosure.py ├── oneview_enclosure_facts.py ├── oneview_enclosure_group.py ├── oneview_enclosure_group_facts.py ├── oneview_ethernet_network.py ├── oneview_ethernet_network_facts.py ├── oneview_event.py ├── oneview_event_facts.py ├── oneview_fabric.py ├── oneview_fabric_facts.py ├── oneview_fc_network.py ├── oneview_fc_network_facts.py ├── oneview_fcoe_network.py ├── oneview_fcoe_network_facts.py ├── oneview_firmware_bundle.py ├── oneview_firmware_driver.py ├── oneview_firmware_driver_facts.py ├── oneview_hypervisor_cluster_profile.py ├── oneview_hypervisor_cluster_profile_facts.py ├── oneview_hypervisor_manager.py ├── oneview_hypervisor_manager_facts.py ├── oneview_id_pools.py ├── oneview_id_pools_facts.py ├── oneview_id_pools_ipv4_range.py ├── oneview_id_pools_ipv4_range_facts.py ├── oneview_id_pools_ipv4_subnet.py ├── oneview_id_pools_ipv4_subnet_facts.py ├── oneview_interconnect.py ├── oneview_interconnect_facts.py ├── oneview_interconnect_link_topology_facts.py ├── oneview_interconnect_type_facts.py ├── oneview_internal_link_set_facts.py ├── oneview_label.py ├── oneview_label_facts.py ├── oneview_logical_downlinks_facts.py ├── oneview_logical_enclosure.py ├── oneview_logical_enclosure_facts.py ├── oneview_logical_interconnect.py ├── oneview_logical_interconnect_facts.py ├── oneview_logical_interconnect_group.py ├── oneview_logical_interconnect_group_facts.py ├── oneview_logical_switch.py ├── oneview_logical_switch_facts.py ├── oneview_logical_switch_group.py ├── oneview_logical_switch_group_facts.py ├── oneview_login_detail_facts.py ├── oneview_managed_san.py ├── oneview_managed_san_facts.py ├── oneview_network_set.py ├── oneview_network_set_facts.py ├── oneview_os_deployment_plan_facts.py ├── oneview_os_deployment_server.py ├── oneview_os_deployment_server_facts.py ├── oneview_power_device.py ├── oneview_power_device_facts.py ├── oneview_rack.py ├── oneview_rack_facts.py ├── oneview_san_manager.py ├── oneview_san_manager_facts.py ├── oneview_sas_interconnect.py ├── oneview_sas_interconnect_facts.py ├── oneview_sas_interconnect_type_facts.py ├── oneview_sas_logical_interconnect.py ├── oneview_sas_logical_interconnect_facts.py ├── oneview_sas_logical_interconnect_group.py ├── oneview_sas_logical_interconnect_group_facts.py ├── oneview_sas_logical_jbod_attachment_facts.py ├── oneview_sas_logical_jbod_facts.py ├── oneview_scope.py ├── oneview_scope_facts.py ├── oneview_server_hardware.py ├── oneview_server_hardware_facts.py ├── oneview_server_hardware_type.py ├── oneview_server_hardware_type_facts.py ├── oneview_server_profile.py ├── oneview_server_profile_facts.py ├── oneview_server_profile_template.py ├── oneview_server_profile_template_facts.py ├── oneview_storage_pool.py ├── oneview_storage_pool_facts.py ├── oneview_storage_system.py ├── oneview_storage_system_facts.py ├── oneview_storage_volume_attachment.py ├── oneview_storage_volume_attachment_facts.py ├── oneview_storage_volume_template.py ├── oneview_storage_volume_template_facts.py ├── oneview_switch.py ├── oneview_switch_facts.py ├── oneview_switch_type_facts.py ├── oneview_task.py ├── oneview_task_facts.py ├── oneview_unmanaged_device.py ├── oneview_unmanaged_device_facts.py ├── oneview_uplink_set.py ├── oneview_uplink_set_facts.py ├── oneview_user.py ├── oneview_user_facts.py ├── oneview_version_facts.py ├── oneview_volume.py └── oneview_volume_facts.py ├── oneview-ansible.md ├── requirements.txt ├── test ├── __init__.py ├── conftest.py ├── hpe_test_utils.py ├── oneview_module_loader.py ├── test_hpe_icsp_os_deployment.py ├── test_hpe_icsp_server.py ├── test_icsp.py ├── test_image_streamer_artifact_bundle.py ├── test_image_streamer_artifact_bundle_facts.py ├── test_image_streamer_build_plan.py ├── test_image_streamer_build_plan_facts.py ├── test_image_streamer_deployment_group_facts.py ├── test_image_streamer_deployment_plan.py ├── test_image_streamer_deployment_plan_facts.py ├── test_image_streamer_golden_image.py ├── test_image_streamer_golden_image_facts.py ├── test_image_streamer_os_volume_facts.py ├── test_image_streamer_plan_script.py ├── test_image_streamer_plan_script_facts.py ├── test_oneview.py ├── test_oneview_alert_facts.py ├── test_oneview_appliance_configuration_timeconfig_facts.py ├── test_oneview_appliance_device_read_community.py ├── test_oneview_appliance_device_read_community_facts.py ├── test_oneview_appliance_device_snmp_v1_trap_destinations.py ├── test_oneview_appliance_device_snmp_v1_trap_destinations_facts.py ├── test_oneview_appliance_device_snmp_v3_trap_destinations.py ├── test_oneview_appliance_device_snmp_v3_trap_destinations_facts.py ├── test_oneview_appliance_device_snmp_v3_users.py ├── test_oneview_appliance_device_snmp_v3_users_facts.py ├── test_oneview_appliance_ssh_access.py ├── test_oneview_appliance_ssh_access_facts.py ├── test_oneview_appliance_time_and_locale_configuration.py ├── test_oneview_appliance_time_and_locale_configuration_facts.py ├── test_oneview_certificates_server.py ├── test_oneview_certificates_server_facts.py ├── test_oneview_connection_template.py ├── test_oneview_connection_template_facts.py ├── test_oneview_datacenter.py ├── test_oneview_datacenter_facts.py ├── test_oneview_drive_enclosure.py ├── test_oneview_drive_enclosure_facts.py ├── test_oneview_enclosure.py ├── test_oneview_enclosure_facts.py ├── test_oneview_enclosure_group.py ├── test_oneview_enclosure_group_facts.py ├── test_oneview_ethernet_network.py ├── test_oneview_ethernet_network_facts.py ├── test_oneview_event.py ├── test_oneview_event_fact.py ├── test_oneview_fabric.py ├── test_oneview_fabric_facts.py ├── test_oneview_fc_network.py ├── test_oneview_fc_network_facts.py ├── test_oneview_fcoe_network.py ├── test_oneview_fcoe_network_facts.py ├── test_oneview_firmware_bundle.py ├── test_oneview_firmware_driver.py ├── test_oneview_firmware_driver_facts.py ├── test_oneview_hypervisor_cluster_profile.py ├── test_oneview_hypervisor_cluster_profile_facts.py ├── test_oneview_hypervisor_manager.py ├── test_oneview_hypervisor_manager_facts.py ├── test_oneview_id_pools.py ├── test_oneview_id_pools_facts.py ├── test_oneview_id_pools_ipv4_range.py ├── test_oneview_id_pools_ipv4_range_facts.py ├── test_oneview_id_pools_ipv4_subnet.py ├── test_oneview_id_pools_ipv4_subnet_facts.py ├── test_oneview_interconnect.py ├── test_oneview_interconnect_facts.py ├── test_oneview_interconnect_link_topology_facts.py ├── test_oneview_interconnect_type_facts.py ├── test_oneview_internal_link_set_facts.py ├── test_oneview_label.py ├── test_oneview_label_facts.py ├── test_oneview_logical_downlinks_facts.py ├── test_oneview_logical_enclosure.py ├── test_oneview_logical_enclosure_facts.py ├── test_oneview_logical_interconnect.py ├── test_oneview_logical_interconnect_facts.py ├── test_oneview_logical_interconnect_group.py ├── test_oneview_logical_interconnect_group_facts.py ├── test_oneview_logical_switch.py ├── test_oneview_logical_switch_facts.py ├── test_oneview_logical_switch_group.py ├── test_oneview_logical_switch_group_facts.py ├── test_oneview_login_detail_facts.py ├── test_oneview_managed_san.py ├── test_oneview_managed_san_facts.py ├── test_oneview_network_set.py ├── test_oneview_network_set_facts.py ├── test_oneview_os_deployment_plan_facts.py ├── test_oneview_os_deployment_server.py ├── test_oneview_os_deployment_server_facts.py ├── test_oneview_power_device.py ├── test_oneview_power_device_facts.py ├── test_oneview_rack.py ├── test_oneview_rack_facts.py ├── test_oneview_san_manager.py ├── test_oneview_san_manager_facts.py ├── test_oneview_sas_interconnect.py ├── test_oneview_sas_interconnect_facts.py ├── test_oneview_sas_interconnect_type_facts.py ├── test_oneview_sas_logical_interconnect.py ├── test_oneview_sas_logical_interconnect_facts.py ├── test_oneview_sas_logical_interconnect_group.py ├── test_oneview_sas_logical_interconnect_group_facts.py ├── test_oneview_sas_logical_jbod_attachment_facts.py ├── test_oneview_sas_logical_jbod_facts.py ├── test_oneview_scope.py ├── test_oneview_scope_facts.py ├── test_oneview_server_hardware.py ├── test_oneview_server_hardware_facts.py ├── test_oneview_server_hardware_type.py ├── test_oneview_server_hardware_type_facts.py ├── test_oneview_server_profile.py ├── test_oneview_server_profile_facts.py ├── test_oneview_server_profile_template.py ├── test_oneview_server_profile_template_facts.py ├── test_oneview_storage_pool.py ├── test_oneview_storage_pool_facts.py ├── test_oneview_storage_system.py ├── test_oneview_storage_system_facts.py ├── test_oneview_storage_volume_attachment.py ├── test_oneview_storage_volume_attachment_facts.py ├── test_oneview_storage_volume_template.py ├── test_oneview_storage_volume_template_facts.py ├── test_oneview_switch.py ├── test_oneview_switch_facts.py ├── test_oneview_switch_type_facts.py ├── test_oneview_task.py ├── test_oneview_task_facts.py ├── test_oneview_unmanaged_device.py ├── test_oneview_unmanaged_device_facts.py ├── test_oneview_uplink_set.py ├── test_oneview_uplink_set_facts.py ├── test_oneview_user.py ├── test_oneview_user_facts.py ├── test_oneview_version_facts.py ├── test_oneview_volume.py └── test_oneview_volume_facts.py └── test_requirements.txt /.coveragerc: -------------------------------------------------------------------------------- 1 | [report] 2 | exclude_lines = 3 | if __name__ == .__main__.: 4 | except ImportError: -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.py text eol=lf 2 | *.sh text eol=lf 3 | *.yml text eol=lf -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Scenario/Intent 2 | [What you are trying to achieve but can't?] 3 | 4 | ### Environment Details 5 | - **Module Version:** [Version of the Oneview-Ansible module for which you are encountering the issue] 6 | - **Ansible Version:** [Version of Ansible for which you are encountering the issue] 7 | - **OneView Appliance Version:** [Version of the OneView appliance you're interacting with] 8 | - **OneView Client API Version:** [API version listed in your configuration file or dictionary] 9 | - **Python Version:** [Version of Python in your environment] 10 | - **python-hpOneView SDK Version:** [Version of the python-hpOneView SDK in your environment] 11 | - **Platform:** [OS distribution and release version] 12 | 13 | ### Steps to Reproduce 14 | [What are the complete steps needed to do in order to reproduce your problem?] 15 | 16 | ### Expected Result 17 | [What do you *expect* to happen after taking the steps above?] 18 | 19 | ### Actual Result 20 | [What *actually* happens after the steps above? Include error output or a link to a gist.] 21 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Description 2 | [Describe what this change achieves] 3 | 4 | ### Issues Resolved 5 | [List any issues this PR will resolve. e.g., Fixes #01] 6 | 7 | ### Check List 8 | - [ ] New functionality includes testing. 9 | - [ ] All tests pass. (`$ ./build.sh`). 10 | - [ ] New functionality has been documented in the README if applicable. 11 | - [ ] New functionality has been thoroughly documented in the examples (please include helpful comments). 12 | - [ ] The PR changes have been added to ansible-collections. 13 | -------------------------------------------------------------------------------- /.github/workflows/dockerimage.yml: -------------------------------------------------------------------------------- 1 | name: Docker Image CI 2 | 3 | on: 4 | release: 5 | types: 6 | - created 7 | jobs: 8 | 9 | build: 10 | 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | name: Check out code 16 | - run: | 17 | echo "GITHUB_REF=${GITHUB_REF:10}" >> $GITHUB_ENV 18 | - name: Login to Docker Hub 19 | run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin 20 | - name: Build the tagged Docker image 21 | run: docker build . --file Dockerfile --tag hewlettpackardenterprise/hpe-oneview-sdk-for-ansible:${{ env.GITHUB_REF }}-OV6.1 22 | - name: Push the tagged Docker image 23 | run: docker push hewlettpackardenterprise/hpe-oneview-sdk-for-ansible:${{ env.GITHUB_REF }}-OV6.1 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | inventory 2 | **/*.retry 3 | *.pyc 4 | oneview_config.json 5 | .idea 6 | examples/vars/config.yml 7 | .idea/ 8 | *~ 9 | examples/vars/os_attributes.yaml 10 | **/.coverage 11 | htmlcov 12 | coverage.xml 13 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.6-slim-buster 2 | 3 | LABEL maintainer "Chebrolu Harika " 4 | 5 | WORKDIR /root 6 | 7 | # Some optional but recommended packages 8 | RUN DEBIAN_FRONTEND=noninteractive \ 9 | apt-get update -y \ 10 | && apt-get install --no-install-recommends -y \ 11 | vim \ 12 | curl \ 13 | ansible \ 14 | git 15 | 16 | RUN python -m pip install --upgrade pip 17 | RUN pip install pyOpenSSL hpeOneView 18 | 19 | ADD . oneview-ansible/ 20 | 21 | WORKDIR /root/oneview-ansible 22 | 23 | # Adding hosts for convenience 24 | RUN mkdir -p /etc/ansible 25 | RUN echo [localhost] >> /etc/ansible/hosts 26 | RUN echo localhost ansible_python_interpreter=python3 ansible_connection=local >> /etc/ansible/hosts 27 | 28 | # packages to run tests 29 | RUN cd /root/oneview-ansible/ 30 | RUN pip install -r test_requirements.txt 31 | 32 | ENV ANSIBLE_LIBRARY=/root/oneview-ansible/library 33 | ENV ANSIBLE_MODULE_UTILS=/root/oneview-ansible/library/module_utils/ 34 | 35 | 36 | # Clean and remove not required packages 37 | RUN DEBIAN_FRONTEND=noninteractive \ 38 | apt-get autoremove -y && \ 39 | apt-get clean -y && \ 40 | rm -rf /var/cache/apt/archives/* /var/cache/apt/lists/* /tmp/* /root/cache/. 41 | 42 | CMD [ "ansible-playbook", "--version" ] 43 | -------------------------------------------------------------------------------- /Migration Support/HPE OneView Ansible Collection Installation and User Guide.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HewlettPackard/oneview-ansible/e6fa31ebaa4ceceaacab2852d7ae5fc6fd65442f/Migration Support/HPE OneView Ansible Collection Installation and User Guide.docx -------------------------------------------------------------------------------- /Migration Support/Overview of Migrating from HPE OneView Ansible Module to HPE OneView Ansible Collection Format.DOCX: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HewlettPackard/oneview-ansible/e6fa31ebaa4ceceaacab2852d7ae5fc6fd65442f/Migration Support/Overview of Migrating from HPE OneView Ansible Module to HPE OneView Ansible Collection Format.DOCX -------------------------------------------------------------------------------- /TESTING.md: -------------------------------------------------------------------------------- 1 | # Testing 'oneview-ansible' modules 2 | The 'oneview-ansible' modules require tests to accompany the code being delivered, ensuring higher quality, and also helping to avoid minor mistakes and future regressions. 3 | 4 | ## Executing tests 5 | The tests can be executed by executing the `build.sh` file that consolidates everything that needs to be tested at once. 6 | 7 | If needed it is possible to execute each individual testing or checking task by using its specific tools. 8 | 9 | ### PEP-8 compliance 10 | This code is mostly PEP-8 compliant, it follows the Ansible standard, so to validate it you may use the `flake8` tool with some restrictions: 11 | ```shell 12 | $ flake8 library test --max-line-length=160 --ignore=F401,E402,F403,F405 13 | ``` 14 | 15 | ### Playbooks and Module validations 16 | The validation in the modules and playbooks can be achieved by using the Ansible `validate-modules`: 17 | ```shell 18 | $ git clone -b stable-2.4--single-branch https://github.com/ansible/ansible.git; 19 | $ source ./ansible/hacking/env-setup; 20 | $ /test/sanity/validate-modules/validate-modules "/library/*.py" 21 | ``` 22 | 23 | To validate playbooks you may use the `ansible-playbook` tool with `--syntax-check` tag: 24 | ```shell 25 | $ ansible-playbook -i "localhost," --syntax-check examples/*.yml 26 | ``` 27 | 28 | ### Executing unit tests 29 | All unit tests are inside the test folder. You can execute them manually by using your desired tool, like `python`, `pytest` or `nosetests`. 30 | 31 | ## Implementing tests 32 | All code must have associated tests, be it the already implemented or newly submitted, and this section covers what tests need to be implemented. 33 | 34 | ### Implementing the unit tests 35 | The unit tests are required for each new resource, bug fix or enhancement. They must cover what is being submitted and if necessary use the `mock` to mock OneView appliance communication. 36 | 37 | ### Acceptance criteria 38 | The necessary amount of testing is defined by who is implementing and by who is reviewing and accepting the code, however, the unit test coverage is inspected by the coveralls and it won't allow it to drop. 39 | -------------------------------------------------------------------------------- /build-doc/README.md: -------------------------------------------------------------------------------- 1 | To generate the documentation, run the script located at: "build-doc/run-doc-generation.sh" 2 | 3 | It will generate the file "oneview-ansible.md" in the "oneview-ansible" root directory. 4 | 5 | Example: 6 | ``` 7 | oneview-ansible$ build-doc/run-doc-generation.sh 8 | ``` -------------------------------------------------------------------------------- /build-doc/generate_documentation.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | - name: Create local markdown file from Ansible modules documentation 17 | hosts: localhost 18 | connection: local 19 | gather_facts: no 20 | 21 | vars: 22 | title: 'Ansible HPE OneView Modules' 23 | # Uncomment the line below to add a subtitle 24 | # subtitle: '' 25 | template_file_name: 'oneview_ansible_documentation.j2' 26 | generated_markdown_file: '../oneview-ansible.md' 27 | tasks: 28 | - name: Extract documentation, examples and returns from the Ansible modules 29 | ansible_module_documentation: 30 | path: '../library' 31 | exclusion_filters: ['__init__.py', 'oneview.py'] 32 | register: result 33 | - debug: var=result.errors # Shows occurred errors 34 | 35 | - name: Build markdown file 36 | template: 37 | src: '{{ template_file_name }}' 38 | dest: '{{ generated_markdown_file }}' 39 | -------------------------------------------------------------------------------- /build-doc/run-doc-generation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ### 3 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # You may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | ### 17 | cd ${BASH_SOURCE%/*} 18 | echo "Changing current directory to: ${BASH_SOURCE%/*}" 19 | export ANSIBLE_LIBRARY=. 20 | ansible-playbook -i 'localhost,' -c local -e 'ansible_python_interpreter=python' generate_documentation.yml 21 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | notify: 3 | require_ci_to_pass: yes 4 | 5 | coverage: 6 | precision: 2 7 | round: down 8 | range: "70...100" 9 | 10 | status: 11 | project: 12 | default: 13 | threshold: 1 14 | target: 97% #overall project/ repo coverage 15 | # Disable patch since it is noisy and not correct 16 | patch: 17 | default: 18 | enabled: no 19 | if_not_found: success 20 | 21 | comment: false -------------------------------------------------------------------------------- /examples/ICsp/icsp_os_deploy.yaml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | # These variables contain sensitive information such as users and passwords, 18 | # and are presented here in order to keep the example simple. 19 | # In a production enviromnment, we strongly suggest the usage of Ansible Vault 20 | # to secure such information. 21 | --- 22 | - hosts: localhost 23 | 24 | tasks: 25 | - name: Deploy OS 26 | hpe_icsp_os_deployment: 27 | icsp_host: "16.123.123.251" 28 | username: "Administrator" 29 | password: "admin" 30 | server_id: "VCGYZ33007" 31 | os_build_plan: "RHEL 7.2 x64" 32 | custom_attributes: 33 | - SSH_CERT: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" 34 | delegate_to: localhost -------------------------------------------------------------------------------- /examples/ImageStreamer/create_server_profile_with_deployment_plan.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | 18 | - name: Deploy node webservers on RHEL 7.2 servers 19 | hosts: all 20 | gather_facts: no 21 | vars: 22 | - config: "{{ playbook_dir }}/oneview_config.json" 23 | - deployment_network_uri: '/rest/ethernet-networks/b2b0669c-fa68-4f75-9f51-af607269b32b' 24 | - enclosure_group_uri: '/rest/enclosure-groups/1ae73c92-d598-4f65-ac96-f417a55039f3' 25 | - deployment_plan_name: 'install-nodejs4.2-stack-RHEL7.2' 26 | - management_ntwrk_uri: '/rest/ethernet-networks/e75ac764-6a41-47c5-8e37-53c4265d39bd' 27 | 28 | tasks: 29 | - name : "Create server profile with deployment plan {{ deployment_plan_name }}" 30 | delegate_to: localhost 31 | oneview_server_profile: 32 | config: "{{ config }}" 33 | data: 34 | name: "{{ inventory_hostname }}" 35 | server_template: "webserver-template" 36 | osDeploymentSettings: 37 | osDeploymentPlanName: "{{ deployment_plan_name }}" 38 | osCustomAttributes: 39 | - name: MgmtNIC1.connectionid 40 | value: 1 41 | - name: MgmtNIC1.dhcp 42 | value: false 43 | - name: MgmtNIC1.ipv4disable 44 | value: false 45 | - name: MgmtNIC1.networkuri 46 | value: "{{ management_ntwrk_uri }}" 47 | - name: MgmtNIC1.constraint 48 | value: auto 49 | 50 | -------------------------------------------------------------------------------- /examples/ImageStreamer/data/deployment-plans/install-RHEL7.2.yml: -------------------------------------------------------------------------------- 1 | os_custom_attributes_for_server_profile: 2 | - name: DomainName 3 | value: '' 4 | -------------------------------------------------------------------------------- /examples/ImageStreamer/data/deployment-plans/install-nodejs-stack-RHEL7.2.yml: -------------------------------------------------------------------------------- 1 | os_custom_attributes_for_server_profile: 2 | - name: MgmtNIC1.mac 3 | value: null 4 | - name: MgmtNIC1.gateway 5 | value: null 6 | - name: MgmtNIC1.ipaddress 7 | value: null 8 | - name: MgmtNIC1 9 | value: '' 10 | -------------------------------------------------------------------------------- /examples/ImageStreamer/data/deployment-plans/install-nodejs4.2-stack-RHEL7.2.yml: -------------------------------------------------------------------------------- 1 | os_custom_attributes_for_server_profile: 2 | - name: MgmtNIC1.ipaddress 3 | value: null 4 | - name: MgmtNIC1.mac 5 | value: null 6 | - name: MgmtNIC1 7 | value: '' 8 | - name: MgmtNIC1.gateway 9 | value: null 10 | -------------------------------------------------------------------------------- /examples/ImageStreamer/data/deployment-plans/update-nodejs-stack-RHEL7.2.yml: -------------------------------------------------------------------------------- 1 | os_custom_attributes_for_server_profile: 2 | - name: MgmtNIC1 3 | value: '' 4 | - name: MgmtNIC1.gateway 5 | value: null 6 | - name: MgmtNIC1.ipaddress 7 | value: null 8 | - name: MgmtNIC1.mac 9 | value: null 10 | -------------------------------------------------------------------------------- /examples/ImageStreamer/get_all_deployment_plans.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | gather_facts: no 19 | vars: 20 | config: "{{ playbook_dir }}/oneview_config.json" 21 | destination_path: "{{ playbook_dir }}/vars" 22 | deploymentplans_info_directory: "{{ playbook_dir}}/data/deployment-plans" 23 | tasks: 24 | - name: Create a folder to store deployment plan related information 25 | file: path="{{ deploymentplans_info_directory }}" state=directory 26 | delegate_to: localhost 27 | 28 | - name: Gather facts about all OS Deployment Plans 29 | oneview_os_deployment_plan_facts: 30 | config : '{{ config }}' 31 | delegate_to: localhost 32 | 33 | - name: Gather facts about each OS Deployment Plan Custom Attributes 34 | oneview_os_deployment_plan_facts: 35 | config: '{{ config }}' 36 | name : '{{ item.name }}' 37 | options: 38 | - osCustomAttributesForServerProfile 39 | with_items: 40 | - "{{ os_deployment_plans }}" 41 | register: dp_facts 42 | delegate_to: localhost 43 | 44 | - name: Export each deployment plan's OS custom attributes to deploymentPlanName.yml 45 | copy: 46 | content="{{ item.os_deployment_plan_custom_attributes | to_nice_yaml }}" 47 | dest="{{ deploymentplans_info_directory }}/{{ item.os_deployment_plans.0.name }}.yml" 48 | with_items: 49 | - "{{ dp_facts.results | map(attribute='ansible_facts') | list }}" 50 | delegate_to: localhost 51 | -------------------------------------------------------------------------------- /examples/ImageStreamer/group_vars/nodejs-webservers.yml: -------------------------------------------------------------------------------- 1 | deployment_network_uri: '/rest/ethernet-networks/b2b0669c-fa68-4f75-9f51-af607269b32b' 2 | enclosure_group_uri: '/rest/enclosure-groups/1ae73c92-d598-4f65-ac96-f417a55039f3' 3 | deployment_plan_name: 'install-nodejs-stack-RHEL7.2' 4 | management_ntwrk_uri: '/rest/ethernet-networks/e75ac764-6a41-47c5-8e37-53c4265d39bd' 5 | -------------------------------------------------------------------------------- /examples/ImageStreamer/hosts: -------------------------------------------------------------------------------- 1 | [nodejs-webservers] 2 | nodejs-webserver[1:4] 3 | 4 | -------------------------------------------------------------------------------- /examples/ImageStreamer/power_off_servers .yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | gather_facts: no 19 | vars: 20 | - config: "{{ playbook_dir }}/oneview_config.json" 21 | - power_state: "Off" 22 | 23 | 24 | tasks: 25 | 26 | - name: Gather facts about all Server Hardwares 27 | oneview_server_hardware_facts: 28 | config: "{{ config }}" 29 | delegate_to: localhost 30 | 31 | - debug: var=server_hardwares 32 | 33 | 34 | - name: Power Off the server hardware 35 | with_items: server_hardwares 36 | oneview_server_hardware: 37 | config: "{{ config }}" 38 | state: power_state_set 39 | data: 40 | name : '{{ item.name }}' 41 | powerStateData: 42 | powerState: "{{ power_state }}" 43 | powerControl: "MomentaryPress" 44 | delegate_to: localhost 45 | 46 | 47 | -------------------------------------------------------------------------------- /examples/ImageStreamer/power_on_servers.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | # Create a server profile with server profile template and osdeployment plan 18 | --- 19 | - hosts: rhel 20 | gather_facts: no 21 | vars: 22 | - config: "{{ playbook_dir }}/oneview_config.json" 23 | - power_state: "On" 24 | 25 | 26 | tasks: 27 | 28 | - name: Gather facts about all Server Hardwares 29 | oneview_server_hardware_facts: 30 | config: "{{ config }}" 31 | delegate_to: localhost 32 | 33 | - debug: var=server_hardwares 34 | 35 | 36 | - name: Power On the server hardware 37 | with_items: server_hardwares 38 | oneview_server_hardware: 39 | config: "{{ config }}" 40 | state: power_state_set 41 | data: 42 | name : '{{ item.name }}' 43 | powerStateData: 44 | powerState: "{{ power_state }}" 45 | powerControl: "MomentaryPress" 46 | delegate_to: localhost 47 | 48 | 49 | -------------------------------------------------------------------------------- /examples/ImageStreamer/update_server_profile_with_deployment_plan.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - name: Update RHEL 7.2 servers 18 | hosts: all 19 | gather_facts: no 20 | vars: 21 | - config: "{{ playbook_dir }}/oneview_config.json" 22 | - os_deployment_plan_name: "update-nodejs-stack-RHEL7.2" 23 | 24 | tasks: 25 | - name : "Update server profile with deployment plan {{ os_deployment_plan_name }}" 26 | delegate_to: localhost 27 | oneview_server_profile: 28 | config: "{{ config }}" 29 | state: "present" 30 | data: 31 | name: "{{ inventory_hostname }}" 32 | server_template: "webserver-template" 33 | osDeploymentSettings: 34 | osDeploymentPlanName: "{{ os_deployment_plan_name }}" 35 | 36 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | This directory contains everything you need to start provisioning with OneView and Ansible. 4 | 5 | ## Running the sample playbooks 6 | 7 | **Requirements:** To run these examples you need to execute the [Ansible OneView Setup.](https://github.com/HewlettPackard/oneview-ansible/#ansible-oneview-sdk-setup) 8 | 9 | **NOTE:** A sample configuration file is provided within the examples directory. To use it, execute the following steps: 10 | 11 | 1. `cd` into the `examples` directory. 12 | 2. Copy the `oneview_config-rename.json` file into a new file named `oneview_config.json`. 13 | 3. Modify the file inserting your credentials, OneView appliance IP or hostname, and anything else that your environment requires. 14 | 4. Some playbooks like `oneview_enclosure`, for example, need specific configurations. These are set in the `var/config.yml` file. To create the file, you should: 15 | 1. `cd` into the `examples/vars` directory. 16 | 2. Copy the `config.yml.rename` file into a new file named `config.yml`. 17 | 3. Set the variables according to your environment. 18 | 19 | :lock: Tip: Check the `oneview_config.json` file permissions, since the password is stored in clear-text. 20 | 21 | To run an Ansible playbook, execute the following command: 22 | 23 | `ansible-playbook -i .yml` 24 | -------------------------------------------------------------------------------- /examples/demos/README.md: -------------------------------------------------------------------------------- 1 | # Demos 2 | 3 | This directory contains some scenarios presented on demonstrations. 4 | 5 | -------------------------------------------------------------------------------- /examples/demos/boot_from_san_and_migration/step_3_create_server_profile_from_template.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright 2017 Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | - hosts: all 18 | vars: 19 | config: '{{ playbook_dir }}/oneview_config.json' 20 | server_hardware_name: "2-USE722C99W-M, bay 12" 21 | server_profile_template: "Windows2016_i3s" 22 | profile_name: "profile_i3s" 23 | 24 | tasks: 25 | 26 | - name : "Create Server Profile - {{ profile_name }}" 27 | oneview_server_profile: 28 | config: "{{ config }}" 29 | data: 30 | serverHardwareName: "{{ server_hardware_name }}" 31 | serverProfileTemplateName: "{{ server_profile_template }}" 32 | name: "{{ profile_name }}" 33 | delegate_to: localhost 34 | 35 | - name: Power on the server hardware 36 | oneview_server_hardware: 37 | config: "{{ config }}" 38 | state: power_state_set 39 | data: 40 | name : "{{ server_hardware.name }}" 41 | powerStateData: 42 | powerState: "On" 43 | powerControl: "MomentaryPress" 44 | delegate_to: localhost 45 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/demo/group_vars/dbservers: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | --- 18 | # The variables file used by the playbooks in the dbservers group. 19 | # These don't have to be explicitly imported by vars_files: they are autopopulated. 20 | 21 | mysqlservice: mysqld 22 | mysql_port: 3306 23 | dbuser: root 24 | dbname: foodb 25 | upassword: abc 26 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/demo/group_vars/lbservers: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | --- 18 | # Variables for the HAproxy configuration 19 | 20 | # HAProxy supports "http" and "tcp". For SSL, SMTP, etc, use "tcp". 21 | mode: http 22 | 23 | # Port on which HAProxy should listen 24 | listenport: 8888 25 | 26 | # A name for the proxy daemon, this wil be the suffix in the logs. 27 | daemonname: myapplb 28 | 29 | # Balancing Algorithm. Available options: 30 | # roundrobin, source, leastconn, source, uri 31 | # (if persistance is required use, "source") 32 | balance: roundrobin 33 | 34 | # Ethernet interface on which the load balancer should listen 35 | # Defaults to the first interface. Change this to: 36 | # 37 | # iface: eth1 38 | # 39 | # ...to override. 40 | # 41 | iface: '{{ ansible_default_ipv4.interface }}' 42 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/demo/group_vars/webservers: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | --- 18 | # Variables for the web server configuration 19 | 20 | # Ethernet interface on which the web server should listen. 21 | # Defaults to the first interface. Change this to: 22 | # 23 | # iface: eth1 24 | # 25 | # ...to override. 26 | # 27 | iface: '{{ ansible_default_ipv4.interface }}' 28 | 29 | # this is the repository that holds our sample webapp 30 | repository: https://github.com/bennojoy/mywebapp.git 31 | 32 | # this is the sha1sum of V5 of the test webapp. 33 | webapp_version: 351e47276cc66b018f4890a04709d4cc3d3edb0d 34 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/demo/hosts: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | # default user and password generated on ICsp provisioning 18 | # If you set the SSH key during the server provisioning, you don't need to 19 | # specify the credentials 20 | 21 | # If you wish, you can specify manually the IP addres that ICsp will set 22 | # to the provisioned server ethernet adapter 23 | 24 | [lbservers] 25 | demo-lb ansible_host=12.34.56.27 # ansible_user=root ansible_ssh_pass=ChangeMe123! 26 | 27 | [webservers] 28 | demo-web1 ansible_host=12.34.56.28 # ansible_user=root ansible_ssh_pass=ChangeMe123! 29 | demo-web2 ansible_host=12.34.56.29 # ansible_user=root ansible_ssh_pass=ChangeMe123! 30 | 31 | [all-servers:children] 32 | webservers 33 | lbservers 34 | 35 | 36 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/enable_all_web_servers.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This playbook does a rolling update for all webservers serially (one at a time). 3 | # Change the value of serial: to adjust the number of server to be updated. 4 | # 5 | # The three roles that apply to the webserver hosts will be applied: common, 6 | # base-apache, and web. So any changes to configuration, package updates, etc, 7 | # will be applied as part of the rolling update process. 8 | # 9 | 10 | # gather facts from monitoring nodes for iptables rules 11 | - hosts: webservers 12 | serial: 1 13 | 14 | # This play enables all web servers in the load balancer 15 | tasks: 16 | - name: enable the server in haproxy 17 | haproxy: 'state=enabled backend=myapplb host={{ inventory_hostname }} socket=/var/lib/haproxy/stats' 18 | delegate_to: "{{ item }}" 19 | with_items: "{{groups['lbservers']}}" -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/make_inventory.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | #optional, if you want to assign SH and IPs from a specific pool defined (see group_vars/all for examples) 18 | #you can also specify it directly in the inventory file 19 | 20 | - hosts: localhost 21 | tasks: 22 | - name: Assign IPs, Server HW to inventory 23 | add_host: name="{{ item.0 }}" 24 | ansible_ssh_host="{{ item.1}}" 25 | ansible_ssh_user=root 26 | server_hardware="{{ item.2 }}" 27 | with_together: 28 | - "{{ groups['all-servers'] }}" 29 | - "{{ ip_address_pool }}" 30 | - "{{ server_hardware_pool }}" 31 | 32 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/ov_site.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | --- 18 | # This playbook deploys the whole application stack in this site. 19 | #- include: make_inventory.yml 20 | 21 | - hosts: all-servers 22 | gather_facts: no 23 | roles: 24 | - hpe-oneview-server 25 | 26 | # Add the RHEL Installation Media from ICsp Media Server as a YUM repository 27 | - hosts: all-servers 28 | roles: 29 | - local-yum-repo 30 | 31 | # Configure and deploy the web servers. Note that we include two roles here, 32 | # the 'base-apache' role which simply sets up Apache, and 'web' which includes 33 | # our example web application. 34 | - hosts: webservers 35 | remote_user: root 36 | roles: 37 | - base-apache 38 | - web 39 | 40 | # Configure and deploy the load balancer(s). 41 | - hosts: lbservers 42 | remote_user: root 43 | roles: 44 | - haproxy 45 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/ov_site_clean.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | --- 18 | # This playbook deploys the whole application stack in this site. 19 | 20 | - hosts: all-servers 21 | connection: local 22 | gather_facts: no 23 | tasks: 24 | - name: Delete server 25 | oneview_server_profile: 26 | config: "{{ playbook_dir }}/../oneview_config.json" 27 | state: absent 28 | data: 29 | name: "{{ inventory_hostname }}" 30 | 31 | ignore_errors: true 32 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/base-apache/tasks/main.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | --- 18 | # This role installs httpd 19 | 20 | - name: Install http and php etc 21 | yum: name={{ item }} state=present 22 | with_items: 23 | - httpd 24 | 25 | - name: http service state 26 | service: name=httpd state=started enabled=yes 27 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/common/files/RPM-GPG-KEY-EPEL-6: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | Version: GnuPG v1.4.5 (GNU/Linux) 3 | 4 | mQINBEvSKUIBEADLGnUj24ZVKW7liFN/JA5CgtzlNnKs7sBg7fVbNWryiE3URbn1 5 | JXvrdwHtkKyY96/ifZ1Ld3lE2gOF61bGZ2CWwJNee76Sp9Z+isP8RQXbG5jwj/4B 6 | M9HK7phktqFVJ8VbY2jfTjcfxRvGM8YBwXF8hx0CDZURAjvf1xRSQJ7iAo58qcHn 7 | XtxOAvQmAbR9z6Q/h/D+Y/PhoIJp1OV4VNHCbCs9M7HUVBpgC53PDcTUQuwcgeY6 8 | pQgo9eT1eLNSZVrJ5Bctivl1UcD6P6CIGkkeT2gNhqindRPngUXGXW7Qzoefe+fV 9 | QqJSm7Tq2q9oqVZ46J964waCRItRySpuW5dxZO34WM6wsw2BP2MlACbH4l3luqtp 10 | Xo3Bvfnk+HAFH3HcMuwdaulxv7zYKXCfNoSfgrpEfo2Ex4Im/I3WdtwME/Gbnwdq 11 | 3VJzgAxLVFhczDHwNkjmIdPAlNJ9/ixRjip4dgZtW8VcBCrNoL+LhDrIfjvnLdRu 12 | vBHy9P3sCF7FZycaHlMWP6RiLtHnEMGcbZ8QpQHi2dReU1wyr9QgguGU+jqSXYar 13 | 1yEcsdRGasppNIZ8+Qawbm/a4doT10TEtPArhSoHlwbvqTDYjtfV92lC/2iwgO6g 14 | YgG9XrO4V8dV39Ffm7oLFfvTbg5mv4Q/E6AWo/gkjmtxkculbyAvjFtYAQARAQAB 15 | tCFFUEVMICg2KSA8ZXBlbEBmZWRvcmFwcm9qZWN0Lm9yZz6JAjYEEwECACAFAkvS 16 | KUICGw8GCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRA7Sd8qBgi4lR/GD/wLGPv9 17 | qO39eyb9NlrwfKdUEo1tHxKdrhNz+XYrO4yVDTBZRPSuvL2yaoeSIhQOKhNPfEgT 18 | 9mdsbsgcfmoHxmGVcn+lbheWsSvcgrXuz0gLt8TGGKGGROAoLXpuUsb1HNtKEOwP 19 | Q4z1uQ2nOz5hLRyDOV0I2LwYV8BjGIjBKUMFEUxFTsL7XOZkrAg/WbTH2PW3hrfS 20 | WtcRA7EYonI3B80d39ffws7SmyKbS5PmZjqOPuTvV2F0tMhKIhncBwoojWZPExft 21 | HpKhzKVh8fdDO/3P1y1Fk3Cin8UbCO9MWMFNR27fVzCANlEPljsHA+3Ez4F7uboF 22 | p0OOEov4Yyi4BEbgqZnthTG4ub9nyiupIZ3ckPHr3nVcDUGcL6lQD/nkmNVIeLYP 23 | x1uHPOSlWfuojAYgzRH6LL7Idg4FHHBA0to7FW8dQXFIOyNiJFAOT2j8P5+tVdq8 24 | wB0PDSH8yRpn4HdJ9RYquau4OkjluxOWf0uRaS//SUcCZh+1/KBEOmcvBHYRZA5J 25 | l/nakCgxGb2paQOzqqpOcHKvlyLuzO5uybMXaipLExTGJXBlXrbbASfXa/yGYSAG 26 | iVrGz9CE6676dMlm8F+s3XXE13QZrXmjloc6jwOljnfAkjTGXjiB7OULESed96MR 27 | XtfLk0W5Ab9pd7tKDR6QHI7rgHXfCopRnZ2VVQ== 28 | =V/6I 29 | -----END PGP PUBLIC KEY BLOCK----- 30 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/common/files/epel.repo: -------------------------------------------------------------------------------- 1 | [epel] 2 | name=Extra Packages for Enterprise Linux 6 - $basearch 3 | #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch 4 | mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch 5 | failovermethod=priority 6 | enabled=1 7 | gpgcheck=1 8 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 9 | 10 | [epel-debuginfo] 11 | name=Extra Packages for Enterprise Linux 6 - $basearch - Debug 12 | #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug 13 | mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch 14 | failovermethod=priority 15 | enabled=0 16 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 17 | gpgcheck=1 18 | 19 | [epel-source] 20 | name=Extra Packages for Enterprise Linux 6 - $basearch - Source 21 | #baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS 22 | mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch 23 | failovermethod=priority 24 | enabled=0 25 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 26 | gpgcheck=1 27 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/common/handlers/main.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | --- 18 | # Handlers for common notifications 19 | 20 | - name: restart ntp 21 | service: name=ntpd state=restarted 22 | 23 | - name: restart iptables 24 | service: name=iptables state=restarted 25 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/common/tasks/main.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | --- 18 | # This role contains common plays that will run on all nodes. 19 | 20 | - name: Install python bindings for SE Linux 21 | yum: name={{ item }} state=present 22 | with_items: 23 | - libselinux-python 24 | - libsemanage-python 25 | 26 | - name: Create the repository for EPEL 27 | copy: src=epel.repo dest=/etc/yum.repos.d/epel.repo 28 | 29 | - name: Create the GPG key for EPEL 30 | copy: src=RPM-GPG-KEY-EPEL-6 dest=/etc/pki/rpm-gpg 31 | 32 | - name: install some useful nagios plugins 33 | yum: name={{ item }} state=present 34 | with_items: 35 | - nagios-nrpe 36 | - nagios-plugins-swap 37 | - nagios-plugins-users 38 | - nagios-plugins-procs 39 | - nagios-plugins-load 40 | - nagios-plugins-disk 41 | 42 | - name: Install ntp 43 | yum: name=ntp state=present 44 | tags: ntp 45 | 46 | - name: Configure ntp file 47 | template: src=ntp.conf.j2 dest=/etc/ntp.conf 48 | tags: ntp 49 | notify: restart ntp 50 | 51 | - name: Start the ntp service 52 | service: name=ntpd state=started enabled=yes 53 | tags: ntp 54 | 55 | - name: insert iptables template 56 | template: src=iptables.j2 dest=/etc/sysconfig/iptables 57 | notify: restart iptables 58 | 59 | - name: test to see if selinux is running 60 | command: getenforce 61 | register: sestatus 62 | changed_when: false 63 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/common/templates/iptables.j2: -------------------------------------------------------------------------------- 1 | # {{ ansible_managed }} 2 | # Manual customization of this file is not recommended. 3 | *filter 4 | :INPUT ACCEPT [0:0] 5 | :FORWARD ACCEPT [0:0] 6 | :OUTPUT ACCEPT [0:0] 7 | 8 | {% if (inventory_hostname in groups['webservers']) or (inventory_hostname in groups['monitoring']) %} 9 | -A INPUT -p tcp --dport 80 -j ACCEPT 10 | {% endif %} 11 | 12 | {% if inventory_hostname in groups['dbservers'] %} 13 | -A INPUT -p tcp --dport 3306 -j ACCEPT 14 | {% endif %} 15 | 16 | {% if inventory_hostname in groups['lbservers'] %} 17 | -A INPUT -p tcp --dport {{ listenport }} -j ACCEPT 18 | {% endif %} 19 | 20 | {% for host in groups['monitoring'] %} 21 | -A INPUT -p tcp -s {{ hostvars[host].ansible_default_ipv4.address }} --dport 5666 -j ACCEPT 22 | {% endfor %} 23 | 24 | -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT 25 | -A INPUT -p icmp -j ACCEPT 26 | -A INPUT -i lo -j ACCEPT 27 | -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT 28 | -A INPUT -j REJECT --reject-with icmp-host-prohibited 29 | -A FORWARD -j REJECT --reject-with icmp-host-prohibited 30 | COMMIT 31 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/common/templates/ntp.conf.j2: -------------------------------------------------------------------------------- 1 | 2 | driftfile /var/lib/ntp/drift 3 | 4 | restrict 127.0.0.1 5 | restrict -6 ::1 6 | 7 | server {{ ntpserver }} 8 | 9 | includefile /etc/ntp/crypto/pw 10 | 11 | keys /etc/ntp/keys 12 | 13 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/haproxy/handlers/main.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | --- 18 | # Handlers for HAproxy 19 | 20 | - name: restart haproxy 21 | service: name=haproxy state=restarted 22 | 23 | - name: reload haproxy 24 | service: name=haproxy state=reloaded 25 | 26 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/haproxy/tasks/main.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | --- 18 | # This role installs HAProxy and configures it. 19 | 20 | - name: Download and install haproxy and socat 21 | yum: name={{ item }} state=present 22 | with_items: 23 | - haproxy 24 | - socat 25 | 26 | - name: Configure the haproxy cnf file with hosts 27 | template: src=haproxy.cfg.j2 dest=/etc/haproxy/haproxy.cfg 28 | notify: restart haproxy 29 | 30 | - name: Start the haproxy service 31 | service: name=haproxy state=started enabled=yes 32 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/haproxy/templates/haproxy.cfg.j2: -------------------------------------------------------------------------------- 1 | global 2 | log 127.0.0.1 local2 3 | 4 | chroot /var/lib/haproxy 5 | pidfile /var/run/haproxy.pid 6 | maxconn 4000 7 | user root 8 | group root 9 | daemon 10 | 11 | # turn on stats unix socket 12 | stats socket /var/lib/haproxy/stats level admin 13 | 14 | defaults 15 | mode {{ mode }} 16 | log global 17 | option httplog 18 | option dontlognull 19 | option http-server-close 20 | option forwardfor except 127.0.0.0/8 21 | option redispatch 22 | retries 3 23 | timeout http-request 10s 24 | timeout queue 1m 25 | timeout connect 10s 26 | timeout client 1m 27 | timeout server 1m 28 | timeout http-keep-alive 10s 29 | timeout check 10s 30 | maxconn 3000 31 | 32 | backend app 33 | {% for host in groups['lbservers'] %} 34 | listen {{ daemonname }} {{ hostvars[host]['ansible_' + iface].ipv4.address }}:{{ listenport }} 35 | {% endfor %} 36 | balance {{ balance }} 37 | {% for host in groups['webservers'] %} 38 | server {{ host }} {{ hostvars[host]['ansible_' + iface].ipv4.address }}:{{ httpd_port }} 39 | {% endfor %} 40 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/hpe-oneview-server/tasks/main.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | 18 | # Create server profiles, Deploy OS 19 | - include: deploy.yml 20 | 21 | #Ensure servers are compliant to templates. 22 | - include: make_compliant.yml 23 | delegate_to: localhost 24 | 25 | 26 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/hpe-oneview-server/tasks/make_compliant.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | - debug: msg="Server compliance state = {{ server_profile.templateCompliance }}" 18 | 19 | - debug: msg="summary of compliance issues {{ compliance_preview }} " 20 | when: server_profile.templateCompliance != 'Compliant' 21 | 22 | - name : Remediate compliance issues 23 | oneview_server_profile: 24 | config: "{{ playbook_dir }}/../oneview_config.json" 25 | state: "compliant" 26 | data: 27 | name: "{{ inventory_hostname }}" 28 | 29 | when: server_profile.templateCompliance != 'Compliant' 30 | delegate_to: localhost 31 | 32 | - name: Wait for SSH connection to server 33 | wait_for: host="{{ ansible_host | default(inventory_hostname) }}" port=22 state=started timeout=600 34 | delegate_to: localhost 35 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/hpe-oneview-server/tasks/update_firmware.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/local-yum-repo/files/installmedia.repo: -------------------------------------------------------------------------------- 1 | [InstallMedia] 2 | name=Red Hat Enterprise Linux 7.2 3 | baseurl="http://icspmediaserver.mynetwork/deployment/rhel72-x64/" 4 | gpgcheck=0 -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/local-yum-repo/tasks/main.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | --- 18 | # This role contains common plays that will run on all nodes. 19 | 20 | - name: Create the repository for RHEL Installation Media 21 | copy: src=installmedia.repo dest=/etc/yum.repos.d/installmedia.repo -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/web/files/index.php: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 22 |

23 | Deployed by HPE OneView and Ansible - served from 24 | 27 |

28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/roles/web/tasks/main.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | --- 18 | 19 | # httpd is handled by the base-apache role upstream 20 | - name: Install php and git 21 | yum: name={{ item }} state=present 22 | with_items: 23 | - php 24 | - php-mysql 25 | 26 | - name: Restart httpd 27 | service: name=httpd state=restarted 28 | 29 | #- name: Copy the code from repository 30 | # git: repo={{ repository }} version={{ webapp_version }} dest=/var/www/html/ 31 | - name: Copy web-page 32 | copy: src=index.php dest=/var/www/html/index.php -------------------------------------------------------------------------------- /examples/demos/oneview-web-farm/rolling_update.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This playbook does a rolling update for all webservers serially (one at a time). 3 | # Change the value of serial: to adjust the number of server to be updated. 4 | # 5 | # The three roles that apply to the webserver hosts will be applied: common, 6 | # base-apache, and web. So any changes to configuration, package updates, etc, 7 | # will be applied as part of the rolling update process. 8 | # 9 | 10 | - hosts: webservers 11 | serial: 1 12 | 13 | # These are the tasks to run before applying updates: 14 | pre_tasks: 15 | - name: disable the server in haproxy 16 | haproxy: 'state=disabled backend=myapplb host={{ inventory_hostname }} socket=/var/lib/haproxy/stats' 17 | delegate_to: "{{ item }}" 18 | with_items: "{{groups['lbservers']}}" 19 | 20 | roles: 21 | - hpe-oneview-server 22 | - base-apache 23 | - web 24 | 25 | # These tasks run after the roles: 26 | post_tasks: 27 | - name: wait for webserver to come up 28 | wait_for: 'host={{ ansible_host }} port=80 state=started timeout=80' 29 | 30 | - name: enable the server in haproxy 31 | haproxy: 'state=enabled backend=myapplb host={{ inventory_hostname }} socket=/var/lib/haproxy/stats' 32 | delegate_to: "{{ item }}" 33 | with_items: "{{groups['lbservers']}}" -------------------------------------------------------------------------------- /examples/files/HPE-ImageStreamer-Developer-2016-09-12.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HewlettPackard/oneview-ansible/e6fa31ebaa4ceceaacab2852d7ae5fc6fd65442f/examples/files/HPE-ImageStreamer-Developer-2016-09-12.zip -------------------------------------------------------------------------------- /examples/image_streamer_artifact_bundle_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2020) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | config: "{{ playbook_dir }}/oneview_config.json" 20 | artifact_bundle_name: 'AB_test' 21 | backup_artifact_bundle_name: 'ci-9cb654980018backup2017-01-06T12:40:07.161Z' 22 | tasks: 23 | - name: Gather facts about all Artifact Bundles 24 | image_streamer_artifact_bundle_facts: 25 | config: "{{ config }}" 26 | delegate_to: localhost 27 | - debug: var=artifact_bundles 28 | 29 | - name: Gather paginated, filtered and sorted facts about Artifact Bundles 30 | image_streamer_artifact_bundle_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 3 35 | sort: name:ascending 36 | filter: state=OK 37 | delegate_to: localhost 38 | 39 | - debug: msg="{{artifact_bundles | map(attribute='name') | list }}" 40 | 41 | - name: Gather facts about an Artifact Bundle by name 42 | image_streamer_artifact_bundle_facts: 43 | config: "{{ config }}" 44 | name: '{{ artifact_bundle_name }}' 45 | delegate_to: localhost 46 | - debug: var=artifact_bundles 47 | 48 | - name: Gather facts about all Backups for Artifact Bundle 49 | image_streamer_artifact_bundle_facts: 50 | config: "{{ config }}" 51 | options: 52 | - allBackups 53 | delegate_to: localhost 54 | - debug: var=artifact_bundle_backups 55 | -------------------------------------------------------------------------------- /examples/image_streamer_build_plan.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2020) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Create an OS Build Plan 22 | image_streamer_build_plan: 23 | config: "{{ config }}" 24 | state: present 25 | data: 26 | name: 'Demo OS Build Plan' 27 | description: "oebuildplan" 28 | oeBuildPlanType: "deploy" 29 | delegate_to: localhost 30 | 31 | - debug: var=build_plan 32 | 33 | - name: Update the OS Build Plan description and name 34 | image_streamer_build_plan: 35 | config: "{{ config }}" 36 | state: present 37 | data: 38 | name: 'Demo OS Build Plan' 39 | description: "New description" 40 | newName: 'OS Build Plan Renamed' 41 | delegate_to: localhost 42 | 43 | - debug: var=build_plan 44 | 45 | - name: Remove an OS Build Plan 46 | image_streamer_build_plan: 47 | config: "{{ config }}" 48 | state: absent 49 | data: 50 | name: 'OS Build Plan Renamed' 51 | delegate_to: localhost 52 | 53 | - name: Re-create an OS Build Plan for automation 54 | image_streamer_build_plan: 55 | config: "{{ config }}" 56 | state: present 57 | data: 58 | name: 'Demo Build Plan' 59 | description: "oebuildplan" 60 | oeBuildPlanType: "deploy" 61 | delegate_to: localhost 62 | -------------------------------------------------------------------------------- /examples/image_streamer_build_plan_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | - name: "Demo Build Plan" # change for the desired Build Plan name 21 | tasks: 22 | - name: Gather facts about all Build Plans 23 | image_streamer_build_plan_facts: 24 | config: "{{ config }}" 25 | delegate_to: localhost 26 | - debug: var=build_plans 27 | 28 | - name: Gather paginated, filtered and sorted facts about Build Plans 29 | image_streamer_build_plan_facts: 30 | config: "{{ config }}" 31 | params: 32 | start: 0 33 | count: 3 34 | sort: name:ascending 35 | filter: oeBuildPlanType=capture 36 | delegate_to: localhost 37 | - debug: var=build_plans 38 | 39 | - name: Gather facts about a Build Plan by name 40 | image_streamer_build_plan_facts: 41 | config: "{{ config }}" 42 | name: "{{ name }}" 43 | delegate_to: localhost 44 | - debug: var=build_plans 45 | -------------------------------------------------------------------------------- /examples/image_streamer_deployment_group_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | - name: "i3s" 21 | tasks: 22 | - name: Gather facts about all Deployment Groups 23 | image_streamer_deployment_group_facts: 24 | config: "{{ config }}" 25 | delegate_to: localhost 26 | 27 | - debug: var=deployment_groups 28 | 29 | - name: Gather paginated, filtered and sorted facts about Deployment Groups 30 | image_streamer_deployment_group_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 3 35 | sort: name:ascending 36 | filter: state=OK 37 | delegate_to: localhost 38 | 39 | - debug: var=deployment_groups 40 | 41 | - name: Gather facts about a Deployment Group by name 42 | image_streamer_deployment_group_facts: 43 | config: "{{ config }}" 44 | name: "{{ name }}" 45 | delegate_to: localhost 46 | 47 | - debug: var=deployment_groups 48 | -------------------------------------------------------------------------------- /examples/image_streamer_golden_image_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2020) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | - name: "Demo Golden Image" # change for the desired Golden Image name 21 | tasks: 22 | - name: Gather facts about all Golden Images 23 | image_streamer_golden_image_facts: 24 | config: "{{ config }}" 25 | delegate_to: localhost 26 | - debug: var=golden_images 27 | 28 | - name: Gather paginated, filtered and sorted facts about Golden Images 29 | image_streamer_golden_image_facts: 30 | config: "{{ config }}" 31 | params: 32 | start: 0 33 | count: 3 34 | sort: name:ascending 35 | filter: importedFromBundle=true 36 | delegate_to: localhost 37 | - debug: var=golden_images 38 | 39 | - name: Gather facts about a Golden Image by name 40 | image_streamer_golden_image_facts: 41 | config: "{{ config }}" 42 | name: "{{ name }}" 43 | delegate_to: localhost 44 | - debug: var=golden_images 45 | -------------------------------------------------------------------------------- /examples/image_streamer_os_volume_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2020) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | - name: "OSVolume-1" 21 | tasks: 22 | - name: Gather facts about all OS Volumes 23 | image_streamer_os_volume_facts: 24 | config: "{{ config }}" 25 | delegate_to: localhost 26 | 27 | - debug: var=os_volumes 28 | 29 | - name: Gather paginated, filtered and sorted facts about OS Volumes 30 | image_streamer_os_volume_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 3 35 | sort: name:ascending 36 | filter: status=OK 37 | delegate_to: localhost 38 | 39 | - debug: var=os_volumes 40 | 41 | - name: Gather facts about an OS Volume by name 42 | image_streamer_os_volume_facts: 43 | config: "{{ config }}" 44 | name: "{{ name }}" 45 | delegate_to: localhost 46 | 47 | - debug: var=os_volumes 48 | 49 | - name: Get archived logs of an OS volume 50 | image_streamer_os_volume_facts: 51 | config: "{{ config }}" 52 | name: "{{ name }}" 53 | options: 54 | - getArchivedLogs: 55 | file_path: './archived.logs' 56 | delegate_to: localhost 57 | 58 | - debug: var=log_file_path 59 | 60 | - name: Gather facts about storage of an OS volume 61 | image_streamer_os_volume_facts: 62 | config: "{{ config }}" 63 | name: "{{ name }}" 64 | options: 65 | - getStorage 66 | delegate_to: localhost 67 | 68 | - debug: var=storage 69 | -------------------------------------------------------------------------------- /examples/image_streamer_plan_script_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2020) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is only available on HPE Synergy 18 | - hosts: all 19 | vars: 20 | config: "{{ playbook_dir }}/oneview_config.json" 21 | plan_script_name: "Demo Plan Script" 22 | tasks: 23 | - name: Gather facts about all Plan Scripts 24 | image_streamer_plan_script_facts: 25 | config: "{{ config }}" 26 | delegate_to: localhost 27 | - debug: var=plan_scripts 28 | 29 | - name: Gather paginated, filtered and sorted facts about Plan Scripts 30 | image_streamer_plan_script_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 3 35 | sort: name:ascending 36 | filter: planType=capture 37 | delegate_to: localhost 38 | - debug: var=plan_scripts 39 | 40 | - name: Gather facts about a Plan Script by name 41 | image_streamer_plan_script_facts: 42 | config: "{{ config }}" 43 | name: "{{ plan_script_name }}" 44 | delegate_to: localhost 45 | - debug: var=plan_scripts 46 | 47 | - name: Gather facts about the build plans of given plan script. 48 | image_streamer_plan_script_facts: 49 | config: "{{ config }}" 50 | name: "{{ plan_script_name }}" 51 | options: 52 | - getUseby 53 | delegate_to: localhost 54 | - debug: var=use_by 55 | -------------------------------------------------------------------------------- /examples/infrastructure_as_code/README.md: -------------------------------------------------------------------------------- 1 | # Infrastructure as code with HPE OneView and Ansible 2 | 3 | Ansible playbooks to provision bare metal infrastructure with [HPE OneView](https://hpe.com/info/oneview) and the [oneview-ansible](https://github.com/HewlettPackard/oneview-ansible) module. 4 | 5 | ## Use case 6 | 7 | Configure a hardware server with boot settings and a network connection, then boot the server. 8 | 9 | ## Running the sample 10 | 11 | * Edit `oneview-config.json` and provide the IP address and credentials for OneView. 12 | * Edit `infrastructure-config.yml` Provide names for the server profile template and server profile that will be created. Provide the names of the enclosure group, hardware server type, hardware server, and network that will be provisioned. 13 | * Run the playbook that will create the server profile template: 14 | 15 | ```console 16 | ansible-playbook server_profile_template.yml 17 | ``` 18 | 19 | * Run the playbook that will create a server profile, provision the hardware, and boot the server: 20 | 21 | ```console 22 | ansible-playbook server_profile.yml 23 | ``` 24 | 25 | In the spirit of "Leave no Trace", the playbook `clean.yml` will remove all artifacts. 26 | -------------------------------------------------------------------------------- /examples/infrastructure_as_code/clean.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2020) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | # This playbook will do cleanup after server profile creation. 18 | # Cleanup includes power off server hardware, delete server profile and server profile template 19 | --- 20 | - hosts: all 21 | gather_facts: no 22 | 23 | vars: 24 | # Provide the OneView IP address and credentials in oneview-config.json 25 | config: "{{ playbook_dir }}/../oneview_config.json" 26 | 27 | vars_files: 28 | # Provide the names for the server profile template, server profile, and 29 | # server hardware in infrastructure-config.yml 30 | - "{{ playbook_dir }}/infrastructure-config.yml" 31 | 32 | tasks: 33 | - name: Power Off the server hardware 34 | oneview_server_hardware: 35 | config: "{{ config }}" 36 | state: power_state_set 37 | data: 38 | name : '{{ server_hardware }}' 39 | powerStateData: 40 | powerState: "Off" 41 | powerControl: "MomentaryPress" 42 | delegate_to: localhost 43 | 44 | - name: Delete the Server Profile 45 | oneview_server_profile: 46 | config: "{{ config }}" 47 | state: "absent" 48 | data: 49 | name: "{{ server_profile }}" 50 | delegate_to: localhost 51 | 52 | - name: Delete the Server Profile Template 53 | oneview_server_profile_template: 54 | config: "{{ config }}" 55 | state: absent 56 | data: 57 | name: "{{ server_profile_template }}" 58 | params: 59 | force: True # Supprted only for API version >= 600 60 | delegate_to: localhost 61 | -------------------------------------------------------------------------------- /examples/infrastructure_as_code/infrastructure-config.yml: -------------------------------------------------------------------------------- 1 | # This file contains all the variable names used in server profile and template creation. 2 | --- 3 | # Name for the created server profile template 4 | server_profile_template: SPT_sample 5 | 6 | # Name for the created server profile 7 | server_profile: serverProfile_sample 8 | 9 | # Name of the enclosure group 10 | enclosure_group: EG 11 | 12 | # Name of the server hardware type 13 | server_hardware_type: SY 480 Gen10 1 14 | 15 | # Name of the server hardware 16 | server_hardware: 0000A66101, bay 11 17 | 18 | # Name of the network 19 | network: mgmt 20 | -------------------------------------------------------------------------------- /examples/infrastructure_as_code/server_profile.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2020) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | # This playbook will create server profile using template and powers on hardware after profile creation 17 | --- 18 | - hosts: all 19 | gather_facts: no 20 | 21 | vars: 22 | # Provide the OneView IP address and credentials in oneview-config.json 23 | config: "{{ playbook_dir }}/../oneview_config.json" 24 | 25 | vars_files: 26 | # Provide the names for the server profile template, server profile, and 27 | # server hardware in infrastructure-config.yml 28 | - "{{ playbook_dir }}/infrastructure-config.yml" 29 | 30 | tasks: 31 | - name: Create a Server Profile from a Server Profile Template 32 | oneview_server_profile: 33 | config: "{{ config }}" 34 | data: 35 | serverProfileTemplateName: "{{ server_profile_template }}" 36 | serverHardwareName: "{{ server_hardware }}" 37 | name: "{{ server_profile }}" 38 | params: 39 | force: True 40 | delegate_to: localhost 41 | register: result 42 | 43 | - debug: msg="{{ result.msg }}" 44 | - debug: msg="{{ result }}" 45 | 46 | - name: Power On the server hardware 47 | oneview_server_hardware: 48 | config: "{{ config }}" 49 | state: power_state_set 50 | data: 51 | name : "{{ server_hardware }}" 52 | powerStateData: 53 | powerState: "On" 54 | powerControl: "MomentaryPress" 55 | delegate_to: localhost 56 | -------------------------------------------------------------------------------- /examples/oneview_alert_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about the last 2 alerts 22 | oneview_alert_facts: 23 | config: "{{ config }}" 24 | params: 25 | count: 2 26 | delegate_to: localhost 27 | 28 | - debug: var=alerts 29 | 30 | - name: Gather facts about the alerts with state 'Cleared' 31 | oneview_alert_facts: 32 | config: "{{ config }}" 33 | params: 34 | count: 2 35 | filter: "alertState='Cleared'" 36 | delegate_to: localhost 37 | 38 | - debug: var=alerts 39 | 40 | - name: Gather facts about the alerts with urgency 'High' 41 | oneview_alert_facts: 42 | config: "{{ config }}" 43 | params: 44 | count: 5 45 | filter: "urgency='High'" 46 | delegate_to: localhost 47 | 48 | - debug: var=alerts 49 | -------------------------------------------------------------------------------- /examples/oneview_appliance_configuration_timeconfig_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about the Appliance configuration Timeconfig 22 | oneview_appliance_configuration_timeconfig_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: var=appliance_configuration_timeconfig 27 | -------------------------------------------------------------------------------- /examples/oneview_appliance_device_read_community.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Ensure that the Appliance Device Read Community is present with Community String 'public' 22 | oneview_appliance_device_read_community: 23 | config: "{{ config }}" 24 | state: present 25 | data: 26 | communityString: 'public' 27 | delegate_to: localhost 28 | 29 | - debug: 30 | var: appliance_device_read_community -------------------------------------------------------------------------------- /examples/oneview_appliance_device_read_community_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about the Appliance snmp configuration 22 | oneview_appliance_device_read_community_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: 27 | var: appliance_device_read_community 28 | -------------------------------------------------------------------------------- /examples/oneview_appliance_device_snmp_v1_trap_destinations_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about all appliance SNMPv1 trap forwarding destinations. 22 | oneview_appliance_device_snmp_v1_trap_destinations_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: 27 | var: appliance_device_snmp_v1_trap_destinations 28 | 29 | - name: Gather paginated, filtered and sorted facts about SNMPv1 trap forwarding destinations 30 | oneview_appliance_device_snmp_v1_trap_destinations_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 3 35 | filter: "port='162'" 36 | delegate_to: localhost 37 | 38 | - debug: 39 | var: appliance_device_snmp_v1_trap_destinations 40 | 41 | - name: Gather facts about a Trap Destination by name 42 | oneview_appliance_device_snmp_v1_trap_destinations_facts: 43 | config: "{{ config }}" 44 | name: "1.1.1.1" 45 | delegate_to: localhost 46 | 47 | - debug: 48 | var: appliance_device_snmp_v1_trap_destinations 49 | 50 | - name: Gather facts about a Trap Destination by Uri 51 | oneview_appliance_device_snmp_v1_trap_destinations_facts: 52 | config: "{{ config }}" 53 | uri: "{{ appliance_device_snmp_v1_trap_destinations['uri'] }}" 54 | delegate_to: localhost 55 | when: appliance_device_snmp_v1_trap_destinations == True 56 | 57 | - debug: 58 | var: appliance_device_snmp_v1_trap_destinations 59 | -------------------------------------------------------------------------------- /examples/oneview_appliance_device_snmp_v3_trap_destinations_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about the appliance SNMPv3 trap forwarding destinations. 22 | oneview_appliance_device_snmp_v3_trap_destinations_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: 27 | var: appliance_device_snmp_v3_trap_destinations 28 | 29 | - name: Gather paginated, filtered and sorted facts about SNMPv3 trap forwarding destinations 30 | oneview_appliance_device_snmp_v3_trap_destinations_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 3 35 | sort: 'destinationAddress:descending' 36 | filter: "port='162'" 37 | delegate_to: localhost 38 | 39 | - debug: 40 | var: appliance_device_snmp_v3_trap_destinations 41 | 42 | - name: Gather facts about a Trap Destination by ip address 43 | oneview_appliance_device_snmp_v3_trap_destinations_facts: 44 | config: "{{ config }}" 45 | name: "1.1.1.1" 46 | delegate_to: localhost 47 | 48 | - debug: 49 | var: appliance_device_snmp_v3_trap_destinations 50 | 51 | - name: Gather facts about a Trap Destination by uri 52 | oneview_appliance_device_snmp_v3_trap_destinations_facts: 53 | config: "{{ config }}" 54 | uri: "{{ appliance_device_snmp_v3_trap_destinations['uri'] }}" 55 | delegate_to: localhost 56 | -------------------------------------------------------------------------------- /examples/oneview_appliance_device_snmp_v3_users_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about the appliance SNMPv3 users. 22 | oneview_appliance_device_snmp_v3_users_facts: 23 | config: "{{ config }}" 24 | 25 | - debug: 26 | var: appliance_device_snmp_v3_users 27 | 28 | - name: Gather paginated, filtered and sorted facts about SNMPv3 users 29 | oneview_appliance_device_snmp_v3_users_facts: 30 | config: "{{ config }}" 31 | params: 32 | start: 0 33 | count: 4 34 | sort: 'userName:ascending' 35 | filter: "securityLevel='Authentication and privacy'" 36 | delegate_to: localhost 37 | 38 | - debug: 39 | var: appliance_device_snmp_v3_users 40 | 41 | - name: Gather facts about a snmp users by Username 42 | oneview_appliance_device_snmp_v3_users_facts: 43 | config: "{{ config }}" 44 | name: "user123456" 45 | delegate_to: localhost 46 | - debug: 47 | var: appliance_device_snmp_v3_users 48 | 49 | - name: Gather facts about a SNMPv3 user by Uri 50 | oneview_appliance_device_snmp_v3_users_facts: 51 | config: "{{ config }}" 52 | uri: "{{ appliance_device_snmp_v3_users['uri'] }}" 53 | delegate_to: localhost 54 | when: appliance_device_snmp_v3_users == True 55 | -------------------------------------------------------------------------------- /examples/oneview_appliance_ssh_access.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Ensures the Appliance SSH Access is false 22 | oneview_appliance_ssh_access: 23 | config: "{{ config }}" 24 | state: present 25 | data: 26 | allowSshAccess: False 27 | delegate_to: localhost 28 | - debug: var=appliance_ssh_access 29 | 30 | - name: Ensures the Appliance SSH Access is true 31 | oneview_appliance_ssh_access: 32 | config: "{{ config }}" 33 | state: present 34 | data: 35 | allowSshAccess: True 36 | delegate_to: localhost 37 | - debug: var=appliance_ssh_access 38 | -------------------------------------------------------------------------------- /examples/oneview_appliance_ssh_access_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about the Appliance SSH Access 22 | oneview_appliance_ssh_access_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | - debug: var=appliance_ssh_access 26 | -------------------------------------------------------------------------------- /examples/oneview_appliance_time_and_locale_configuration.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Add the Appliance time and locale configuration locale is ja_JP.UTF-8 22 | oneview_appliance_time_and_locale_configuration: 23 | config: "{{ config }}" 24 | state: present 25 | data: 26 | locale: ja_JP.UTF-8 27 | ntpServers: [16.110.135.123] 28 | timezone: UTC 29 | type: TimeAndLocale 30 | delegate_to: localhost 31 | - debug: var=appliance_time_and_locale_configuration 32 | 33 | - name: Ensures the Appliance time and locale configuration locale is ja_JP.UTF-8 is already present 34 | oneview_appliance_time_and_locale_configuration: 35 | config: "{{ config }}" 36 | state: present 37 | data: 38 | locale: ja_JP.UTF-8 39 | ntpServers: [16.110.135.123] 40 | timezone: UTC 41 | type: TimeAndLocale 42 | delegate_to: localhost 43 | - debug: var=appliance_time_and_locale_configuration 44 | 45 | - name: Change the Appliance time and locale configuration locale to en_US.UTF-8 46 | oneview_appliance_time_and_locale_configuration: 47 | config: "{{ config }}" 48 | state: present 49 | data: 50 | locale: en_US.UTF-8 51 | ntpServers: [16.110.135.123] 52 | timezone: UTC 53 | type: TimeAndLocale 54 | delegate_to: localhost 55 | - debug: var=appliance_time_and_locale_configuration 56 | -------------------------------------------------------------------------------- /examples/oneview_appliance_time_and_locale_configuration_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about the Appliance time and locale configuration 22 | oneview_appliance_time_and_locale_configuration_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: var=appliance_time_and_locale_configuration 27 | -------------------------------------------------------------------------------- /examples/oneview_certificates_server_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2020) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about a Server Certificate by remote address 22 | oneview_certificates_server_facts: 23 | config: "{{ config }}" 24 | remote: "172.18.13.11" 25 | delegate_to: localhost 26 | 27 | - debug: var=remote_certificate['certificateDetails'][0]['base64Data'] 28 | 29 | - name: Gather facts about a Server Certificate by alias_name 30 | oneview_certificates_server_facts: 31 | config: "{{ config }}" 32 | aliasName: "172.18.13.11" 33 | delegate_to: localhost 34 | 35 | - debug: var=certificates_server 36 | -------------------------------------------------------------------------------- /examples/oneview_config-rename.json: -------------------------------------------------------------------------------- 1 | { 2 | "ip": "", 3 | "credentials": { 4 | "userName": "", 5 | "password": "", 6 | "authLoginDomain": "" 7 | }, 8 | "image_streamer_ip": "", 9 | "api_version": 2800, 10 | "storage_domain": "TestDomain", 11 | "storage_system_name" : "ThreePAR-1", 12 | "storage_system_ip" : "", 13 | "storage_system_username" : "", 14 | "storage_system_password" : "", 15 | "storage_pool_name": "cpg-growth-limit-1TiB", 16 | "server_profile_name": "sp1", 17 | "storage_volume_name": "Volume with Storage Pool", 18 | "snapshot_name": "Testing facts_20160823201021", 19 | "server_hardware_hostname": "", 20 | "server_hardware_username": "", 21 | "server_hardware_password": "", 22 | "logical_interconnect_name": "LIG", 23 | "volume_template_name": "svt1", 24 | "scope_name": "MySampleScope", 25 | "interconnect_ip": "fe80::2:0:c:1", 26 | "interconnect_ip_for_update": "fe80::2:0:c:1", 27 | "port_id": "748d4699-62ff-454e-8ec8-773815c4aa2f:d1", 28 | "hypervisor_manager_username": "", 29 | "hypervisor_manager_password": "" 30 | } 31 | -------------------------------------------------------------------------------- /examples/oneview_connection_template.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about all connection templates 22 | oneview_connection_template_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - set_fact: ct_name={{ connection_templates[0]['name'] }} 27 | 28 | - name: Update the Connection Template 29 | oneview_connection_template: 30 | config: "{{ config }}" 31 | state: present 32 | data: 33 | name: "{{ ct_name }}" 34 | type : "connection-template" 35 | bandwidth : 36 | maximumBandwidth : 10000 37 | typicalBandwidth : 2000 38 | newName : "CT-23" 39 | delegate_to: localhost 40 | 41 | - name: Update back the Connection Template 42 | oneview_connection_template: 43 | config: "{{ config }}" 44 | state: present 45 | data: 46 | name: "CT-23" 47 | type : "connection-template" 48 | bandwidth : 49 | maximumBandwidth : 10000 50 | typicalBandwidth : 2000 51 | newName : "{{ ct_name }}" 52 | delegate_to: localhost 53 | -------------------------------------------------------------------------------- /examples/oneview_connection_template_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2019) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | - connection_template_name: 'name2139069875-1471287701836' 21 | tasks: 22 | - name: Gather facts about all Connection Templates 23 | oneview_connection_template_facts: 24 | config: "{{ config }}" 25 | delegate_to: localhost 26 | 27 | - debug: var=connection_templates 28 | 29 | - name: Gather paginated, filtered and sorted facts about Connection Template 30 | oneview_connection_template_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 3 35 | sort: 'name:descending' 36 | filter: 'name=defaultConnectionTemplate' 37 | 38 | - debug: var=connection_templates 39 | 40 | - name: Gather facts about a Connection Template by name 41 | oneview_connection_template_facts: 42 | config: "{{ config }}" 43 | name: '{{ connection_template_name }}' 44 | delegate_to: localhost 45 | 46 | - debug: var=connection_templates 47 | 48 | 49 | - name: Gather facts about the Default Connection Template 50 | oneview_connection_template_facts: 51 | config: "{{ config }}" 52 | options: 53 | - defaultConnectionTemplate 54 | delegate_to: localhost 55 | 56 | - debug: var=default_connection_template 57 | -------------------------------------------------------------------------------- /examples/oneview_datacenter_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | - datacenter_name: "MyDatacenter" # The name of an existent Data Center must be set to run this example 21 | tasks: 22 | - name: Gather facts about all Data Centers 23 | oneview_datacenter_facts: 24 | config: "{{ config }}" 25 | delegate_to: localhost 26 | 27 | - debug: var=datacenters 28 | 29 | - name: Gather paginated, filtered and sorted facts about Data Centers 30 | oneview_datacenter_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 3 35 | sort: 'name:descending' 36 | filter: 'state=Unmanaged' 37 | 38 | - debug: var=datacenters 39 | 40 | - name: Gather facts about a Data Center by name 41 | oneview_datacenter_facts: 42 | config: "{{ config }}" 43 | name: "{{ datacenter_name }}" 44 | delegate_to: localhost 45 | 46 | - debug: var=datacenters 47 | 48 | 49 | - name: Gather facts about the Data Center Visual Content 50 | oneview_datacenter_facts: 51 | config: "{{ config }}" 52 | name: "{{ datacenter_name }}" 53 | options: 54 | - visualContent 55 | delegate_to: localhost 56 | 57 | - debug: var=datacenters 58 | - debug: var=datacenter_visual_content 59 | -------------------------------------------------------------------------------- /examples/oneview_drive_enclosure.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is only available on HPE Synergy 18 | - hosts: all 19 | vars: 20 | - config_file_path: "{{ playbook_dir }}/oneview_config.json" 21 | - drive_enclosure_name: '0000A66101, bay 1' 22 | tasks: 23 | - name: Power On the Drive Enclosure 24 | oneview_drive_enclosure: 25 | config: "{{ config_file_path }}" 26 | state: power_state_set 27 | data: 28 | name: "{{ drive_enclosure_name }}" 29 | powerState: 'On' 30 | delegate_to: localhost 31 | 32 | - name: Power off the UID for the Drive Enclosure 33 | oneview_drive_enclosure: 34 | config: "{{ config_file_path }}" 35 | state: uid_state_set 36 | data: 37 | name: "{{ drive_enclosure_name }}" 38 | uidState: 'Off' 39 | delegate_to: localhost 40 | 41 | - name: Request a hard reset of the Drive Enclosure 42 | oneview_drive_enclosure: 43 | config: "{{ config_file_path }}" 44 | state: hard_reset_state_set 45 | data: 46 | name: "{{ drive_enclosure_name }}" 47 | delegate_to: localhost 48 | 49 | - name: Refresh the Drive Enclosure 50 | oneview_drive_enclosure: 51 | config: "{{ config_file_path }}" 52 | state: refresh_state_set 53 | data: 54 | name: "{{ drive_enclosure_name }}" 55 | refreshState: 'RefreshPending' 56 | delegate_to: localhost 57 | -------------------------------------------------------------------------------- /examples/oneview_drive_enclosure_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is only available on HPE Synergy 18 | - hosts: all 19 | vars: 20 | - config: "{{ playbook_dir }}/oneview_config.json" 21 | - name: "0000A66102, bay 1" # Set the name of an existent Drive Enclosure to run this example 22 | tasks: 23 | - name: Gather facts about all Drive Enclosures 24 | oneview_drive_enclosure_facts: 25 | config: "{{ config }}" 26 | delegate_to: localhost 27 | 28 | - debug: var=drive_enclosures 29 | 30 | - name: Gather paginated, filtered and sorted facts about Drive Enclosures 31 | oneview_drive_enclosure_facts: 32 | config: "{{ config }}" 33 | params: 34 | start: 0 35 | count: 3 36 | sort: 'name:descending' 37 | filter: 'status=Warning' 38 | 39 | - debug: var=drive_enclosures 40 | 41 | - name: Gather facts about a Drive Enclosure by name 42 | oneview_drive_enclosure_facts: 43 | config: "{{ config }}" 44 | name: "{{ name }}" 45 | delegate_to: localhost 46 | 47 | - debug: var=drive_enclosures 48 | 49 | - name: Gather facts about a Drive Enclosure by name with options 50 | oneview_drive_enclosure_facts: 51 | config: "{{ config }}" 52 | name: '{{ name }}' 53 | options: 54 | - portMap # optional 55 | 56 | delegate_to: localhost 57 | 58 | - debug: var=drive_enclosures 59 | - debug: var=drive_enclosure_port_map 60 | -------------------------------------------------------------------------------- /examples/oneview_enclosure_group_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | - name: "EG" 21 | tasks: 22 | - name: Gather facts about all Enclosure Groups 23 | oneview_enclosure_group_facts: 24 | config: "{{ config }}" 25 | delegate_to: localhost 26 | 27 | - debug: var=enclosure_groups 28 | 29 | - name: Gather facts about all Scopes 30 | oneview_scope_facts: 31 | config: "{{ config }}" 32 | delegate_to: localhost 33 | 34 | - name: Gather paginated, filtered and sorted facts about Enclosure Groups 35 | oneview_enclosure_group_facts: 36 | config: "{{ config }}" 37 | params: 38 | start: 0 39 | count: 3 40 | sort: 'name:descending' 41 | filter: 'status=OK' 42 | scope_uris: "{{ scopes[0]['uri'] }}" 43 | delegate_to: localhost 44 | when: scopes == True 45 | 46 | - debug: var=enclosure_groups 47 | 48 | - name: Gather facts about an Enclosure Group by name 49 | oneview_enclosure_group_facts: 50 | config: "{{ config }}" 51 | name: "{{ name }}" 52 | delegate_to: localhost 53 | 54 | - debug: var=enclosure_groups 55 | 56 | - name: Gather facts about an Enclosure Group by name with configuration script 57 | oneview_enclosure_group_facts: 58 | config: "{{ config }}" 59 | name: "{{ name }}" 60 | options: 61 | - configuration_script 62 | delegate_to: localhost 63 | 64 | - debug: var=enclosure_group_script 65 | -------------------------------------------------------------------------------- /examples/oneview_ethernet_network_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2019) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about all Ethernet Networks 22 | oneview_ethernet_network_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: var=ethernet_networks 27 | 28 | - name: Gather paginated, sorted and filtered facts about Ethernet Networks 29 | oneview_ethernet_network_facts: 30 | config: "{{ config }}" 31 | params: 32 | start: 0 33 | count: 3 34 | sort: 'name:descending' 35 | filter: "purpose=General" 36 | 37 | - debug: var=ethernet_networks 38 | 39 | - name: Gather facts about an Ethernet Network by name 40 | oneview_ethernet_network_facts: 41 | config: "{{ config }}" 42 | name: "{{ ethernet_networks[0]['name'] }}" 43 | delegate_to: localhost 44 | 45 | - debug: var=ethernet_networks 46 | 47 | - name: Gather facts about an Ethernet Network by name with options 48 | oneview_ethernet_network_facts: 49 | config: "{{ config }}" 50 | name: "{{ ethernet_networks['name'] }}" 51 | options: 52 | - associatedProfiles 53 | - associatedUplinkGroups 54 | delegate_to: localhost 55 | 56 | - debug: var=enet_associated_profiles 57 | - debug: var=enet_associated_uplink_groups 58 | -------------------------------------------------------------------------------- /examples/oneview_event.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Create a basic Event 22 | oneview_event: 23 | config: "{{ config }}" 24 | state: present 25 | data: 26 | description: This is a very simple test event 27 | eventTypeID: hp.justATest 28 | eventDetails: 29 | - eventItemName: ipv4Address 30 | eventItemValue: 198.51.100.5 31 | isThisVarbindData: false 32 | varBindOrderIndex: -1 33 | delegate_to: localhost 34 | register: event_1 35 | 36 | - name: Create an Event 37 | oneview_event: 38 | config: "{{ config }}" 39 | state: present 40 | data: 41 | description: This is a very simple test event 42 | serviceEventSource: true 43 | serviceEventDetails: 44 | caseId: 1234 45 | primaryContact: contactDetails 46 | remoteSupportState: Submitted 47 | severity: OK 48 | healthCategory: PROCESSOR 49 | eventTypeID: hp.justATest 50 | rxTime: '2012-05-14T20:23:56.688Z' 51 | urgency: None 52 | eventDetails: 53 | - eventItemName: ipv4Address 54 | eventItemValue: 198.51.100.5 55 | isThisVarbindData: false 56 | varBindOrderIndex: -1 57 | delegate_to: localhost 58 | register: event_1 59 | -------------------------------------------------------------------------------- /examples/oneview_event_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2020) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about all Events 22 | oneview_event_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: var=events 27 | 28 | - name: Gather paginated, filtered and sorted facts about Events 29 | oneview_event_facts: 30 | config: "{{ config }}" 31 | params: 32 | start: 0 33 | count: 3 34 | sort: description:descending 35 | filter: eventTypeID=Appliance.Startup 36 | - debug: var=events 37 | -------------------------------------------------------------------------------- /examples/oneview_fabric.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This module is only available on HPE Synergy. 18 | - hosts: all 19 | vars: 20 | - config: "{{ playbook_dir }}/oneview_config.json" 21 | - name: "DefaultFabric" 22 | tasks: 23 | - name: Update the range of the fabric 24 | oneview_fabric: 25 | config: '{{ config }}' 26 | state: reserved_vlan_range_updated 27 | data: 28 | name: '{{ name }}' 29 | reservedVlanRangeParameters: 30 | start: '300' 31 | length: '62' 32 | delegate_to: localhost 33 | 34 | -------------------------------------------------------------------------------- /examples/oneview_fabric_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | --- 18 | - hosts: all 19 | vars: 20 | - config: "{{ playbook_dir }}/oneview_config.json" 21 | - name: "DefaultFabric" 22 | tasks: 23 | - name: Gather facts about all Fabrics 24 | oneview_fabric_facts: 25 | config: "{{ config }}" 26 | delegate_to: localhost 27 | - debug: var=fabrics 28 | 29 | - name: Gather paginated, filtered and sorted facts about Fabrics 30 | oneview_fabric_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 3 35 | sort: 'name:descending' 36 | filter: 'name=DefaultFabric' 37 | 38 | - debug: var=fabrics 39 | 40 | - name: Gather facts about a Fabric by name 41 | oneview_fabric_facts: 42 | config: "{{ config }}" 43 | name: "{{ name }}" 44 | delegate_to: localhost 45 | - debug: var=fabrics 46 | 47 | # This option is only available on HPE Synergy. 48 | - name: Gather facts about a Fabric by name with options 49 | oneview_fabric_facts: 50 | config: "{{ config }}" 51 | name: "{{ name }}" 52 | options: 53 | - reservedVlanRange # optional 54 | delegate_to: localhost 55 | - debug: var=fabrics 56 | -------------------------------------------------------------------------------- /examples/oneview_fc_network_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2019) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about all Fibre Channel Networks 22 | oneview_fc_network_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: var=fc_networks 27 | 28 | - name: Gather paginated, filtered and sorted facts about Fibre Channel Networks 29 | oneview_fc_network_facts: 30 | config: "{{ config }}" 31 | params: 32 | start: 0 33 | count: 3 34 | sort: 'name:descending' 35 | filter: 'fabricType=FabricAttach' 36 | - debug: var=fc_networks 37 | 38 | - name: Gather facts about a Fibre Channel Network by name 39 | oneview_fc_network_facts: 40 | config: "{{ config }}" 41 | name: "{{ fc_networks[0]['name'] }}" 42 | delegate_to: localhost 43 | when: fc_networks == True 44 | 45 | - debug: var=fc_networks 46 | -------------------------------------------------------------------------------- /examples/oneview_fcoe_network_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2019) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about all FCoE Networks 22 | oneview_fcoe_network_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: var=fcoe_networks 27 | 28 | - name: Gather paginated, filtered and sorted facts about FCoE Networks 29 | oneview_fcoe_network_facts: 30 | config: "{{ config }}" 31 | params: 32 | start: 0 33 | count: 3 34 | sort: 'name:descending' 35 | filter: 'vlanId=2' 36 | 37 | - debug: var=fcoe_networks 38 | 39 | - name: Gather facts about a FCoE Network by name 40 | oneview_fcoe_network_facts: 41 | config: "{{ config }}" 42 | name: "{{ fcoe_networks[0]['name'] }}" 43 | delegate_to: localhost 44 | when: (fcoe_networks is not none and fcoe_networks is undefined) 45 | 46 | - debug: var=fcoe_networks 47 | -------------------------------------------------------------------------------- /examples/oneview_firmware_bundle.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Ensure that a firmware bundle is present 22 | oneview_firmware_bundle: 23 | config: "{{ config }}" 24 | state: present 25 | file_path: "/home/user/Downloads/hp-firmware-hdd-a1b08f8a6b-HPGH-1.1.x86_64.rpm" 26 | delegate_to: localhost 27 | - debug: var=firmware_bundle 28 | -------------------------------------------------------------------------------- /examples/oneview_firmware_driver_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about all Firmware Drivers 22 | oneview_firmware_driver_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: var=firmware_drivers 27 | 28 | - name: Gather paginated, filtered and sorted facts about Firmware Drivers 29 | oneview_firmware_driver_facts: 30 | config: "{{ config }}" 31 | params: 32 | start: 0 33 | count: 3 34 | sort: 'name:descending' 35 | delegate_to: localhost 36 | 37 | - debug: var=firmware_drivers 38 | 39 | - name: Gather facts about a Firmware Driver by name 40 | oneview_firmware_driver_facts: 41 | config: "{{ config }}" 42 | name: "Service Pack for Synergy" 43 | delegate_to: localhost 44 | 45 | - debug: var=firmware_drivers 46 | 47 | - name: Gather facts about a Firmware Driver by name and version 48 | oneview_firmware_driver_facts: 49 | config: "{{ config }}" 50 | name: "Service Pack for Synergy" 51 | version: "SY-2021.02.01" 52 | delegate_to: localhost 53 | 54 | - debug: var=firmware_drivers 55 | 56 | - name: Gather facts about Firmware Driver with options 57 | oneview_firmware_driver_facts: 58 | config: "{{ config }}" 59 | options: 60 | - schema 61 | delegate_to: localhost 62 | 63 | - debug: var=schema 64 | -------------------------------------------------------------------------------- /examples/oneview_hypervisor_manager_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2020) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about all Hypervisor Managers 22 | oneview_hypervisor_manager_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: var=hypervisor_managers 27 | 28 | - name: Gather paginated, filtered and sorted facts about Hypervisor Managers 29 | oneview_hypervisor_manager_facts: 30 | config: "{{ config }}" 31 | params: 32 | start: 0 33 | count: 3 34 | sort: 'name:descending' 35 | filter: 'hypervisorType=Vmware' 36 | - debug: var=hypervisor_managers 37 | 38 | - name: Gather facts about a Hypervisor Manager by name 39 | oneview_hypervisor_manager_facts: 40 | config: "{{ config }}" 41 | name: "172.18.13.11" 42 | delegate_to: localhost 43 | 44 | - debug: var=hypervisor_managers 45 | -------------------------------------------------------------------------------- /examples/oneview_id_pools_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | config: "{{ playbook_dir }}/oneview_config.json" 20 | poolType: 'vmac' 21 | tasks: 22 | - name: Get schema of the id pools 23 | oneview_id_pools_facts: 24 | config: "{{ config }}" 25 | state: schema 26 | data: 27 | description: 'ID pool schema' 28 | delegate_to: localhost 29 | 30 | - name: Generates a random range 31 | oneview_id_pools_facts: 32 | config: "{{ config }}" 33 | state: generate 34 | data: 35 | poolType: '{{ poolType }}' 36 | delegate_to: localhost 37 | 38 | - name: Get the ID Pools type 39 | oneview_id_pools_facts: 40 | config: "{{ config }}" 41 | state: get_pool_type 42 | data: 43 | poolType: '{{ poolType }}' 44 | delegate_to: localhost 45 | - debug: var=id_pool 46 | 47 | - name: Checks the range availability in the ID pool 48 | oneview_id_pools_facts: 49 | config: "{{ config }}" 50 | state: check_range_availability 51 | data: 52 | poolType: '{{ poolType }}' 53 | idList: ["42:CE:78:00:00:00", "42:CE:78:8F:FF:FF"] 54 | delegate_to: localhost 55 | 56 | - name: Validates the list of ID's from IPv4 Subnet 57 | oneview_id_pools_facts: 58 | config: "{{ config }}" 59 | state: validate_id_pool 60 | data: 61 | poolType: 'ipv4' 62 | idList: ['172.18.9.11'] 63 | delegate_to: localhost 64 | -------------------------------------------------------------------------------- /examples/oneview_id_pools_ipv4_subnet_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | - subnet_name: IPV4Subnet 21 | tasks: 22 | - name: Gather facts about all ID Pools IPV4 Subnets 23 | oneview_id_pools_ipv4_subnet_facts: 24 | config: "{{ config }}" 25 | delegate_to: localhost 26 | 27 | - debug: var=id_pools_ipv4_subnets 28 | 29 | - name: Gather paginated, and sorted facts about ID Pools IPV4 Subnets 30 | oneview_id_pools_ipv4_subnet_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 3 35 | sort: 'name:descending' 36 | 37 | - debug: var=id_pools_ipv4_subnets 38 | 39 | - name: Gather facts about ID Pools IPV4 Subnets by networkId 40 | oneview_id_pools_ipv4_subnet_facts: 41 | config: "{{ config }}" 42 | networkId: '{{ id_pools_ipv4_subnets[0]["networkId"] }}' 43 | delegate_to: localhost 44 | 45 | - debug: var=id_pools_ipv4_subnets 46 | -------------------------------------------------------------------------------- /examples/oneview_interconnect_link_topology_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2020) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is only available on HPE Synergy 18 | - hosts: all 19 | vars: 20 | - config: "{{ playbook_dir }}/oneview_config.json" 21 | - name: "name1379299256-1476390351192" # set the name of an existent Interconnect Link Topology to run this example 22 | - variant: "Synergy" 23 | tasks: 24 | - name: Gather facts about all Interconnect Link Topologies 25 | oneview_interconnect_link_topology_facts: 26 | config: "{{ config }}" 27 | delegate_to: localhost 28 | when: variant == "Synergy" 29 | 30 | - debug: var=interconnect_link_topologies 31 | 32 | - name: Gather paginated, filtered and sorted facts about Interconnect Link Topologies 33 | oneview_interconnect_link_topology_facts: 34 | config: "{{ config }}" 35 | params: 36 | start: 0 37 | count: 3 38 | sort: 'name:descending' 39 | filter: "name='name1900571853-1483553596802'" 40 | when: variant == "Synergy" 41 | 42 | - debug: var=interconnect_link_topologies 43 | 44 | - name: Gather facts about an Interconnect Link Topology by name 45 | oneview_interconnect_link_topology_facts: 46 | config: "{{ config }}" 47 | name: "{{ name }}" 48 | delegate_to: localhost 49 | when: variant == "Synergy" 50 | 51 | - debug: var=interconnect_link_topologies 52 | -------------------------------------------------------------------------------- /examples/oneview_interconnect_type_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2019) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about all Interconnect Types 22 | oneview_interconnect_type_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | - debug: msg="{{interconnect_types | map(attribute='name') | list }}" 26 | 27 | - name: Gather paginated, filtered and sorted facts about Interconnect Types 28 | oneview_interconnect_type_facts: 29 | config: "{{ config }}" 30 | params: 31 | start: 0 32 | count: 3 33 | sort: 'name:descending' 34 | filter: "maximumFirmwareVersion='4000.99'" 35 | - debug: msg="{{interconnect_types | map(attribute='name') | list }}" 36 | 37 | - name: Gather facts about an Interconnect Type by name {{ interconnect_types.0.name }} 38 | oneview_interconnect_type_facts: 39 | config: "{{ config }}" 40 | name: "{{ interconnect_types.0.name }}" 41 | delegate_to: localhost 42 | - debug: msg="Found an interconnect type named {{interconnect_types.0.name}} and with uri {{interconnect_types.0.uri}}" 43 | -------------------------------------------------------------------------------- /examples/oneview_internal_link_set_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2019) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is available for API version 300 or later 18 | - hosts: all 19 | vars: 20 | - config: "{{ playbook_dir }}/oneview_config.json" 21 | # set the name of an existent Internal Link Set to run this example 22 | - internal_link_set_name: "Encl2-LIG/Uplink_2/Logical_Switch_LSG56" 23 | tasks: 24 | - name: Gather facts about all Internal Link Sets 25 | oneview_internal_link_set_facts: 26 | config: "{{ config }}" 27 | delegate_to: localhost 28 | 29 | - debug: var=internal_link_sets 30 | 31 | - name: Gather paginated and sorted facts about Internal Link Sets 32 | oneview_internal_link_set_facts: 33 | config: "{{ config }}" 34 | params: 35 | start: 0 36 | count: 3 37 | sort: 'name:ascending' 38 | 39 | - debug: var=internal_link_sets 40 | 41 | - name: Gather facts about an Internal Link Set by name 42 | oneview_internal_link_set_facts: 43 | config: "{{ config }}" 44 | name: "{{ internal_link_set_name }}" 45 | delegate_to: localhost 46 | 47 | - debug: var=internal_link_sets 48 | -------------------------------------------------------------------------------- /examples/oneview_label.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Create Labels for enclosure resource 22 | oneview_label: 23 | config: "{{ config }}" 24 | state: present 25 | data: 26 | resourceUri: "/rest/enclosures/0000000000A66102" 27 | labels: 28 | - name: "Test label 1" 29 | - name: "Test Label 2" 30 | delegate_to: localhost 31 | register: label 32 | 33 | - name: Update label of given resource for enclosure resource 34 | oneview_label: 35 | config: "{{ config }}" 36 | state: present 37 | data: 38 | resourceUri: "/rest/enclosures/0000000000A66102" 39 | labels: 40 | - name: "Test label 1 Renamed" 41 | uri: "/rest/labels/130" 42 | - name: "Test label 2 Renamed" 43 | uri: null 44 | - name: "Test label 3" 45 | uri: null 46 | delegate_to: localhost 47 | 48 | - name: Delete Labels for enclosure resource 49 | oneview_label: 50 | config: "{{ config }}" 51 | state: absent 52 | data: 53 | resourceUri: "/rest/enclosures/0000000000A66102" 54 | delegate_to: localhost 55 | -------------------------------------------------------------------------------- /examples/oneview_label_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about all Labels 22 | oneview_label_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: var=labels 27 | 28 | - name: Gather paginated, filtered and sorted facts about Labels 29 | oneview_label_facts: 30 | config: "{{ config }}" 31 | params: 32 | start: 0 33 | count: 3 34 | sort: 'name:descending' 35 | filter: '' 36 | - debug: var=labels 37 | 38 | - name: Gather facts about a Label by name 39 | oneview_label_facts: 40 | config: "{{ config }}" 41 | name: "{{ labels[0]['name'] }}" 42 | delegate_to: localhost 43 | 44 | - debug: var=labels 45 | 46 | - name: Gather facts about a Label by Resource 47 | oneview_label_facts: 48 | config: "{{ config }}" 49 | resourceUri: "/rest/enclosures/0000000000A66102" 50 | delegate_to: localhost 51 | 52 | - debug: var=labels 53 | -------------------------------------------------------------------------------- /examples/oneview_logical_interconnect_group_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | # Below example work till Oneview REST API Version 1600. 17 | --- 18 | - hosts: all 19 | vars: 20 | - config: "{{ playbook_dir }}/oneview_config.json" 21 | - scope_uris: "/rest/scopes/63d1ca81-95b3-41f1-a1ee-f9e1bc2d635f" 22 | tasks: 23 | - name: Gather facts about all Logical Interconnect Groups 24 | oneview_logical_interconnect_group_facts: 25 | config: "{{ config }}" 26 | delegate_to: localhost 27 | 28 | - debug: var=logical_interconnect_groups 29 | 30 | - name: Gather paginated, filtered, and sorted facts about Logical Interconnect Groups 31 | oneview_logical_interconnect_group_facts: 32 | config: "{{ config }}" 33 | params: 34 | start: 0 35 | count: 3 36 | sort: 'name:descending' 37 | filter: "\"'name'='e11-encl-group logical interconnect group'\"" 38 | 39 | - debug: var=logical_interconnect_groups 40 | 41 | - name: Gather facts about Logical Interconnect Group by scope_uris 42 | oneview_logical_interconnect_group_facts: 43 | config: "{{ config }}" 44 | params: 45 | scope_uris: "{{ scope_uris }}" 46 | 47 | - debug: var=logical_interconnect_groups 48 | 49 | - name: Gather facts about a Logical Interconnect Group by name 50 | oneview_logical_interconnect_group_facts: 51 | config: "{{ config }}" 52 | name: "LIG" 53 | delegate_to: localhost 54 | 55 | - debug: var=logical_interconnect_groups 56 | -------------------------------------------------------------------------------- /examples/oneview_logical_switch_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is only available on C7000 enclosures 18 | - hosts: all 19 | vars: 20 | - config: "{{ playbook_dir }}/oneview_config.json" 21 | tasks: 22 | - name: Gather facts about all Logical Switches 23 | oneview_logical_switch_facts: 24 | config: "{{ config }}" 25 | delegate_to: localhost 26 | 27 | - debug: var=logical_switches 28 | 29 | - name: Gather paginated, filtered and sorted facts about Logical Switches 30 | oneview_logical_switch_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 3 35 | sort: 'name:descending' 36 | filter: 'status=OK' 37 | 38 | - debug: var=logical_switches 39 | 40 | - name: Gather facts about a Logical Switch by name 41 | oneview_logical_switch_facts: 42 | config: "{{ config }}" 43 | name: "Test Logical Switch" 44 | delegate_to: localhost 45 | 46 | - debug: var=logical_switches 47 | -------------------------------------------------------------------------------- /examples/oneview_logical_switch_group_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2019) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is only available on C7000 enclosures 18 | - hosts: all 19 | vars: 20 | - config: "{{ playbook_dir }}/oneview_config.json" 21 | tasks: 22 | - name: Gather facts about all Logical Switch Groups 23 | oneview_logical_switch_group_facts: 24 | config: "{{ config }}" 25 | delegate_to: localhost 26 | 27 | - debug: var=logical_switch_groups 28 | 29 | - name: Gather paginated, filtered and sorted facts about Logical Switch Groups 30 | oneview_logical_switch_group_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 3 35 | sort: 'name:descending' 36 | filter: "name='Logical_Switch_Group+56'" 37 | 38 | - debug: var=logical_switch_groups 39 | 40 | - name: Gather facts about a Logical Switch Group by name 41 | oneview_logical_switch_group_facts: 42 | config: "{{ config }}" 43 | name: "LogicalSwitchGroupDemo" 44 | delegate_to: localhost 45 | 46 | - debug: var=logical_switch_groups 47 | -------------------------------------------------------------------------------- /examples/oneview_login_detail_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about login details 22 | oneview_login_detail_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: var=login_details 27 | -------------------------------------------------------------------------------- /examples/oneview_os_deployment_server.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | 18 | # This resource is only available on HPE Synergy 19 | 20 | - hosts: all 21 | vars: 22 | - config_file_path: "{{ playbook_dir }}/oneview_config.json" 23 | tasks: 24 | - name: Ensure that the Deployment Server is present 25 | oneview_os_deployment_server: 26 | config: "{{ config_file_path }}" 27 | state: present 28 | data: 29 | name: 'Test Deployment Server' 30 | description: "OS Deployment Server" 31 | mgmtNetworkName: "Mgmt Network" 32 | applianceName: "0000A66103, appliance 2" 33 | 34 | - debug: var=os_deployment_server 35 | 36 | - name: Ensure that the Deployment Server is present with name 'Renamed Deployment Server' 37 | oneview_os_deployment_server: 38 | config: "{{ config_file_path }}" 39 | state: present 40 | data: 41 | name: 'Test Deployment Server' 42 | newName: 'Renamed Deployment Server' 43 | 44 | - debug: var=os_deployment_server 45 | 46 | - name: Ensure that the Deployment Server is absent 47 | oneview_os_deployment_server: 48 | config: "{{ config_file_path }}" 49 | state: absent 50 | data: 51 | name: 'Renamed Deployment Server' 52 | -------------------------------------------------------------------------------- /examples/oneview_os_deployment_server_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is only available on HPE Synergy 18 | - hosts: all 19 | vars: 20 | config: "{{ playbook_dir }}/oneview_config.json" 21 | tasks: 22 | - name: Gather facts about all OS Deployment Servers 23 | oneview_os_deployment_server_facts: 24 | config: "{{ config }}" 25 | 26 | - debug: var=os_deployment_servers 27 | 28 | - name: Gather paginated, filtered and sorted facts about OS Deployment Servers 29 | oneview_os_deployment_server_facts: 30 | config: "{{ config }}" 31 | params: 32 | start: 0 33 | count: 3 34 | sort: 'name:descending' 35 | filter: 'status=Error' 36 | 37 | - debug: var=os_deployment_servers 38 | 39 | - name: Gather facts about an OS Deployment Server by name 40 | oneview_os_deployment_server_facts: 41 | config: "{{ config }}" 42 | name: "I3s-Deployment Server" 43 | delegate_to: localhost 44 | 45 | - debug: var=os_deployment_servers 46 | 47 | - name: Gather facts about an OS Deployment Server by name with options 48 | oneview_os_deployment_server_facts: 49 | config: "{{ config }}" 50 | name: 'Test-OS Deployment Server' 51 | options: 52 | - networks 53 | - appliances 54 | - appliance: '0000A66102, appliance 2' 55 | delegate_to: localhost 56 | 57 | - debug: var=os_deployment_servers 58 | - debug: var=os_deployment_server_networks 59 | - debug: var=os_deployment_server_appliances 60 | - debug: var=os_deployment_server_appliance 61 | -------------------------------------------------------------------------------- /examples/oneview_rack.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2020) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | config_file_path: "{{ playbook_dir }}/oneview_config.json" 20 | server_hardware_uri: "/rest/server-hardware/37353738-3336-584D-5131-303030343037" # To run this example you must have an server hardware uri 21 | tasks: 22 | - name: Ensure that a Rack is present using the default configuration 23 | oneview_rack: 24 | config: "{{ config_file_path }}" 25 | state: present 26 | data: 27 | name: 'New Rack' 28 | 29 | - debug: var=rack 30 | 31 | - name: Rename the rack, change size and add single mounted server hardware at slot 42 32 | oneview_rack: 33 | config: "{{ config_file_path }}" 34 | state: present 35 | data: 36 | name: 'New Rack' 37 | newName: 'Rename Rack' 38 | depth: 1500 39 | height: 2500 40 | width: 1200 41 | rackMounts: 42 | - mountUri: " {{ server_hardware_uri }}" 43 | topUSlot: 42 44 | uHeight: 2 45 | - debug: var=rack 46 | 47 | - name: Ensure that Rack is absent 48 | oneview_rack: 49 | config: "{{ config_file_path }}" 50 | state: absent 51 | data: 52 | name: 'Rename Rack' 53 | -------------------------------------------------------------------------------- /examples/oneview_rack_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | - rack_name: "Rack-221" # set the name of an existent rack to run this example 21 | tasks: 22 | - name: Gather facts about all Racks 23 | oneview_rack_facts: 24 | config: "{{ config }}" 25 | delegate_to: localhost 26 | 27 | - debug: var=racks 28 | 29 | - name: Gather paginated, filtered and sorted facts about Racks 30 | oneview_rack_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 5 35 | sort: 'name:descending' 36 | filter: "depth=1000" 37 | 38 | - debug: var=racks 39 | 40 | - name: Gather facts about a Rack by name 41 | oneview_rack_facts: 42 | config: "{{ config }}" 43 | name: "{{rack_name}}" 44 | delegate_to: localhost 45 | 46 | - debug: var=racks 47 | 48 | - name: Gather facts about the topology information for the rack 49 | oneview_rack_facts: 50 | config: "{{ config }}" 51 | name: "{{rack_name}}" 52 | options: 53 | - deviceTopology 54 | delegate_to: localhost 55 | 56 | - debug: var=racks 57 | - debug: var=rack_device_topology 58 | -------------------------------------------------------------------------------- /examples/oneview_san_manager_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about all SAN Managers 22 | oneview_san_manager_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: var=san_managers 27 | 28 | - name: Gather paginated, filtered and sorted facts about SAN Managers 29 | oneview_san_manager_facts: 30 | config: "{{ config }}" 31 | params: 32 | start: 0 33 | count: 3 34 | sort: name:ascending 35 | query: isInternal eq false 36 | delegate_to: localhost 37 | 38 | - debug: var=san_managers 39 | 40 | - name: Gather facts about a San Manager by provider display name 41 | oneview_san_manager_facts: 42 | config: "{{ config }}" 43 | provider_display_name: "Brocade Network Advisor" 44 | delegate_to: localhost 45 | 46 | - debug: var=san_managers 47 | -------------------------------------------------------------------------------- /examples/oneview_sas_interconnect.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2019) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is only available on HPE Synergy 18 | - hosts: all 19 | vars: 20 | config: "{{ playbook_dir }}/oneview_config.json" 21 | name: "SYN03_Frame3, interconnect 1" # change for your SAS Interconnect name 22 | tasks: 23 | - name: Ensure that a SAS Interconnect is powered on 24 | oneview_sas_interconnect: 25 | config: "{{ config }}" 26 | state: powered_on 27 | name: "{{ name }}" 28 | delegate_to: localhost 29 | 30 | - name: Refresh a SAS Interconnect 31 | oneview_sas_interconnect: 32 | config: "{{ config }}" 33 | state: refreshed 34 | name: "{{ name }}" 35 | delegate_to: localhost 36 | 37 | - name: Perform a hard reset 38 | oneview_sas_interconnect: 39 | config: "{{ config }}" 40 | state: hard_reset 41 | name: "{{ name }}" 42 | delegate_to: localhost 43 | -------------------------------------------------------------------------------- /examples/oneview_sas_interconnect_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2019) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is only available on HPE Synergy 18 | - hosts: all 19 | vars: 20 | - config: "{{ playbook_dir }}/oneview_config.json" 21 | tasks: 22 | - name: Gather facts about all SAS Interconnects 23 | oneview_sas_interconnect_facts: 24 | config: "{{ config }}" 25 | delegate_to: localhost 26 | 27 | - debug: var=sas_interconnects 28 | 29 | - name: Gather paginated, filtered and sorted facts about SAS Interconnects 30 | oneview_sas_interconnect_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 3 35 | sort: 'name:descending' 36 | filter: "softResetState='Normal'" 37 | 38 | - debug: var=sas_interconnects 39 | 40 | - name: Gather facts about a SAS Interconnect by name 41 | oneview_sas_interconnect_facts: 42 | config: "{{ config }}" 43 | name: "0000A66103, interconnect 1" 44 | delegate_to: localhost 45 | 46 | - debug: var=sas_interconnects 47 | -------------------------------------------------------------------------------- /examples/oneview_sas_interconnect_type_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2019) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is only available on HPE Synergy 18 | - hosts: all 19 | vars: 20 | - config: "{{ playbook_dir }}/oneview_config.json" 21 | # set the name of an existent SAS Interconnect type to run this example 22 | - sas_interconnect_type_name: "Synergy 12Gb SAS Connection Module" 23 | tasks: 24 | - name: Gather facts about all SAS Interconnect Types 25 | oneview_sas_interconnect_type_facts: 26 | config: "{{ config }}" 27 | delegate_to: localhost 28 | 29 | - debug: var=sas_interconnect_types 30 | 31 | - name: Gather paginated, filtered and sorted facts about SAS Interconnect Types 32 | oneview_sas_interconnect_type_facts: 33 | config: "{{ config }}" 34 | params: 35 | start: 0 36 | count: 3 37 | sort: 'name:descending' 38 | filter: "enclosureType='SY12000'" 39 | 40 | - debug: var=sas_interconnect_types 41 | 42 | - name: Gather facts about a SAS Interconnect Type by name 43 | oneview_sas_interconnect_type_facts: 44 | config: "{{ config }}" 45 | name: "{{ sas_interconnect_type_name }}" 46 | delegate_to: localhost 47 | 48 | - debug: var=sas_interconnect_types 49 | -------------------------------------------------------------------------------- /examples/oneview_sas_logical_interconnect_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2019) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is only available on HPE Synergy 18 | - hosts: all 19 | vars: 20 | - config: "{{ playbook_dir }}/oneview_config.json" 21 | - name: "SYN03_LE-SYN_SAS_1-1" # change for the desired SAS Logical Interconnect name 22 | tasks: 23 | - name: Gather facts about all SAS Logical Interconnects 24 | oneview_sas_logical_interconnect_facts: 25 | config: "{{ config }}" 26 | delegate_to: localhost 27 | - debug: var=sas_logical_interconnects 28 | 29 | - name: Gather paginated, filtered and sorted facts about SAS Logical Interconnects 30 | oneview_sas_logical_interconnect_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 2 35 | sort: 'name:descending' 36 | filter: "status='OK'" 37 | - debug: var=sas_logical_interconnects 38 | 39 | - name: Gather facts about a SAS Logical Interconnect by name 40 | oneview_sas_logical_interconnect_facts: 41 | config: "{{ config }}" 42 | name: "{{ name }}" 43 | delegate_to: localhost 44 | - debug: var=sas_logical_interconnects 45 | 46 | - name: Gather facts about an installed firmware for a SAS Logical Interconnect that matches the specified name 47 | oneview_sas_logical_interconnect_facts: 48 | config: "{{ config }}" 49 | name: "{{ name }}" 50 | options: 51 | - firmware 52 | delegate_to: localhost 53 | - debug: var=sas_logical_interconnect_firmware 54 | -------------------------------------------------------------------------------- /examples/oneview_sas_logical_jbod_attachment_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is only available on HPE Synergy 18 | - hosts: all 19 | vars: 20 | config: "{{ playbook_dir }}/oneview_config.json" 21 | # Set the name of a SAS Logical JBOD Attachment to run the playbook 22 | sas_logical_jbod_attachment_name: "logical-enclosure-SAS-Logical-Interconnect-Group-BDD-1-SLJA-1" 23 | 24 | tasks: 25 | - name: Gather facts about all SAS Logical JBOD Attachments 26 | oneview_sas_logical_jbod_attachment_facts: 27 | config: "{{ config }}" 28 | delegate_to: localhost 29 | 30 | - debug: var=sas_logical_jbod_attachments 31 | 32 | - name: Gather paginated, filtered and sorted facts about SAS Logical JBOD Attachment 33 | oneview_sas_logical_jbod_attachment_facts: 34 | config: "{{ config }}" 35 | params: 36 | start: 0 37 | count: 2 38 | sort: 'name:descending' 39 | filter: "state=Deployed" 40 | 41 | - debug: var=sas_logical_jbod_attachments 42 | 43 | - name: Gather facts about a SAS Logical JBOD Attachment by name 44 | oneview_sas_logical_jbod_attachment_facts: 45 | config: "{{ config }}" 46 | name: "{{ sas_logical_jbod_attachment_name }}" 47 | delegate_to: localhost 48 | 49 | - debug: var=sas_logical_jbod_attachments 50 | -------------------------------------------------------------------------------- /examples/oneview_sas_logical_jbod_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is only available on HPE Synergy 18 | - hosts: all 19 | vars: 20 | config: "{{ playbook_dir }}/oneview_config.json" 21 | # Set the name of a SAS Logical JBOD to run the playbook 22 | sas_logical_jbod_name: "SAS Logical JBOD Name" 23 | 24 | tasks: 25 | - name: Gather facts about all SAS Logical JBODs 26 | oneview_sas_logical_jbod_facts: 27 | config: "{{ config }}" 28 | delegate_to: localhost 29 | 30 | - debug: var=sas_logical_jbods 31 | 32 | - name: Gather paginated, filtered and sorted facts about SAS Logical JBODs 33 | oneview_sas_logical_jbod_facts: 34 | config: "{{ config }}" 35 | params: 36 | start: 0 37 | count: 2 38 | sort: 'name:descending' 39 | filter: "state='Configured'" 40 | 41 | - debug: var=sas_logical_jbods 42 | 43 | - name: Gather facts about a SAS Logical JBOD by name 44 | oneview_sas_logical_jbod_facts: 45 | config: "{{ config }}" 46 | name: "{{ sas_logical_jbod_name }}" 47 | delegate_to: localhost 48 | 49 | - debug: var=sas_logical_jbods 50 | 51 | - name: Gather facts about a SAS Logical JBOD by name, with the list of drives allocated 52 | oneview_sas_logical_jbod_facts: 53 | config: "{{ config }}" 54 | name: "{{ sas_logical_jbod_name }}" 55 | options: 56 | - drives 57 | delegate_to: localhost 58 | 59 | - debug: var=sas_logical_jbods 60 | - debug: var=sas_logical_jbod_drives 61 | -------------------------------------------------------------------------------- /examples/oneview_scope_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2020) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is available for API version 300 or later. 18 | - hosts: all 19 | vars: 20 | config: "{{ playbook_dir }}/oneview_config.json" 21 | contents: "{{lookup('file', config)}}" 22 | 23 | tasks: 24 | - name: Gather facts about all Scopes 25 | oneview_scope_facts: 26 | config: "{{ config }}" 27 | delegate_to: localhost 28 | 29 | - debug: var=scopes 30 | 31 | - name: Gather paginated, filtered and sorted facts about Scopes 32 | oneview_scope_facts: 33 | config: "{{ config }}" 34 | params: 35 | start: 0 36 | count: 3 37 | sort: name:ascending 38 | query: name eq '{{ contents.scope_name}}' 39 | delegate_to: localhost 40 | 41 | - debug: var=scopes 42 | 43 | - name: Gather facts about a Scope by name 44 | oneview_scope_facts: 45 | config: "{{ config }}" 46 | name: "{{ contents.scope_name }}" 47 | delegate_to: localhost 48 | 49 | - debug: var=scopes 50 | -------------------------------------------------------------------------------- /examples/oneview_server_hardware_type_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2019) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | --- 18 | - hosts: all 19 | vars: 20 | - config: "{{ playbook_dir }}/oneview_config.json" 21 | tasks: 22 | - name: Gather facts about all Server Hardware Types 23 | oneview_server_hardware_type_facts: 24 | config: "{{ config }}" 25 | delegate_to: localhost 26 | - debug: msg="{{server_hardware_types | map(attribute='name') | list }}" 27 | 28 | - name: Gather paginated, filtered and sorted facts about Server Hardware Types 29 | oneview_server_hardware_type_facts: 30 | config: "{{ config }}" 31 | params: 32 | start: 0 33 | count: 5 34 | sort: name:ascending 35 | filter: formFactor='HalfHeight' 36 | delegate_to: localhost 37 | 38 | - debug: msg="{{server_hardware_types | map(attribute='name') | list }}" 39 | 40 | - name: Gather facts about a Server Hardware Type by name 41 | oneview_server_hardware_type_facts: 42 | config: "{{ config }}" 43 | name: "SY 480 Gen9 1" 44 | delegate_to: localhost 45 | - debug: var=server_hardware_types 46 | -------------------------------------------------------------------------------- /examples/oneview_storage_pool_store_serv.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | config: "{{ playbook_dir }}/oneview_config.json" 20 | storage_system_uri: "/rest/storage-systems/TXQ1010307" 21 | storage_pool_name: FST_CPG2 # This storage pool should already exist 22 | tasks: 23 | - name: Ensure the Storage Pool '{{ storage_pool_name }}' is not managed 24 | oneview_storage_pool: 25 | config: "{{ config }}" 26 | state: present 27 | data: 28 | storageSystemUri: '{{ storage_system_uri }}' 29 | name: '{{ storage_pool_name }}' 30 | isManaged: False 31 | delegate_to: localhost 32 | 33 | - name: Ensure the Storage Pool '{{ storage_pool_name }}' is managed 34 | oneview_storage_pool: 35 | config: "{{ config }}" 36 | state: present 37 | data: 38 | storageSystemUri: '{{ storage_system_uri }}' 39 | name: '{{ storage_pool_name }}' 40 | isManaged: True 41 | delegate_to: localhost 42 | -------------------------------------------------------------------------------- /examples/oneview_storage_volume_attachment.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | config: "{{ playbook_dir }}/oneview_config.json" 20 | contents: "{{lookup('file', config)}}" 21 | tasks: 22 | - name: Removes extra presentations from a specified server profile name 23 | oneview_storage_volume_attachment: 24 | config: "{{ config }}" 25 | state: "extra_presentations_removed" 26 | server_profile: "{{ contents.server_profile_name }}" 27 | delegate_to: localhost 28 | 29 | - debug: var=server_profile 30 | -------------------------------------------------------------------------------- /examples/oneview_switch.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is only available on C7000 enclosures 18 | - hosts: all 19 | vars: 20 | config: "{{ playbook_dir }}/oneview_config.json" 21 | name: "172.18.16.91" # change for your switch name 22 | port_id: "ca520119-1329-496b-8e44-43092e937eae:1.32" 23 | port_name: "1.32" 24 | tasks: 25 | - name: Update the ports on the switch that matches the specified name 26 | oneview_switch: 27 | config: "{{ config }}" 28 | state: ports_updated 29 | name: "{{ name }}" 30 | data: 31 | ports: 32 | - portId: "{{ port_id }}" 33 | portName: "{{ port_name }}" 34 | enabled: true 35 | delegate_to: localhost 36 | 37 | # This feature is available only till OneView 3.10 38 | - name: Update the scopes on the specified switch 39 | oneview_switch: 40 | config: "{{ config }}" 41 | state: present 42 | name: "{{ name }}" 43 | data: 44 | scopeUris: ['/rest/scopes/d1f79dea-6393-4bb0-9723-8adc9b96de94'] 45 | delegate_to: localhost 46 | 47 | - name: Delete the Switch 48 | oneview_switch: 49 | config: "{{ config }}" 50 | state: absent 51 | name: "{{ name }}" 52 | delegate_to: localhost 53 | -------------------------------------------------------------------------------- /examples/oneview_switch_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | # This resource is only available on C7000 enclosures 18 | - hosts: all 19 | vars: 20 | - config: "{{ playbook_dir }}/oneview_config.json" 21 | - name: "172.18.20.1" # change for the desired switch name 22 | tasks: 23 | - name: Gather facts about all switches 24 | oneview_switch_facts: 25 | config: "{{ config }}" 26 | delegate_to: localhost 27 | 28 | - debug: var=switches 29 | 30 | - name: Gather paginated facts about switches 31 | oneview_switch_facts: 32 | config: "{{ config }}" 33 | params: 34 | start: 0 35 | count: 3 36 | 37 | - debug: var=switches 38 | 39 | - name: Gather facts about the switch that matches the specified switch name 40 | oneview_switch_facts: 41 | config: "{{ config }}" 42 | name: "{{ name }}" 43 | delegate_to: localhost 44 | 45 | - debug: var=switches 46 | 47 | - name: Gather facts about the environmental configuration for the switch that matches the specified switch name 48 | oneview_switch_facts: 49 | config: "{{ config }}" 50 | name: "{{ name }}" 51 | options: 52 | - environmentalConfiguration 53 | delegate_to: localhost 54 | 55 | - debug: var=switch_environmental_configuration 56 | -------------------------------------------------------------------------------- /examples/oneview_switch_type_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about all Switch Types 22 | oneview_switch_type_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: msg="Name of the Switch Types found{{':'}} {{switch_types | map(attribute='name') | list }}" 27 | 28 | - name: Gather paginated, filtered and sorted facts about Switch Types 29 | oneview_switch_type_facts: 30 | config: "{{ config }}" 31 | params: 32 | start: 0 33 | count: 2 34 | sort: 'name:descending' 35 | filter: "partNumber='N5K-C56XX'" 36 | 37 | - debug: var=switch_types 38 | 39 | - name: Gather facts about a Switch Type by name 40 | oneview_switch_type_facts: 41 | config: "{{ config }}" 42 | name: "{{ switch_types[0].name }}" 43 | delegate_to: localhost 44 | when: switch_types == True 45 | 46 | - debug: msg="Switch Type found by name {{ switch_types[0].name }} has URI {{ switch_types[0].uri }}" 47 | when: switch_types == True 48 | -------------------------------------------------------------------------------- /examples/oneview_task.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | contents: "{{lookup('file', config)}}" 21 | tasks: 22 | - name: Gather facts about the last 5 running tasks 23 | oneview_task_facts: 24 | config: "{{ config }}" 25 | params: 26 | count: 5 27 | view: "tree" 28 | filter: ["taskState='Running'", "isCancellable=true"] 29 | delegate_to: localhost 30 | 31 | - debug: var=tasks 32 | 33 | - name: Sets the state of task to 'Cancelling' 34 | oneview_task: 35 | config: "{{ config }}" 36 | data: 37 | name: "{{ tasks[0]['name'] }}" 38 | uri: "{{ tasks[0]['uri'] }}" 39 | delegate_to: localhost 40 | when: contents.api_version >= 1200 and ( tasks | length > 0 ) 41 | -------------------------------------------------------------------------------- /examples/oneview_unmanaged_device_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | - name: "MyUnmanagedDevice" 21 | tasks: 22 | - name: Gather facts about all Unmanaged Devices 23 | oneview_unmanaged_device_facts: 24 | config: "{{ config }}" 25 | delegate_to: localhost 26 | 27 | - debug: msg="{{unmanaged_devices | map(attribute='name') | list }}" 28 | 29 | - name: Gather paginated, filtered and sorted facts about Unmanaged Devices 30 | oneview_unmanaged_device_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 2 35 | sort: 'name:descending' 36 | filter: "status='Disabled'" 37 | 38 | - debug: var=unmanaged_devices 39 | 40 | - name: Gather facts about an Unmanaged Device by name 41 | oneview_unmanaged_device_facts: 42 | config: "{{ config }}" 43 | name: "{{ name }}" 44 | delegate_to: localhost 45 | 46 | - debug: var=unmanaged_devices 47 | 48 | - name: Gather facts about an Unmanaged Device by name with environmental configuration 49 | oneview_unmanaged_device_facts: 50 | config: "{{ config }}" 51 | name: "{{ name }}" 52 | options: "environmental_configuration" 53 | delegate_to: localhost 54 | 55 | - debug: var=unmanaged_device_environmental_configuration 56 | -------------------------------------------------------------------------------- /examples/oneview_uplink_set_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2020) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about all Uplink Sets 22 | oneview_uplink_set_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: msg="{{uplink_sets | map(attribute='name') | list }}" 27 | 28 | - name: Gather facts about all Logical Interconnects 29 | oneview_logical_interconnect_facts: 30 | config: "{{ config }}" 31 | delegate_to: localhost 32 | 33 | - debug: var=logical_interconnects 34 | 35 | - name: Gather paginated, filtered and sorted facts about Uplink Sets 36 | oneview_uplink_set_facts: 37 | config: "{{ config }}" 38 | params: 39 | start: 0 40 | count: 2 41 | sort: 'name:descending' 42 | filter: "logicalInterconnectUri= '{{ logical_interconnects[0]['uri'] }}'" 43 | when: (logical_interconnects is not none and logical_interconnects is not undefined) 44 | 45 | - debug: var=uplink_sets 46 | 47 | - name: Gather facts about a Uplink Set by name 48 | oneview_uplink_set_facts: 49 | config: "{{ config }}" 50 | name: "ULS-2" 51 | delegate_to: localhost 52 | 53 | - debug: var=uplink_sets 54 | -------------------------------------------------------------------------------- /examples/oneview_user_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2021) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | config: "{{ playbook_dir }}/oneview_config.json" 20 | role: "Infrastructure administrator" 21 | tasks: 22 | - name: Gather facts about all Users 23 | oneview_user_facts: 24 | config: "{{ config }}" 25 | delegate_to: localhost 26 | 27 | - debug: var=users 28 | 29 | - name: Gather paginated, filtered and sorted facts about Users 30 | oneview_user_facts: 31 | config: "{{ config }}" 32 | params: 33 | start: 0 34 | count: 3 35 | sort: 'emailAddress:descending' 36 | filter: 'enabled=true' 37 | 38 | - debug: var=users 39 | 40 | - name: Gather facts about a User by name 41 | oneview_user_facts: 42 | config: "{{ config }}" 43 | userName: "testUser" 44 | delegate_to: localhost 45 | 46 | - debug: var=users 47 | 48 | - name: Gather facts about the users who have permissions that use a specified role 49 | oneview_user_facts: 50 | config: "{{ config }}" 51 | role: "{{ role }}" 52 | delegate_to: localhost 53 | 54 | - debug: var=role 55 | 56 | - name: Gather facts about lists of user's roles 57 | oneview_user_facts: 58 | config: "{{ config }}" 59 | userName: "testUser" 60 | options: 61 | - getUserRoles 62 | delegate_to: localhost 63 | 64 | - debug: var=users 65 | - debug: var=user_roles 66 | -------------------------------------------------------------------------------- /examples/oneview_version_facts.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | - config: "{{ playbook_dir }}/oneview_config.json" 20 | tasks: 21 | - name: Gather facts about current and minimum Version 22 | oneview_version_facts: 23 | config: "{{ config }}" 24 | delegate_to: localhost 25 | 26 | - debug: var=version 27 | -------------------------------------------------------------------------------- /examples/synergy_export_os_deployment_custom_attributes.yml: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | - hosts: all 18 | vars: 19 | config: "{{ playbook_dir }}/oneview_config.json" 20 | destination_path: "{{ playbook_dir }}/vars" 21 | tasks: 22 | - name: Gather facts about all OS Deployment Plans 23 | oneview_os_deployment_plan_facts: 24 | config : '{{ config }}' 25 | delegate_to: localhost 26 | 27 | - name: Gather facts about each OS Deployment Plan Custom Attributes 28 | oneview_os_deployment_plan_facts: 29 | config: '{{ config }}' 30 | name : '{{ item.name }}' 31 | options: 32 | - osCustomAttributesForServerProfile 33 | with_items: 34 | - "{{ os_deployment_plans }}" 35 | register: dp_facts 36 | delegate_to: localhost 37 | 38 | - name: Export each Deployment Plan Custom Attributes to a local folder 39 | copy: 40 | content="{{ item.os_deployment_plan_custom_attributes | to_nice_yaml }}" 41 | dest="{{ destination_path }}/{{ item.os_deployment_plans.0.name }}.yml" 42 | with_items: 43 | - "{{ dp_facts.results | map(attribute='ansible_facts') | list }}" 44 | -------------------------------------------------------------------------------- /examples/vars/config.yml.rename: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2019) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | --- 17 | enclosure_hostname: '' 18 | enclosure_username: '' 19 | enclosure_password: '' 20 | enclosure_framelink_ipv6: '' 21 | enclosure_group_uri: '' 22 | storage_system_ip_hostname: '' 23 | storage_system_username: '' 24 | storage_system_password: '' 25 | server_hardware_hostname: '' 26 | server_hardware_username: '' 27 | server_hardware_password: '' 28 | power_device_hostname: '' 29 | power_device_username: '' 30 | power_device_password: '' 31 | -------------------------------------------------------------------------------- /library/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HewlettPackard/oneview-ansible/e6fa31ebaa4ceceaacab2852d7ae5fc6fd65442f/library/__init__.py -------------------------------------------------------------------------------- /library/module_utils/__init__.py: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | -------------------------------------------------------------------------------- /library/oneview_login_detail_facts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | ### 4 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # You may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ### 18 | 19 | ANSIBLE_METADATA = {'metadata_version': '1.1', 20 | 'status': ['preview'], 21 | 'supported_by': 'community'} 22 | 23 | DOCUMENTATION = ''' 24 | --- 25 | module: oneview_login_detail_facts 26 | short_description: Retrieve the facts about login details 27 | description: 28 | - Retrieve the facts about login details from oneview. 29 | version_added: "2.5" 30 | requirements: 31 | - hpeOneView >= 4.3.0 32 | author: Madhav Bharadwaj(@madhav-bharadwaj) 33 | 34 | extends_documentation_fragment: 35 | - oneview 36 | ''' 37 | 38 | EXAMPLES = ''' 39 | - name: Gather facts about login details 40 | oneview_login_detail_facts: 41 | config: "{{ config }}" 42 | delegate_to: localhost 43 | 44 | - debug: var=login_details 45 | ''' 46 | 47 | RETURN = ''' 48 | login_details: 49 | description: Lists all the login details 50 | returned: Always, but can be null. 51 | type: dict 52 | ''' 53 | 54 | from ansible.module_utils.oneview import OneViewModuleBase 55 | 56 | 57 | class LoginDetailFactsModule(OneViewModuleBase): 58 | def __init__(self): 59 | super(LoginDetailFactsModule, self).__init__() 60 | 61 | def execute_module(self): 62 | login_details = self.oneview_client.login_details.get_login_details() 63 | return dict(changed=False, ansible_facts=dict(login_details=login_details)) 64 | 65 | 66 | def main(): 67 | LoginDetailFactsModule().run() 68 | 69 | 70 | if __name__ == '__main__': 71 | main() 72 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | ansible 2 | hpICsp 3 | hpeOneView==6.1.0 4 | -------------------------------------------------------------------------------- /test/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HewlettPackard/oneview-ansible/e6fa31ebaa4ceceaacab2852d7ae5fc6fd65442f/test/__init__.py -------------------------------------------------------------------------------- /test/conftest.py: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | import pytest 18 | 19 | from mock import Mock, patch 20 | from oneview_module_loader import ONEVIEW_MODULE_UTILS_PATH 21 | from hpeOneView.oneview_client import OneViewClient 22 | 23 | 24 | @pytest.fixture 25 | def mock_ov_client(): 26 | patcher_json_file = patch.object(OneViewClient, 'from_json_file') 27 | client = patcher_json_file.start() 28 | return client.return_value 29 | 30 | 31 | @pytest.fixture 32 | def mock_ansible_module(): 33 | patcher_ansible = patch(ONEVIEW_MODULE_UTILS_PATH + '.AnsibleModule') 34 | patcher_ansible = patcher_ansible.start() 35 | ansible_module = Mock() 36 | patcher_ansible.return_value = ansible_module 37 | return ansible_module 38 | -------------------------------------------------------------------------------- /test/test_oneview_appliance_configuration_timeconfig_facts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | ### 4 | # Copyright (2021) Hewlett Packard Enterprise Development LP 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # You may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ### 18 | 19 | import pytest 20 | 21 | from hpe_test_utils import OneViewBaseTest 22 | from oneview_module_loader import ApplianceConfigurationTimeconfigFactsModule 23 | 24 | PARAMS_GET_ALL = dict( 25 | config='config.json', 26 | name=None 27 | ) 28 | 29 | PRESENT_TIMECONFIG = [{ 30 | "locale": "en_US.UTF-8", 31 | "displayName": "English (United States)" 32 | }] 33 | 34 | 35 | @pytest.mark.resource(TestApplianceConfigurationTimeconfigFactsModule='appliance_configuration_timeconfig') 36 | class TestApplianceConfigurationTimeconfigFactsModule(OneViewBaseTest): 37 | def test_should_get_all_timeconfiguration(self): 38 | self.resource.get_all.return_value = PRESENT_TIMECONFIG 39 | self.mock_ansible_module.params = PARAMS_GET_ALL 40 | 41 | ApplianceConfigurationTimeconfigFactsModule().run() 42 | 43 | self.mock_ansible_module.exit_json.assert_called_once_with( 44 | changed=False, 45 | ansible_facts=dict(appliance_configuration_timeconfig=PRESENT_TIMECONFIG) 46 | ) 47 | 48 | 49 | if __name__ == '__main__': 50 | pytest.main([__file__]) 51 | -------------------------------------------------------------------------------- /test/test_oneview_appliance_device_read_community_facts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | ### 4 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # You may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ### 18 | 19 | import pytest 20 | 21 | from hpe_test_utils import OneViewBaseTest 22 | from oneview_module_loader import ApplianceDeviceReadCommunityFactsModule 23 | 24 | PARAMS_GET = dict( 25 | config='config.json', 26 | name=None 27 | ) 28 | 29 | PRESENT_CONFIGURATION = [{ 30 | "uri": "/rest/appliance/device-read-community-string", 31 | "communityString": "public" 32 | }] 33 | 34 | 35 | @pytest.mark.resource(TestApplianceDeviceReadCommunityFactsModule='appliance_device_read_community') 36 | class TestApplianceDeviceReadCommunityFactsModule(OneViewBaseTest): 37 | def test_should_get_appliance_device_read_community(self): 38 | self.resource.get.return_value = PRESENT_CONFIGURATION 39 | self.mock_ansible_module.params = PARAMS_GET 40 | 41 | ApplianceDeviceReadCommunityFactsModule().run() 42 | 43 | self.mock_ansible_module.exit_json.assert_called_once_with( 44 | changed=False, 45 | ansible_facts=dict(appliance_device_read_community=(PRESENT_CONFIGURATION)) 46 | ) 47 | 48 | 49 | if __name__ == '__main__': 50 | pytest.main([__file__]) 51 | -------------------------------------------------------------------------------- /test/test_oneview_appliance_ssh_access.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | ### 4 | # Copyright (2021) Hewlett Packard Enterprise Development LP 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # You may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ### 18 | 19 | import pytest 20 | import mock 21 | 22 | from hpe_test_utils import OneViewBaseTest 23 | from oneview_module_loader import ApplianceSshAccessModule 24 | 25 | DEFAULT_CONFIGURATION_TEMPLATE = dict( 26 | allowSshAccess='True' 27 | ) 28 | 29 | CHANGED_CONFIGURATION_TEMPLATE = dict( 30 | allowSshAccess='False' 31 | ) 32 | 33 | PARAMS_WITH_CHANGES = dict( 34 | config='config.json', 35 | state='present', 36 | data=CHANGED_CONFIGURATION_TEMPLATE 37 | ) 38 | 39 | 40 | @pytest.mark.resource(TestApplianceSshAccessModule='appliance_ssh_access') 41 | class TestApplianceSshAccessModule(OneViewBaseTest): 42 | """ 43 | OneViewBaseTestCase provides the mocks used in this test case 44 | """ 45 | 46 | def test_update_when_data_has_modified_attributes(self): 47 | self.resource.data = DEFAULT_CONFIGURATION_TEMPLATE 48 | self.resource.get_all.return_value = self.resource 49 | self.mock_ansible_module.params = PARAMS_WITH_CHANGES 50 | self.resource.update.return_value = self.resource 51 | 52 | ApplianceSshAccessModule().run() 53 | 54 | self.mock_ansible_module.exit_json.assert_called_once_with( 55 | changed=True, 56 | msg=ApplianceSshAccessModule.MSG_UPDATED, 57 | ansible_facts=dict(appliance_ssh_access=DEFAULT_CONFIGURATION_TEMPLATE) 58 | ) 59 | 60 | 61 | if __name__ == '__main__': 62 | pytest.main([__file__]) 63 | -------------------------------------------------------------------------------- /test/test_oneview_appliance_ssh_access_facts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | ### 4 | # Copyright (2021) Hewlett Packard Enterprise Development LP 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # You may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ### 18 | 19 | import pytest 20 | 21 | from hpe_test_utils import OneViewBaseTest 22 | from oneview_module_loader import ApplianceSshAccessFactsModule 23 | 24 | PARAMS_GET_ALL = dict( 25 | config='config.json' 26 | ) 27 | 28 | PRESENT_SSHACCESS = [{ 29 | "type": "SshAccess", 30 | "allowSshAccess": "True" 31 | }] 32 | 33 | 34 | @pytest.mark.resource(TestApplianceSshAccessFactsModule='appliance_ssh_access') 35 | class TestApplianceSshAccessFactsModule(OneViewBaseTest): 36 | def test_should_get_all_ssh_configuration(self): 37 | self.resource.get_all.return_value = self.resource 38 | self.resource.data = PRESENT_SSHACCESS 39 | self.mock_ansible_module.params = PARAMS_GET_ALL 40 | 41 | ApplianceSshAccessFactsModule().run() 42 | 43 | self.mock_ansible_module.exit_json.assert_called_once_with( 44 | changed=False, 45 | ansible_facts=dict(appliance_ssh_access=PRESENT_SSHACCESS) 46 | ) 47 | 48 | 49 | if __name__ == '__main__': 50 | pytest.main([__file__]) 51 | -------------------------------------------------------------------------------- /test/test_oneview_appliance_time_and_locale_configuration_facts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | ### 4 | # Copyright (2021) Hewlett Packard Enterprise Development LP 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # You may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ### 18 | 19 | import pytest 20 | 21 | from hpe_test_utils import OneViewBaseTest 22 | from oneview_module_loader import ApplianceTimeAndLocaleConfigurationFactsModule 23 | 24 | PARAMS_GET = dict( 25 | config='config.json', 26 | name=None 27 | ) 28 | 29 | PRESENT_CONFIGURATION = [{ 30 | "locale": "en_US.UTF-8", 31 | "localeDisplayName": "English (United States)" 32 | }] 33 | 34 | 35 | @pytest.mark.resource(TestApplianceTimeAndLocaleConfigurationFactsModule='appliance_time_and_locale_configuration') 36 | class TestApplianceTimeAndLocaleConfigurationFactsModule(OneViewBaseTest): 37 | def test_should_get_appliance_time_and_locale_configuration(self): 38 | self.resource.get_all.return_value = self.resource 39 | self.resource.data = PRESENT_CONFIGURATION 40 | self.mock_ansible_module.params = PARAMS_GET 41 | 42 | ApplianceTimeAndLocaleConfigurationFactsModule().run() 43 | 44 | self.mock_ansible_module.exit_json.assert_called_once_with( 45 | changed=False, 46 | ansible_facts=dict(appliance_time_and_locale_configuration=PRESENT_CONFIGURATION) 47 | ) 48 | 49 | 50 | if __name__ == '__main__': 51 | pytest.main([__file__]) 52 | -------------------------------------------------------------------------------- /test/test_oneview_event.py: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | import pytest 18 | 19 | from hpe_test_utils import OneViewBaseTest 20 | from oneview_module_loader import EventModule 21 | 22 | FAKE_MSG_ERROR = 'Fake message error' 23 | 24 | PARAMS_FOR_PRESENT = dict( 25 | config='config.json', 26 | state='present', 27 | data={ 28 | 'description': "This is a very simple test event", 29 | 'eventTypeID': "hp.justATest", 30 | 'eventDetails': [{ 31 | 'eventItemName': "ipv4Address", 32 | 'eventItemValue': "198.51.100.5", 33 | 'isThisVarbindData': "false", 34 | 'varBindOrderIndex': -1 35 | }] 36 | } 37 | ) 38 | 39 | 40 | @pytest.mark.resource(TestEventModule='events') 41 | class TestEventModule(OneViewBaseTest): 42 | """ 43 | OneViewBaseTestCase provides the mocks used in this test case 44 | """ 45 | 46 | def test_should_create_new_event(self): 47 | self.resource.get_by.return_value = [] 48 | self.resource.create.return_value = PARAMS_FOR_PRESENT['data'] 49 | 50 | self.mock_ansible_module.params = PARAMS_FOR_PRESENT 51 | 52 | EventModule().run() 53 | 54 | self.mock_ansible_module.exit_json.assert_called_once_with( 55 | changed=True, 56 | msg=EventModule.MSG_CREATED, 57 | ansible_facts=dict(event=PARAMS_FOR_PRESENT['data']) 58 | ) 59 | 60 | 61 | if __name__ == '__main__': 62 | pytest.main([__file__]) 63 | -------------------------------------------------------------------------------- /test/test_oneview_event_fact.py: -------------------------------------------------------------------------------- 1 | ### 2 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | ### 16 | 17 | import pytest 18 | 19 | from hpe_test_utils import OneViewBaseFactsTest 20 | from oneview_module_loader import EventFactsModule 21 | 22 | ERROR_MSG = 'Fake message error' 23 | 24 | PARAMS_GET_ALL = dict( 25 | config='config.json', 26 | name=None 27 | ) 28 | 29 | PARAMS_GET_BY_NAME = dict( 30 | config='config.json', 31 | name="Test Event" 32 | ) 33 | 34 | PRESENT_EVENTS = [{ 35 | "name": "Test Event", 36 | "uri": "/rest/event/c6bf9af9-48e7-4236-b08a-77684dc258a5" 37 | }] 38 | 39 | 40 | @pytest.mark.resource(TestEventFactsModule='events') 41 | class TestEventFactsModule(OneViewBaseFactsTest): 42 | def test_should_get_all_events(self): 43 | self.resource.get_all.return_value = PRESENT_EVENTS 44 | self.mock_ansible_module.params = PARAMS_GET_ALL 45 | 46 | EventFactsModule().run() 47 | 48 | self.mock_ansible_module.exit_json.assert_called_once_with( 49 | changed=False, 50 | ansible_facts=dict(events=PRESENT_EVENTS) 51 | ) 52 | 53 | 54 | if __name__ == '__main__': 55 | pytest.main([__file__]) 56 | -------------------------------------------------------------------------------- /test/test_oneview_login_detail_facts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | ### 4 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # You may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ### 18 | 19 | import pytest 20 | 21 | from hpe_test_utils import OneViewBaseTest 22 | from oneview_module_loader import LoginDetailFactsModule 23 | 24 | PARAMS_GET_DETAILS = dict( 25 | config='config.json' 26 | ) 27 | 28 | LIST_DEFAULT_LOGIN_DETAIL = [{ 29 | "allowLocalLogin": "true", 30 | "category": "null", 31 | "configuredLoginDomains": [ 32 | { 33 | "authProtocol": "AD", 34 | "category": "users", 35 | "created": "Wed Aug 02 15:37:50 UTC 2017", 36 | "eTag": "Wed Aug 02 15:37:50 UTC 2017", 37 | "loginDomain": "1", 38 | "modified": "Wed Aug 02 15:37:50 UTC 2017", 39 | "name": "wpstad.vse.rdlabs.hpecorp.net", 40 | "type": "LoginDomainDetails", 41 | "uri": "/rest/logindetails" 42 | } 43 | ] 44 | }] 45 | 46 | 47 | @pytest.mark.resource(TestLoginDetailFactsModule='login_details') 48 | class TestLoginDetailFactsModule(OneViewBaseTest): 49 | def test_should_get_all_login_details(self): 50 | self.resource.get_login_details.return_value = LIST_DEFAULT_LOGIN_DETAIL 51 | self.mock_ansible_module.params = PARAMS_GET_DETAILS 52 | 53 | LoginDetailFactsModule().run() 54 | 55 | self.mock_ansible_module.exit_json.assert_called_once_with( 56 | changed=False, 57 | ansible_facts=dict(login_details=LIST_DEFAULT_LOGIN_DETAIL) 58 | ) 59 | 60 | 61 | if __name__ == '__main__': 62 | pytest.main([__file__]) 63 | -------------------------------------------------------------------------------- /test/test_oneview_switch_type_facts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | ### 4 | # Copyright (2016-2019) Hewlett Packard Enterprise Development LP 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # You may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ### 18 | 19 | import pytest 20 | 21 | from hpe_test_utils import OneViewBaseFactsTest 22 | from oneview_module_loader import SwitchTypeFactsModule 23 | 24 | ERROR_MSG = 'Fake message error' 25 | 26 | PARAMS_GET_ALL = dict( 27 | config='config.json', 28 | name=None 29 | ) 30 | 31 | PARAMS_GET_BY_NAME = dict( 32 | config='config.json', 33 | name="Test Switch Type 2" 34 | ) 35 | 36 | SWITCH_TYPES = [{"name": "Test Switch Type 1"}, {"name": "Test Switch Type 2"}, {"name": "Test Switch Type 3"}] 37 | 38 | 39 | @pytest.mark.resource(TestSwitchTypeFactsModule='switch_types') 40 | class TestSwitchTypeFactsModule(OneViewBaseFactsTest): 41 | def test_should_get_all_switch_types(self): 42 | self.resource.get_all.return_value = SWITCH_TYPES 43 | self.mock_ansible_module.params = PARAMS_GET_ALL 44 | 45 | SwitchTypeFactsModule().run() 46 | 47 | self.mock_ansible_module.exit_json.assert_called_once_with( 48 | changed=False, 49 | ansible_facts=dict(switch_types=(SWITCH_TYPES)) 50 | ) 51 | 52 | def test_should_get_switch_type_by_name(self): 53 | self.resource.get_by.return_value = [SWITCH_TYPES[1]] 54 | self.mock_ansible_module.params = PARAMS_GET_BY_NAME 55 | 56 | SwitchTypeFactsModule().run() 57 | 58 | self.mock_ansible_module.exit_json.assert_called_once_with( 59 | changed=False, 60 | ansible_facts=dict(switch_types=([SWITCH_TYPES[1]])) 61 | ) 62 | 63 | 64 | if __name__ == '__main__': 65 | pytest.main([__file__]) 66 | -------------------------------------------------------------------------------- /test/test_oneview_version_facts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | ### 4 | # Copyright (2016-2017) Hewlett Packard Enterprise Development LP 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # You may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | ### 18 | 19 | import pytest 20 | 21 | from hpe_test_utils import OneViewBaseTest 22 | from oneview_module_loader import VersionFactsModule 23 | 24 | PARAMS_GET = dict( 25 | config='config.json' 26 | ) 27 | 28 | DICT_DEFAULT_VERSION = [{ 29 | "currentVersion": 500, 30 | "minimumVersion": 120 31 | }] 32 | 33 | 34 | @pytest.mark.resource(TestVersionFactsModule='versions') 35 | class TestVersionFactsModule(OneViewBaseTest): 36 | def test_should_get_appliance_current_version_and_minimum_version(self): 37 | self.resource.get_version.return_value = DICT_DEFAULT_VERSION 38 | self.mock_ansible_module.params = PARAMS_GET 39 | VersionFactsModule().run() 40 | 41 | self.mock_ansible_module.exit_json.assert_called_once_with( 42 | changed=False, 43 | ansible_facts=dict(version=DICT_DEFAULT_VERSION) 44 | ) 45 | 46 | 47 | if __name__ == '__main__': 48 | pytest.main([__file__]) 49 | -------------------------------------------------------------------------------- /test_requirements.txt: -------------------------------------------------------------------------------- 1 | coverage 2 | coveralls 3 | flake8 4 | mock 5 | pytest 6 | pytest-cov 7 | six 8 | --------------------------------------------------------------------------------