Welcome to your guide on utilizing HPE OneView SDK for Ansible! While this project is no longer being maintained, it paves the way for you to transition to the newer Ansible Collection. This article will guide you through the process of installation, configuration, and usage of the HPE OneView SDK for Ansible modules.
Understanding HPE OneView
HPE OneView serves as a robust tool for deploying and managing complex hybrid cloud infrastructures. It transforms traditional data centers into software-defined environments, supporting a wide range of HPE servers, storage, and networking solutions. By employing HPE OneView REST APIs, the SDK provides modules that allow you to manage resources using Ansible playbooks.
Installation and Configuration
There are two primary methods to install the HPE OneView SDK for Ansible: from source or using a Docker container. Here’s how to do it:
1. Installation from Source
- Clone the repository:
bash
$ git clone https://github.com/HewlettPackard/oneview-ansible.git
$ cd oneview-ansible
bash
$ pip install -r requirements.txt
bash
$ export ANSIBLE_LIBRARY=path/to/oneview-ansible/library
$ export ANSIBLE_MODULE_UTILS=path/to/oneview-ansible/library/module_utils
2. Installation from Docker Container
- Pull the Docker image:
bash
$ docker pull hewlettpackardenterprise/hpe-oneview-sdk-for-ansible:v6.1.0-OV6.1
bash
$ docker run -it hewlettpackardenterprise/hpe-oneview-sdk-for-ansible:v6.1.0-OV6.1 bin/sh
Configuring the OneView Client
Setting up the OneView client correctly is vital for successful operations. You can use either a JSON configuration file or environment variables to manage your connection properties.
Using a JSON Configuration File
Your JSON file should include connection parameters such as the hostname, username, and password:
{
"ip": "172.25.105.12",
"credentials": {
"userName": "Administrator",
"authLoginDomain": "",
"password": "secret123"
},
"api_version": 2800
}
Using Environment Variables
Alternatively, you can configure settings through environment variables:
bash
export ONEVIEWSDK_IP=172.25.105.12
export ONEVIEWSDK_USERNAME=Administrator
export ONEVIEWSDK_PASSWORD=secret123
Writing Playbooks
To interact with your HPE OneView environment, you’ll write Ansible playbooks. Here is how you can define tasks in your YAML file:
yaml
- name: Create a Fibre Channel Network
oneview_fc_network:
hostname: 172.16.101.48
username: administrator
password: my_password
api_version: 2800
state: present
data:
name: network_name
fabricType: FabricAttach
Ensure to set the no_log: true option while dealing with sensitive information.
Troubleshooting
If you encounter any issues such as connection errors or module failures, consider the following:
- Check if the OneView appliance IP address and login credentials are correct.
- Ensure that the required Python packages and Ansible version are installed.
- For Docker users, verify if the necessary permissions for accessing the Docker container are granted.
- If the problem persists, check the configuration files for syntax errors or misconfigurations.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
By following these steps, you should be on your way to successfully integrating HPE OneView SDK for Ansible into your environment. Don’t hesitate to explore sample playbooks and examples to visualize how tasks can be executed.
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

