This repository has been archived by the owner on Nov 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
1,440 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
source ENV['GEM_SOURCE'] || 'https://rubygems.org' | ||
|
||
puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['>= 3.3'] | ||
gem 'metadata-json-lint' | ||
gem 'puppet', puppetversion | ||
gem 'puppetlabs_spec_helper', '>= 1.0.0' | ||
gem 'puppet-lint', '>= 1.0.0' | ||
gem 'facter', '>= 1.7.0' | ||
gem 'rspec-puppet' | ||
|
||
# rspec must be v2 for ruby 1.8.7 | ||
if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' | ||
gem 'rspec', '~> 2.0' | ||
gem 'rake', '~> 10.0' | ||
else | ||
# rubocop requires ruby >= 1.9 | ||
gem 'rubocop' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
## PureStorage Puppet Module | ||
|
||
[](https://forge.puppetlabs.com/pure/pure) | ||
**Note: This address will be effective once the module is published on puppetforge. | ||
|
||
#### Table of Contents | ||
|
||
1. [Disclaimer](#disclaimer) | ||
2. [Overview](#overview) | ||
3. [Description](#description) | ||
4. [Setup](#setup) | ||
* [Connecting to a PureStorage Array](#connecting-to-a-purestorage-array) | ||
5. [Usage](#usage) | ||
* [Puppet Device](#puppet-device) | ||
* [Puppet Agent](#puppet-agent) | ||
* [Puppet Apply](#puppet-apply) | ||
6. [Supported use-cases](#supported-use-cases) | ||
7. [Limitations](#limitations) | ||
8. [Development](#development) | ||
|
||
## Disclaimer | ||
|
||
This provider is written as best effort and provides no warranty expressed or | ||
implied. Please contact the author(s) via [Pure Storage Support Team](https://www.purestorage.com/support.html) if you have | ||
questions about this module before running or modifying. | ||
|
||
## Overview | ||
|
||
The PureStorage provider allows you to provision volumes on a PureStorage array | ||
from either a puppet client or a puppet device proxy host. The provider has | ||
been developed against CentOS 7.2 using Puppet-4.8.1. At this stage testing | ||
is completely manual. | ||
|
||
## Description | ||
|
||
Using the `volume`, `hostconfig` and `connection` types, one | ||
can quickly provision remote storage and attach it via iSCSI from a | ||
PureStorage array to a client. | ||
|
||
The provider utilizes the robust REST API (V1.6) available on the PureStorage | ||
array to remotely provision the necessary resources. | ||
|
||
## Setup | ||
|
||
### Connecting to a PureStorage Array | ||
|
||
A connection to a PureStorage array is via the storage array IP address | ||
or FQDN name of the storage array and through use of a Admin account. | ||
A connection string is needed to inform the providers how to connect. | ||
The providers can get the connection string from various locations | ||
(see Usage below) but the three pieces of information necessary are: | ||
|
||
1. Admin account user name. | ||
2. Admin account password. | ||
3. IP address or DNS name. | ||
|
||
If multiple connection options are provided to the provider, it will use them | ||
in the following order: | ||
|
||
1. Any existing connection. | ||
2. A Facter-supplied URL. | ||
3. A user-supplied URL (in device.conf or site.pp file). | ||
|
||
## Usage | ||
|
||
### Puppet Device | ||
|
||
The Puppet Network Device system is a way to configure devices' (switches, | ||
routers, storage) which do not have the ability to run puppet agent on | ||
the devices. The device application acts as a smart proxy between the Puppet | ||
Master and the managed network device. To do this, puppet device will | ||
sequentially connects to the master on behalf of the managed network device | ||
and will ask for a catalog (a catalog containing only network device | ||
resources). It will then apply this catalog to the said device by translating | ||
the resources to orders the network device understands. Puppet device will | ||
then report back to the master for any changes and failures as a standard node. | ||
|
||
The PureStorage providers are designed to work with the puppet device concept and | ||
in this case will retrieve their connection information from the `url` given | ||
in Puppet's `device.conf` file. An example is shown below: | ||
|
||
[array1.puretec.purestorage.com] | ||
type pure | ||
url https://<admin>:<password>@puretec.purestorage.com | ||
|
||
In the case of Puppet Device connection to the PureStorage is from the machine | ||
running 'device' only. | ||
|
||
command : "puppet device" | ||
|
||
### Puppet Agent | ||
|
||
Puppet agent is the client/slave side of the puppet master/slave relationship. | ||
In the case of puppet agent the connection information needs to be included in | ||
the manifest supplied to the agent from the master or it could be included | ||
in a custom fact passed to the client. The connection string must be supplied | ||
as a URL. See the example manifests (complete_create.pp) for details. | ||
|
||
In the case of Puppet Agent, connections to the PureStorage array will be | ||
initiated from every machine which utilizes the PureStorage puppet module this | ||
way. This may be of security concern for some folks. | ||
|
||
Command: "puppet agent -t" | ||
|
||
### Puppet Apply | ||
|
||
Puppet apply is the client only application of a local manifest. Puppet apply | ||
is supported similar to puppet agent by the PureStorage providers. | ||
The connection string must be supplied as a URL. See the example | ||
manifests (complete_create.pp) for details. | ||
|
||
Command: "puppet apply <manifest_file_path>" | ||
e.g. "puppet apply /etc/puppetlabs/code/environments/production/manifests/site.pp" | ||
|
||
## Supported use-cases: | ||
|
||
1. create \ update \ delete volume | ||
* Array of iqn-list supported | ||
eg. host_iqnlist => ["iqn.1994-04.jp.co.pure:rsd.d9s.t.10103.0e03j","iqn.1994-04.jp.co.pure:rsd.d9s.t.10103.0e03k"], | ||
** volume size cannot be reduced REST API constraint. | ||
2. create \ update \ delete host | ||
3. create \ delete connection | ||
|
||
## Limitations | ||
|
||
Today pure puppet module supports create, update, delete of | ||
volume ,host and direct connection (between the two). | ||
Today, it supports IQN ids for iSCSI only. | ||
|
||
## Development | ||
|
||
Please see the [Pure Storage](https://www.purestorage.com/support.html) for any issues, | ||
discussion, advice or contribution(s). | ||
|
||
To get started with developing this module, you'll need a functioning Ruby installation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'puppetlabs_spec_helper/rake_tasks' | ||
require 'puppet-lint/tasks/puppet-lint' | ||
require 'metadata-json-lint/rake_task' | ||
|
||
if RUBY_VERSION >= '1.9' | ||
require 'rubocop/rake_task' | ||
RuboCop::RakeTask.new | ||
end | ||
|
||
PuppetLint.configuration.send('disable_80chars') | ||
PuppetLint.configuration.relative = true | ||
PuppetLint.configuration.ignore_paths = ['spec/**/*.pp', 'pkg/**/*.pp'] | ||
|
||
desc 'Validate manifests, templates, and ruby files' | ||
task :validate do | ||
Dir['manifests/**/*.pp'].each do |manifest| | ||
sh "puppet parser validate --noop #{manifest}" | ||
end | ||
Dir['spec/**/*.rb', 'lib/**/*.rb'].each do |ruby_file| | ||
sh "ruby -c #{ruby_file}" unless ruby_file =~ %r{spec/fixtures} | ||
end | ||
Dir['templates/**/*.erb'].each do |template| | ||
sh "erb -P -x -T '-' #{template} | ruby -c" | ||
end | ||
end | ||
|
||
desc 'Run metadata_lint, lint, validate, and spec tests.' | ||
task :test do | ||
[:metadata_lint, :lint, :validate, :spec].each do |test| | ||
Rake::Task[test].invoke | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"Gemfile": "05686b4d222246ee37fcb5514d3166e2", | ||
"README.md": "6fa4fcba8403306746649807540a0130", | ||
"Rakefile": "4be9ada03614912ceae1d51027a9faec", | ||
"examples/complete_create.pp": "1c8ecab61ff14468bacb1f12745adb30", | ||
"examples/connection.pp": "f892ca40beaec8b01bc7251cb12d8372", | ||
"examples/hostconfig.pp": "b2d298545b12ac68de76d6734cd85635", | ||
"examples/init.pp": "666a7b7a7486f1d71981a8a0decb72b7", | ||
"examples/volume.pp": "5a9f3745218b126d1fbb451c1fc64187", | ||
"lib/augeas/lenses/puppet_device.aug": "191267b73531554d146c9c196b30b702", | ||
"lib/puppet/cacheservice.rb": "1a78e91c1c62f00aa8bf8ddc0f52d1a1", | ||
"lib/puppet/provider/connection/connection.rb": "48ae7b8c93c0ebcad7733d31d8a4c2a1", | ||
"lib/puppet/provider/hostconfig/hostconfig.rb": "9883a6c52b28790a0649f65d113cbe52", | ||
"lib/puppet/provider/pure.rb": "fbe8984844ef41ad63ff18b65ed16d77", | ||
"lib/puppet/provider/volume/volume.rb": "b440714049c83ac6d65809baad24ac4c", | ||
"lib/puppet/purestorage_api.rb": "19b58dcc50d6da1688371f7190230970", | ||
"lib/puppet/type/connection.rb": "2bfae550902a8e5270787f0d74f1f7a6", | ||
"lib/puppet/type/hostconfig.rb": "91d5830b03f27b2f668764a92bed5297", | ||
"lib/puppet/type/volume.rb": "2afcce9a25baf20f3564f912191ac6e8", | ||
"lib/puppet/util/network_device/pure/device.rb": "c86300ab8e60a23b36f9366bc78c3f30", | ||
"lib/puppet/util/network_device/pure/facts.rb": "70ce046598f5c98dccee3b8035bfcd2a", | ||
"lib/puppet/util/network_device/pure.rb": "a809390ab73d128cbb76249482c771f7", | ||
"manifests/device.pp": "ad19044e48504a749152944dace74c90", | ||
"manifests/init.pp": "fc23be1365eeac5a747ac97b0c014b5c", | ||
"metadata.json": "82767efd58f926799e262095d2318330", | ||
"spec/classes/init_spec.rb": "c2dd3a700793ef534b0a5543931f19d3", | ||
"spec/spec_helper.rb": "74085ad4d8ee01166015b10a843ee959" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#Example of Puppet Device | ||
node 'cloud-dev-405-a12-02.puretec.purestorage.com' { #--> This is Device name | ||
volume{ "pure_storage_volume": | ||
#ensure either "present" or "absent" | ||
ensure => "present", | ||
volume_name => "test_device_volume", | ||
volume_size => "2.0G", | ||
} | ||
hostconfig{ "pure_storage_host": | ||
ensure => "present", | ||
host_name => "test-device-host", | ||
host_iqnlist => ["iqn.1994-04.jp.co.pure:rsd.d9s.t.10103.0e03f","iqn.1994-04.jp.co.pure:rsd.d9s.t.10103.0e03g"], | ||
} | ||
connection{ "pure_storage_connection": | ||
ensure => "present", | ||
host_name => "test-device-host", | ||
volume_name => "test_device_volume", | ||
#Added dependency on volume and host resource types | ||
#to be present, other wise connection will fail. | ||
require => [Volume['pure_storage_volume'], | ||
Hostconfig['pure_storage_host'] | ||
], | ||
} | ||
|
||
} | ||
#Example of Puppet Agent | ||
node 'calsoft-puppet-agent.puretec.purestorage.com'{ #--> This is Agent vm name | ||
#Note : device_url is MANDATORY here. | ||
$device_url = 'https://pureuser:[email protected]' | ||
|
||
volume{ "pure_storage_volume": | ||
#ensure either "present" or "absent" | ||
ensure => "present", | ||
volume_name => "test_agent_volume", | ||
volume_size => "1.0G", | ||
device_url => $device_url, | ||
} | ||
hostconfig{ "pure_storage_host": | ||
ensure => "present", | ||
host_name => "test-agent-host", | ||
host_iqnlist => ["iqn.1994-04.jp.co.pure:rsd.d9s.t.10103.0e03h","iqn.1994-04.jp.co.pure:rsd.d9s.t.10103.0e0i"], | ||
device_url => $device_url, | ||
} | ||
connection{ "pure_storage_connection": | ||
ensure => "present", | ||
host_name => "test-agent-host", | ||
volume_name => "test_agent_volume", | ||
#Added dependency on volume and host resource types | ||
#to be present, other wise connection will fail. | ||
require => [Volume['pure_storage_volume'], | ||
Hostconfig['pure_storage_host'] | ||
], | ||
device_url => $device_url, | ||
} | ||
} | ||
#Example of Puppet Apply | ||
node 'puppet.puretec.purestorage.com'{ #--> This is master vm name | ||
#Note: device_url is MANDATORY here. | ||
$device_url = 'https://pureuser:[email protected]' | ||
|
||
volume{ "pure_storage_volume": | ||
#ensure either "present" or "absent" | ||
ensure => "present", | ||
volume_name => "test_apply_volume", | ||
volume_size => "1.0G", | ||
device_url => $device_url, | ||
} | ||
hostconfig{ "pure_storage_host": | ||
ensure => "present", | ||
host_name => "test-apply-host", | ||
host_iqnlist => ["iqn.1994-04.jp.co.pure:rsd.d9s.t.10103.0e03j","iqn.1994-04.jp.co.pure:rsd.d9s.t.10103.0e03k"], | ||
device_url => $device_url, | ||
} | ||
connection{ "pure_storage_connection": | ||
ensure => "present", | ||
host_name => "test-apply-host", | ||
volume_name => "test_apply_volume", | ||
#Added dependency on volume and host resource types | ||
#to be present, other wise connection will fail. | ||
require => [Volume['pure_storage_volume'], | ||
Hostconfig['pure_storage_host'] | ||
], | ||
device_url => $device_url, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
node 'cloud-dev-405-a12-02.puretec.purestorage.com' { | ||
|
||
connection{ "pure_storage_connection": | ||
ensure => "absent", | ||
host_name => "test-host", | ||
volume_name => "test_02", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
node 'cloud-dev-405-a12-02.puretec.purestorage.com' { | ||
|
||
hostconfig{ "pure_storage_host": | ||
ensure => "absent", | ||
host_name => "test-host", | ||
host_iqnlist => "iqn.1994-04.jp.co.hitachi:rsd.d9s.t.10103.0e02a", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# The baseline for module testing used by Puppet Labs is that each manifest | ||
# should have a corresponding test manifest that declares that class or defined | ||
# type. | ||
# | ||
# Tests are then run by using puppet apply --noop (to check for compilation | ||
# errors and view a log of events) or by fully applying the test in a virtual | ||
# environment (to compare the resulting system state to the desired state). | ||
# | ||
# Learn more about module testing here: | ||
# https://docs.puppet.com/guides/tests_smoke.html | ||
# | ||
include ::pure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
node 'cloud-dev-405-a12-02.puretec.purestorage.com' { | ||
|
||
volume{ "pure_storage_volume": | ||
ensure => "absent", | ||
volume_name => "test_02", | ||
volume_size => "1.0G", | ||
} | ||
} |
Oops, something went wrong.