{"id":19546022,"url":"https://github.com/hewlettpackard/chef-provisioning-oneview","last_synced_at":"2025-04-26T19:32:09.124Z","repository":{"id":59152039,"uuid":"38077730","full_name":"HewlettPackard/chef-provisioning-oneview","owner":"HewlettPackard","description":"Chef Provisioning Driver for HPE OneView","archived":false,"fork":false,"pushed_at":"2017-05-03T20:16:32.000Z","size":1708,"stargazers_count":21,"open_issues_count":3,"forks_count":16,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-04-17T05:12:39.201Z","etag":null,"topics":["bare-metal","chef-provisioning","hpe-oneview","oneview-api","oneview-ruby-sdk"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HewlettPackard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-25T22:27:14.000Z","updated_at":"2024-02-27T09:25:53.000Z","dependencies_parsed_at":"2022-09-13T10:50:26.320Z","dependency_job_id":null,"html_url":"https://github.com/HewlettPackard/chef-provisioning-oneview","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HewlettPackard%2Fchef-provisioning-oneview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HewlettPackard%2Fchef-provisioning-oneview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HewlettPackard%2Fchef-provisioning-oneview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HewlettPackard%2Fchef-provisioning-oneview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HewlettPackard","download_url":"https://codeload.github.com/HewlettPackard/chef-provisioning-oneview/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251041495,"owners_count":21527207,"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":["bare-metal","chef-provisioning","hpe-oneview","oneview-api","oneview-ruby-sdk"],"created_at":"2024-11-11T03:42:43.012Z","updated_at":"2025-04-26T19:32:06.775Z","avatar_url":"https://github.com/HewlettPackard.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chef-provisioning-oneview\n\nChef Provisioning driver for HPE OneView\n\n[![Build Status](https://travis-ci.org/HewlettPackard/chef-provisioning-oneview.svg?branch=master)](https://travis-ci.org/HewlettPackard/chef-provisioning-oneview)\n[![Gem Version](https://badge.fury.io/rb/chef-provisioning-oneview.svg)](https://badge.fury.io/rb/chef-provisioning-oneview)\n\nQuestions or comments? Join the Gitter room  [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/HewlettPackard/chef-provisioning-oneview?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n\nVerified on (may support other versions too, but no guarantees):\n- OneView v1.2.0 - 2.0.0\n- ICsp v7.4.0 - 7.5.0\n\n:warning: This driver does not support provisioning with HPE Synergy Image Streamer. It is recommended to use the [HPE OneView Chef cookbook](https://github.com/HewlettPackard/oneview-chef) to do that.\n\n# Installation\n\n- This program is meant to run inside the chef-client. To install it, add the following to a Chef recipe and run it:\n\n  ```ruby\n  chef_gem 'chef-provisioning-oneview'\n  ```\n\n\n# Credentials \u0026 Configuration\n\nThere are a few different ways to provide credentials and configuration for this driver.\n\n- In a recipe using the `with_driver` method:\n  \n  ```ruby\n  # The basic usage is:\n  # with_driver canonical_url, driver_options\n  \n  with_driver 'oneview:https://oneview.example.com', {\n    oneview: {\n      url: 'https://oneview2.example.com' # Will be overridden by the canonical url above\n      user: 'Administrator',\n      password: 'secret123',\n      token: 'token123', # Optional. Use EITHER this or the username \u0026 password\n      ssl_enabled: true, # Optional. Defaults to true\n      timeout: 10 # Optional. In seconds\n    },\n    icsp: {\n      url: 'https://icsp.example.com'\n      user: 'Admin',\n      password: 'secret456',\n      ssl_enabled: true, # Optional. Defaults to true\n      timeout: 20 # Optional. In seconds\n    }\n  }\n  ```\n\n- You can also use the following options in your `knife.rb` file:\n  \n  ```ruby\n  # (knife.rb)\n  # (in addition to all the normal stuff like node_name, client_key, validation_client_name, validation_key, chef_server_url, etc.)\n  knife[:oneview_url]        = 'https://oneview.example.com'\n  knife[:oneview_username]   = 'Administrator'\n  knife[:oneview_password]   = 'password123'\n  knife[:oneview_token]      = 'token123' # Use EITHER this or the username \u0026 password\n  knife[:oneview_ignore_ssl] = true # For self-signed certs (discouraged)\n  knife[:oneview_timeout]    = 10 # Optional. In seconds\n  \n  knife[:icsp_url]           = 'https://icsp.example.com'\n  knife[:icsp_username]      = 'Administrator'\n  knife[:icsp_password]      = 'password123'\n  knife[:icsp_ignore_ssl]    = true # For self-signed certs (discouraged)\n  knife[:icsp_timeout]       = 20 # Optional. In seconds\n  \n  knife[:node_root_password] = 'password123'\n  \n  # If your Chef server has self-signed certs:\n  verify_api_cert              false\n  ssl_verify_mode              :verify_none\n  ```\n\n- Finally, there are a few environment variables that you can set:\n  \n  ```bash\n  export ONEVIEWSDK_USER='Administrator'\n  export ONEVIEWSDK_PASSWORD='secret123'\n  export ONEVIEWSDK_TOKEN='token123'\n  ```\n\nSince there are a few diferent ways of providing the same config values, here's the order of evaluation:\n  - **OneView URL:** canonical_url (ie `oneview:https://oneview.example.com`), driver_options[:oneview][:url], knife[:oneview_url], ENV['ONEVIEWSDK_URL']\n  - **OneView user, password, \u0026 token:** driver_options, knife, environment variable\n  - **ICSP url, user, \u0026 password:** driver_options, knife\n\nNote: ICSP is not required, so if you don't want to use it, you can leave out those config options and it will be ignored.\n\n### Additional Setup\n\n- Your OneView, Insight Controll Server Provisioning(ICSP), and Chef server must be trusted by your certificate stores. See [examples/ssl_issues.md](examples/ssl_issues.md) for more info on how to do this.\n  - You can also use the OneView SDK cli tool to import your OneView cert. See [this](https://github.com/HewlettPackard/oneview-sdk-ruby#cli).\n- Your OneView and ICSP servers must be set up beforehand. Unfortunately, this driver doesn't do that for you too.\n\n# Usage\n\nExample recipe:\n```ruby\nrequire 'chef/provisioning'\n\nwith_driver 'oneview:https://oneview.example.com', {\n  oneview: { user: 'Administrator', password: 'secret123' },\n  icsp: { url: 'https://icsp.example.com' user: 'Admin', password: 'secret456' }\n}\n\nmachine 'web01' do\n  recipe 'my_server_cookbook::default'\n\n  machine_options driver_options: {\n      server_template: 'Web Server Template', # Name of Template OR Server Profile\n      os_build: 'CHEF-RHEL-6.5-x64', # Name of OS Build Plan on ICSP. Supports array of strings also.\n      server_location: 'Encl1, bay 16', # Optional. Use to provision a specific server\n      \n      host_name: 'chef-web01',\n      ip_address: 'xx.xx.xx.xx', # For bootstrapping. Deprecated in favor of { bootstrap: true } in connection; see below\n      domainType: 'workgroup',\n      domainName: 'sub.domain.com',\n      mask: '255.255.255.0', # Can set here or in individual connections below\n      dhcp: false, # Can set here or in individual connections below\n      gateway:  'xx.xx.xx.1', # Can set here or in individual connections below\n      dns: 'xx.xx.xx.xx,xx.xx.xx.xx,xx.xx.xx.xx', # Can set here or in individual connections below\n      connections: {\n        #1 =\u003e { ... } (Reserved for PXE on our setup)\n        2 =\u003e {\n          ip4Address: 'xx.xx.xx.xx',\n          mask: '255.255.254.0', # Optional. Overrides mask property above\n          dhcp: false            # Optional. Overrides dhcp property above\n          gateway: 'xx.xx.xx.1'  # Optional. Overrides gateway property above\n          dns: 'xx.xx.xx.xx'     # Optional. Overrides dns property above\n          bootstrap: true        # Set this on 1 connection only. Tells Chef which connection to use to bootstrap.\n        },\n        3 =\u003e {\n          dhcp: true             # Optional. Overrides dhcp property above\n          gateway: :none         # Optional. Overrides gateway property above\n          dns: :none             # Optional. Overrides dns property above\n        }\n      },\n      skip_network_configuration: false, # Default. Set to true for EXSi hosts, etc.\n      custom_attributes: {\n        chefCert: 'ssh-rsa AA...' # Optional\n      }\n    },\n    transport_options: {\n      user: 'root', # Optional. Defaults to 'root'\n      ssh_options: {\n        password: Chef::Config.knife[:node_root_password]\n      }\n    },\n    convergence_options: {\n      ssl_verify_mode: :verify_none, # Optional. For Chef servers with self-signed certs\n      bootstrap_proxy: 'http://proxy.example.com:8080' # Optional\n    }\n\n  chef_environment '_default'\n  converge true\nend\n```\n\nSee https://github.com/chef/chef-provisioning-ssh for more transport_options.\n\nNOTE: Some basic connection settings such as :ip4Address and :dhcp are shown in the example recipe, but you can pass in any interface/nic options that exist in the ICsp api for POST requests to /rest/os-deployment-jobs\n\n### Custom Attributes\n\nInsided the custom attributes hash, you can specify any data that you would like to pass into your ICsp build plan scripts or configuration files. For example, to specify a list of trusted public keys to be placed into the node's .ssh/authorized_keys file, add a custom attribute to the machine resource definition:\n\n```ruby\ncustom_attributes: {\n  chefCert: 'ssh-rsa AA...'\n}\n```\n\nThen create/modify a custom build script in ICsp that will do something with this data. To access it, use the format: `@variable_name@` or `@variable_name:default_value@`. For our example, we could do something like:\n\n```bash\n#!/bin/bash\nauthorized_keys = @chefCert@\nif [ -n \"$authorized_keys\"]; then\n  echo -e \"$authorized_keys\" \u003e /mnt/sysimage/root/.ssh/authorized_keys\nfi\n```\n\n### SSH Keys\n\nTo use SSH keys insead of passwords to connect to nodes, you'll need to modify your transport_options to look something like:\n\n```ruby\ntransport_options: {\n  ssh_options: {\n    auth_methods: ['publickey'],\n    keys: ['~/.ssh/id_rsa']\n  }\n}\n```\n\nYou'll also need to put the corresponding public key(s) into the node's authorized_keys file during the OS setup. See the Custom Attributes section above for one way to do this.\n\n### Behind a proxy\n\nAdd `bootstrap_proxy: 'http://proxy.example.com:8080'` to your convergence_options hash.\nAlso, make sure your OS build plans set up the proxy configuration in a post OS install script.\n\n### SAN Storage\n\nIn order to attach a SAN volume as a bootable volume, the volume name must start with 'boot'; it will be appended with the the profile name on creation.\n\n### Switching to a different network after provisioning\n\nAdd `1 =\u003e {net: \"Deadnetwork\", deployNet: \"PXE Network\", dhcp: true}` to your connections hash. \nThis will flip the first connection of the newly provisioned machine off of your pxe network to your Deadnetwork right after provisioning. This is helpful for taking the newly provisioned machine off the PXE network as soon as possible. \n\n### Adding Nic Teams\n\nAdd `team: 'TeamName'` into a connection in your connections hash. Make sure that you have 2 connections in a team and the name does not include hyphens. This information will be passed to ISCP as the 'teams' custom attribute in the format: `\"TeamName1-mac1,mac2|TeamName2-mac6,mac7,mac8\"` to be consumed in a custom build plan script.\n\n# Doing a test run\n\nThis repo contains everything you need to get started, including example recipes and knife configuration files. See the README in the [examples](examples/) directory for how to begin provisioning.\n\n\n# Troubleshooting\n\nSee the [Trouleshooting wiki page](https://github.com/HewlettPackard/chef-provisioning-oneview/wiki/Troubleshooting)\n\n\n# Contributing\n\nYou know the drill. Fork it, branch it, change it, commit it, pull-request it. We're passionate about improving this driver, and glad to accept help to make it better.\n\n### Building the Gem\n\nTo build this gem, run `$ rake build` or `gem build chef-provisioning-oneview.gemspec`.\n\nThen once it's built you can install it by running `$ rake install` or `$ gem install ./chef-provisioning-oneview-\u003cVERSION\u003e.gem`.\n\nNote: You may need to first install the `ruby-devel` or `ruby-dev` package for your system.\n\n### Testing\n\n- RuboCop: `$ rake rubocop` or `$ rubocop .`\n- Rspec: `$ rake spec` or `$ rspec`\n- Both: Run `$ rake test` to run both RuboCop and Rspec tests.\n\n# Authors\n\n - Jared Smartt - [@jsmartt](https://github.com/jsmartt)\n - Matthew Frahry - [@mbfrahry](https://github.com/mbfrahry)\n - Andy Claiborne - [@veloandy](https://github.com/veloandy)\n - Gunjan Kamle - [@kgunjan](https://github.com/kgunjan)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhewlettpackard%2Fchef-provisioning-oneview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhewlettpackard%2Fchef-provisioning-oneview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhewlettpackard%2Fchef-provisioning-oneview/lists"}