A Chef resource cookbook for interacting with Snipe-IT's REST API
Перейти к файлу
Eammon Hanlon d9466c8d22
Merge pull request #6 from microsoft/users/GitHubPolicyService/05d3b14c-80bc-46b2-8c1e-89e5f1408b55
Adding Microsoft SECURITY.MD
2023-06-05 09:58:30 -07:00
attributes Set the default of ['api']['token'] to `nil` 2018-10-24 14:34:55 -07:00
libraries Change `snipeit_url` to `join_url` 2018-11-26 12:09:47 -08:00
pipelines/templates Add steps to install the webmock and chef-vault-testfixtures gems during the build 2018-10-25 15:08:01 -07:00
resources Remove redundant converge_by blocks in asset resource 2018-11-24 21:59:40 -08:00
spec Add an actual delete of an asset from the test instance of Snipe-IT 2018-11-26 08:13:54 -08:00
test Add an actual delete of an asset from the test instance of Snipe-IT 2018-11-26 08:13:54 -08:00
.gitignore Update .gitignore to ignore .kitchen.local.yml or kitchen.local.yml 2018-11-23 21:03:13 -08:00
Berksfile Add test fixtures cookbook to the Berksfile 2018-10-12 12:06:29 -07:00
LICENSE Remove whitespace from LICENSE 2018-10-12 09:23:46 -07:00
README.md Update README with changes 2018-11-01 17:21:49 -07:00
SECURITY.md Microsoft mandatory file 2023-06-02 18:27:37 +00:00
azure-pipelines.yml CI master, feature/, and release/ branches 2018-11-26 08:20:27 -08:00
chefignore Add default chef_ignore 2018-10-12 09:36:06 -07:00
kitchen.yml Add an actual delete of an asset from the test instance of Snipe-IT 2018-11-26 08:13:54 -08:00
metadata.rb Bump cookbook version to 0.3.0 2018-11-26 08:18:08 -08:00

README.md

Snipe-IT API Cookbook

Build Status

Provides Chef Custom Resources for accessing the Snipe-IT REST API.

Requirements

Chef

  • Chef 14.0+

Cookbooks

  • chef-sugar
  • chef-vault

Environment

Tested with Snipe-IT v4.6.4 on Ubuntu 16.04.

Attributes

  • ['snipeit']['api']['instance'] - the URL for your Snipe-IT installation. Default is http://snipe-it.mycompany.com
  • ['snipeit']['api']['token'] - JSON Web Token used to authenticate with the API. See Generate an API Token. Default is nil.

Resources

General Properties

These properties are available in all resources:

  • :token, String, required: true
  • :url, String, required: true

asset

Actions

  • :create, default: true

Properties

  • :asset_tag, String, name_property: true
  • :location, String
  • :model, String, required: true
  • :purchase_date, String
  • :serial_number, String, required: true
  • :status, String, required: true
  • :supplier, String

category

Actions

  • :create, default: true

Properties

  • :category, String, name_property: true
  • :category_type, String, required: true

location

Actions

  • :create, default: true

Properties

  • :location, String, name_property: true
  • :address, String
  • :city, String
  • :state, String
  • :zip, String
  • :country, String, default: 'US'
  • :currency, String, default: 'USD'

manufacturer

Actions

  • :create, default: true

Properties

  • :manufacturer, String, name_property: true
  • :website, String

model

Actions

  • :create, default: true

Properties

  • :model, String, name_property: true
  • :model_number, String
  • :manufacturer, String
  • :category, String
  • :eol, Integer
  • :fieldset, String

Usage

This cookbook expects that you already have a Snipe-IT installation configured, and an API token generated. If you're looking for a cookbook that installs Snipe-IT, see the Snipe-IT Cookbook.

Generate an API Token

Please reference the Snipe-IT documentation for the API on how to generate a token.

You can pass the API key to your Chef run with:

  • the token property in the resource block
  • setting the ['snipeit']['api']['token'] node attribute
  • creating Chef Vault, or a data bag under snipe-it/api with the token value assigned to key.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.