Skip to content

shortdudey123/blender-salt

Repository files navigation

Blender::Salt

Build Status Gem Version Coverage Status Code Climate Dependency Status

Provides Salt command execution for Blender

Installation

Add this line to your application's Gemfile:

gem 'blender-salt'

And then execute:

$ bundle

Or install it yourself as:

$ gem install blender-salt

Usage

Config

Blender-salt uses the salt-api interface to remotely execute salt commands. This requires that salt-api be installed and running on the salt master.

  • host (salt master)
  • port (port that salt-api is listening on)
  • username (PAM user that can execute salt commands)
  • password (password for specified user)
  • ssl (connect to the salt-api via ssl)

Example

config(:salt, host: 'localhost', port: 12345, username: 'foo', password: 'bar')

Using Salt for command execution

require 'blender/salt'
extend Blender::SaltDSL
config(:salt, host: 'localhost', port: 12345, username: 'foo', password: 'bar')
members(['node1', 'node2', 'node3'])
salt_task 'test.ping'
require 'blender/salt'
extend Blender::SaltDSL
config(:salt, host: 'localhost', port: 12345, username: 'foo', password: 'bar')

salt_task 'system.shutdown' do
  arguments 5
  members ['node1', 'node2', 'node3']
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/shortdudey123/blender-salt.

License

The gem is available as open source under the terms of the Apache 2 License.