{"id":19546062,"url":"https://github.com/hewlettpackard/oneview-ansible","last_synced_at":"2025-04-13T09:44:36.600Z","repository":{"id":49002954,"uuid":"41844980","full_name":"HewlettPackard/oneview-ansible","owner":"HewlettPackard","description":"This project is no longer being developed and has limited support.  Please use the newer Ansible Collection project: https://github.com/HewlettPackard/oneview-ansible-collection","archived":false,"fork":false,"pushed_at":"2023-11-14T17:09:24.000Z","size":7745,"stargazers_count":104,"open_issues_count":3,"forks_count":65,"subscribers_count":35,"default_branch":"master","last_synced_at":"2025-03-27T01:11:41.877Z","etag":null,"topics":["ansible","ansible-modules","bare-metal","devops","hpe-oneview","infrastructure-as-code"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HewlettPackard.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-03T06:17:52.000Z","updated_at":"2024-07-28T20:24:10.000Z","dependencies_parsed_at":"2024-08-03T09:04:43.404Z","dependency_job_id":"3ae2b47d-6bde-4676-bab2-b20a68a5a157","html_url":"https://github.com/HewlettPackard/oneview-ansible","commit_stats":{"total_commits":2072,"total_committers":53,"mean_commits":"39.094339622641506","dds":0.9015444015444015,"last_synced_commit":"a1befcab3ff8d23ab7f85844eeba0d2f2c6a21e2"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HewlettPackard%2Foneview-ansible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HewlettPackard%2Foneview-ansible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HewlettPackard%2Foneview-ansible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HewlettPackard%2Foneview-ansible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HewlettPackard","download_url":"https://codeload.github.com/HewlettPackard/oneview-ansible/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248694176,"owners_count":21146944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-modules","bare-metal","devops","hpe-oneview","infrastructure-as-code"],"created_at":"2024-11-11T03:42:57.335Z","updated_at":"2025-04-13T09:44:36.572Z","avatar_url":"https://github.com/HewlettPackard.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HPE OneView SDK for Ansible\n\n## 📢 This project is no longer being maintained.  Please use the newer [Ansible Collection](https://github.com/HewlettPackard/oneview-ansible-collection) project.\n\n\n\n\n## Build Status \n\nOV Version | 6.10 | 6.00 | 5.60 | 5.50 | 5.40 |\n| ------------- |:-------------:| :-------------:| -------------:| -------------:| -------------:|\nSDK Version/Tag | [v6.1.0](https://github.com/HewlettPackard/oneview-ansible/releases/tag/v6.1.0) | [v6.0.0](https://github.com/HewlettPackard/oneview-ansible/releases/tag/v6.0.0) | [v5.10.0](https://github.com/HewlettPackard/oneview-ansible/releases/tag/v5.10.0) | [v5.9.0](https://github.com/HewlettPackard/oneview-ansible/releases/tag/v5.9.0) | [v5.8.0](https://github.com/HewlettPackard/oneview-ansible/releases/tag/v5.8.0) |\nBuild Status | [![Build status](https://action-badges.now.sh/JasonEtco/action-badges)](https://github.com/HewlettPackard/oneview-ansible/actions/runs/728647209)| [![Build status](https://action-badges.now.sh/JasonEtco/action-badges)](https://github.com/HewlettPackard/oneview-ansible/actions/runs/632120002)| [![Build status](https://api.travis-ci.com/HewlettPackard/oneview-ansible.svg?branch=master\u0026status=passed)](https://travis-ci.com/github/HewlettPackard/oneview-ansible/builds/216616724)| [![Build status](https://api.travis-ci.com/HewlettPackard/oneview-ansible.svg?branch=master\u0026status=passed)](https://travis-ci.org/github/HewlettPackard/oneview-ansible/builds)| [![Build status](https://api.travis-ci.com/HewlettPackard/oneview-ansible.svg?branch=master\u0026status=passed)](https://travis-ci.org/github/HewlettPackard/oneview-ansible/builds)|\n\n\n## Introduction\n\nHPE OneView makes it simple to deploy and manage today’s complex hybrid cloud infrastructure. HPE OneView can help you transform your data center to software-defined, and it supports HPE’s broad portfolio of servers, storage, and networking solutions, ensuring the simple and automated management of your hybrid infrastructure. Software-defined intelligence enables a template-driven approach for deploying, provisioning, updating, and integrating compute, storage, and networking infrastructure.\n\nThe HPE OneView Ansible library provides modules to manage HPE OneView using Ansible playbooks using HPE OneView REST APIs. You can find the latest supported HPE OneView Ansible SDK [here](https://github.com/HewlettPackard/oneview-ansible/releases/latest)\n\nEach OneView resource operation is exposed through an Ansible module. Specific modules are provided to gather facts about the resource. The detailed documentation for each module is available at: [HPE OneView Ansible Modules Documentation](https://github.com/HewlettPackard/oneview-ansible/blob/master/oneview-ansible.md)\n\n\n## What's New\n\nHPE OneView Ansible library extends support of the SDK to OneView REST API version 2800 (OneView v6.10) and ImageStreamer REST API version 2020 (I3S v6.10)\n\nPlease refer to [notes](https://github.com/HewlettPackard/oneview-ansible/blob/master/CHANGELOG.md) for more information on the changes , features supported and issues fixed in this version\n\n\n## Getting Started \n\n## Installation and Configuration\nHPE OneView SDK for Ansible can be installed from Source and Docker container installation methods.\n\t\n## Requirements\nTo run the Ansible modules provided in this project, we need the below : \n \n\tAnsible \u003c= 2.9\n\tPython \u003e= 3.4.2\n\thpeOneView==6.1.0\n \n## Installation\n\n### Perform a full installation from Source\n   \n#### Clone the repository\n```bash\n$ git clone https://github.com/HewlettPackard/oneview-ansible.git\n$ cd oneview-ansible\n```\n\n#### Install dependency packages using PIP\n```bash\n$ pip install -r requirements.txt\n```\n\n#### Configure the ANSIBLE_LIBRARY environmental variable\nSet the environment variables `ANSIBLE_LIBRARY` and `ANSIBLE_MODULE_UTILS`, specifying the `library` full path from the cloned project:\n```bash\n$ export ANSIBLE_LIBRARY=/path/to/oneview-ansible/library\n$ export ANSIBLE_MODULE_UTILS=/path/to/oneview-ansible/library/module_utils/\n```\n\n### From Docker Image / Container\nThe containerized version of the oneview-ansible modules is available in the [Docker Store](https://store.docker.com/community/images/hewlettpackardenterprise/hpe-oneview-sdk-for-ansible). The Docker Store image tag consist of two sections: \u003csdk_version-OV_version\u003e\n\n#### Download and store a local copy of  hpe-oneview-sdk-for-ansible and use it as a Docker image.\n```bash\n$ docker pull hewlettpackardenterprise/hpe-oneview-sdk-for-ansible:v6.1.0-OV6.1\n```\n\n#### Run docker command which in turn will create a sh session where SDK user can create files, issue commands and execute playbooks\n```bash\n$ docker run -it hewlettpackardenterprise/hpe-oneview-sdk-for-ansible:v6.1.0-OV6.1 /bin/sh\n```\n\nThere is also a [how-to guide](https://github.com/HewlettPackard/oneview-ansible-samples/blob/master/oneview-ansible-in-container/oneview-ansible-in-container.md) with instructions on how to use the container without creating a sh session.\n   \n   \n## OneView Client Configuration\n\n### Using a JSON Configuration File\nTo use the Ansible OneView modules, connection properties for accessing the OneView appliance can be set in a JSON file. This file is used to define the settings, which will be used on the OneView appliance connection, like hostname, authLoginDomain, username, and password. Here's an example:\n```json\n{\n  \"ip\": \"172.25.105.12\",\n  \"credentials\": {\n    \"userName\": \"Administrator\",\n    \"authLoginDomain\": \"\",\n    \"password\": \"secret123\"\n  },\n  \"api_version\": 2800\n}\n```\n\nThe `api_version` specifies the version of the REST API to be invoked. When `api_version` is not specified, it will take provided appliance API version as `api_version`.\n\nThe `authLoginDomain` specifies the login domain directory of the appliance. When `authLoginDomain` is not specified, it will consider the appliance's default domain directory.\n\nIf your environment requires a proxy, define the proxy properties in the JSON file using the following syntax:\n```json\n  \"proxy\": \"\u003cproxy_host\u003e:\u003cproxy_port\u003e\"\n```\n\n:lock: Tip: Check the file permissions since the password is stored in clear-text.\n\nThe configuration file path must be provided for all of the playbooks `config` arguments. For example:\n\n```yml\n- name: Gather facts about the FCoE Network with name 'FCoE Network Test'\n  oneview_fcoe_network_facts:\n    config: \"/path/to/config.json\"\n    name: \"FCoE Network Test\"\n```\n\n### Environment Variables\n\nConfiguration can also be defined through environment variables:\n\n```bash\n# Required\nexport ONEVIEWSDK_IP='172.25.105.12'\nexport ONEVIEWSDK_USERNAME='Administrator'\nexport ONEVIEWSDK_PASSWORD='secret123'\n\n# Optional\nexport ONEVIEWSDK_API_VERSION='2800'\nexport ONEVIEWSDK_AUTH_LOGIN_DOMAIN='authdomain'\nexport ONEVIEWSDK_PROXY='\u003cproxy_host\u003e:\u003cproxy_port\u003e'\n```\n\n:lock: Tip: Make sure no unauthorised person has access to the environment variables, since the password is stored in clear-text.\n\nIn this case, you shouldn't provide the `config` argument. For example:\n\n```yml\n- name: Gather facts about the FCoE Network with name 'FCoE Network Test'\n  oneview_fcoe_network_facts:\n    name: \"FCoE Network Test\"\n```\n\nOnce you have defined the environment variables, you can run the plays.\n\n### Parameters in the playbook\n\nThe third way to pass in your HPE OneView credentials to your tasks is through explicit specification on the task. \nThis option allows the parameters `hostname`, `auth_login_domain`,`username`, `password`, `api_version` and `image_streamer_hostname` to be passed directly inside your task.\n\n```yaml\n- name: Create a Fibre Channel Network\n  oneview_fc_network:\n    hostname: 172.16.101.48\n    username: administrator\n    password: my_password\n    auth_login_domain: \"\"\n    api_version: 2800\n    state: present\n    data:\n      name: \"{{ network_name }}\"\n      fabricType: 'FabricAttach'\n      linkStabilityTime: '30'\n      autoLoginRedistribution: true\n  no_log: true\n  delegate_to: localhost\n```\nSetting `no_log: true` is highly recommended in this case, as the credentials are otherwise returned in the log after task completion.\n\n### Storing credentials using Ansible Vault\n\nAnsible Vault feature may be leveraged for storing the credential of the user in encrypted format.\n\n  1. Create a oneview_config.yml file.\n  2. Run below commands to encrypt your username and password for oneview. \n     ```ansible-vault\n     ansible-vault encrypt_string 'secret123' --name ONEVIEWSDK_PASSWORD\n     ```\n     Note: This password will be used to run the playbook.\n  3. Paste the encrypted password along with the configuration in oneview_config.yml file.\n\n\t    ```yaml\n\t    # Required\n\t    ip: 172.168.1.1\n\t    api_version:2800\n\t    username: Administrator\n\t    password: !vault |\n          $ANSIBLE_VAULT;1.1;AES256\n          37646435306637633461376438653439323666383934353234333934616363313164636637376536\n          3239356538653537643734626265366662623863323661350a613834313562303635343931356139\n          35343863313563363830356638343339373138316539613636336532333065366133386662333833\n          6663363236663031340a636562646634323136353737373539326434626137353837333530376665\n          3835\n\t    ```\n\n  4. Update the oneview_config.yml as vars_file in playbook for example:\n\n```yaml\n- vars_file:\n   oneview_config.yml\n- name: Create a Fibre Channel Network\n  oneview_fc_network:\n    hostname: \"{{ ip }}\"\n    username: \"{{ username }}\"\n    password: \"{{ password }}\"\n    auth_login_domain: \"{{ domain_directory }}\"\n    api_version: \"{{ api_version }}\"\n    state: present\n    data:\n      name: \"{{ network_name }}\"\n      fabricType: 'FabricAttach'\n      linkStabilityTime: '30'\n      autoLoginRedistribution: true\n  no_log: true\n  delegate_to: localhost\n```\n\nWe can encrypt the oneview_config.yml file also, but if you encrypt the file then you shall not encrypt the password inside the encrypted file. \n\t\n🔒 Tip: Make sure no unauthorised person has access to the encrypted variables/files, since the password can be decrypted with the password.\n\n5. Run the playbook with --ask-vault-pass option to get the password prompt to run the playbook.\n```bash   \nansible-playbook example.yml --ask-vault-pass\n```\nNote: Most of the examples provided in this repository uses OneView Credentials in plain text.\n\n### Setting OneView API Version\n\nThe Ansible modules for HPE OneView support the API endpoints for HPE OneView 4.00, 4.10, 4.20, 5.00, 5.20, 5.30, 5.40, 5.50, 5.60, 6.00, 6.10 \u003cbr/\u003e\nThe current `default` HPE OneView version will pick the OneView appliance version.\n\nTo use a different API, you must set the API version together with your credentials, either using the JSON configuration:\n```bash\n\"api_version\": 2800\n```\n\nOR using the Environment variable: \n```bash\nexport ONEVIEWSDK_API_VERSION='2800'\n```\n\nIf this property is not specified, it will fall back to the default value.\n\n### HPE Synergy Image Streamer\n\nModules to manage HPE Synergy Image Streamer appliances are also included in this project. To use these modules, you must set the Image Streamer IP on the OneViewClient configuration, either using the JSON configuration:\n\n```json\n\"image_streamer_ip\": \"100.100.100.100\"\n```\n\nOR using the Environment variable:\n```bash\nexport ONEVIEWSDK_IMAGE_STREAMER_IP='100.100.100.100'\n```\n\n## Examples\n\nSample playbooks and instructions on how to run the modules can be found in the [`examples`](/examples) directory.\nYou can find sample playbooks in the [examples](https://github.com/HewlettPackard/oneview-ansible/tree/master/examples) folder. Just look for the playbooks with the ```image_streamer_``` prefix.\n\n### Example of a playbook using Ansible OneView modules\n\n```yml\n- hosts: all\n  tasks:\n\n    - name: Ensure that the Fibre Channel Network is present with fabricType 'DirectAttach'\n      oneview_fc_network:\n        config: \"/path/to/config.json\"\n        state: present\n        data:\n          name: 'New FC Network'\n          fabricType: 'DirectAttach'\n\n    - name: Ensure that Fibre Channel Network is absent\n      oneview_fc_network:\n        config: \"/path/to/config.json\"\n        state: absent\n        data:\n          name: 'New FC Network'\n\n    - name: Gather facts about the FCoE Network with name 'Test FCoE Network Facts'\n      oneview_fcoe_network_facts:\n        config: \"/path/to/config.json\"\n        name: \"Test FCoE Network Facts\"\n```\n\n\n#### End-to-end examples\n\n- An end-to-end DevOps example using HPE OneView for the bare metal server provisioning, HPE ICsp for OS deployment, and Ansible modules for software setup is provided at: [Accelerating DevOps with HPE OneView and Ansible sample](/examples/oneview-web-farm).\n\n- A collection of examples of how to use HPE OneView with HPE Synergy Image Streamer for OS Deployment is available at: [HPE Synergy OS Deployment Sample](https://github.com/HewlettPackard/oneview-ansible/blob/master/examples/synergy_create_server_profile_with_deployment_plan.yml) and [HPE Image Streamer Samples](https://github.com/HewlettPackard/oneview-ansible/blob/master/examples/ImageStreamer)\n\n- An example of how to upload an artifact bundle for HPE Synergy Image Streamer and deploy a blade server in HPE OneView using the OS build plan provided in the artifact bundle is available at: [HPE Synergy + OneView Sample](https://github.com/HewlettPackard/oneview-ansible/blob/master/examples/synergy_image_streamer.yml).\n\n- Examples of bare metal infrastructure setup using HPE OneView and Ansible are available at:\n  - [C7000 Environment Setup](https://github.com/HewlettPackard/oneview-ansible/blob/master/examples/c7000_environment_setup.yml)\n  - [HPE Synergy Environment Setup](https://github.com/HewlettPackard/oneview-ansible/blob/master/examples/synergy_environment_setup.yml)\n\n\n## Getting Help \n\nAre you running into a road block? Have an issue with unexpected bahriov? Feel free to open a new issue on the [issue tracker](https://github.com/HewlettPackard/oneview-ansible/issues)\n\nFor more information on how to open a new issue refer to [How can I get help \u0026 support](https://github.com/HewlettPackard/oneview-ansible/wiki#getting-help---how-can-i-get-help—support)\n\n## License \n\nThis project is licensed under the Apache license. Please see [LICENSE](https://github.com/HewlettPackard/oneview-ansible/blob/master/LICENSE) for more information.\n\n## Contributing and feature requests\n\nWe welcome your contributions to the Ansible Modules for HPE OneView. See [CONTRIBUTING.md](https://github.com/HewlettPackard/oneview-ansible/blob/master/CONTRIBUTING.md) for more details.\n\n## Additional Resources \n\n**HPE OneView Documentation**\n\n[HPE OneView Release Notes](http://hpe.com/info/OneView/docs)\n\n[HPE OneView Support Matrix](http://hpe.com/info/OneView/docs)\n\n[HPE OneView Installation Guide](http://hpe.com/info/OneView/docs)\n\n[HPE OneView User Guide](http://hpe.com/info/OneView/docs)\n\n[HPE OneView Online Help](http://hpe.com/info/OneView/docs)\n\n[HPE OneView REST API Reference](http://hpe.com/info/OneView/docs)\n\n[HPE OneView Firmware Management White Paper](http://hpe.com/info/OneView/docs)\n\n[HPE OneView Deployment and Management White Paper](http://hpe.com/info/OneView/docs)\n\n\n**HPE OneView Community**\n\n[HPE OneView Community Forums](http://hpe.com/info/oneviewcommunity)\n\nLearn more about HPE OneView at [hpe.com/info/oneview](https://hpe.com/info/oneview)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhewlettpackard%2Foneview-ansible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhewlettpackard%2Foneview-ansible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhewlettpackard%2Foneview-ansible/lists"}