Skip to content

benjaminws/knife_role_copy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

ROLE COPY

Get data from one role, setup a new role with that data and a new name.

This plugin will actively refuse to create a role with a name that already exists.

INSTALL

$ git clone git@github.com:benjaminws/knife_role_copy.git
$ mkdir -p ~/.chef/plugins/knife/
$ cp knife_role_copy/role_copy.rb ~/.chef/plugins/knife/

USAGE

Help output

$ knife role copy
USAGE: knife role copy ROLE NEW_ROLE (options)

EXAMPLE

Take a look at this role.

$ knife role show -Fj test_role
{
  "name": "test_role",
  "default_attributes": {
    "your": "mom"
  },
  "json_class": "Chef::Role",
  "env_run_lists": {
  },
  "run_list": [
    "recipe[fun_recipe]"
  ],
  "description": "THIS IS A TEST ROLE, LOL",
  "chef_type": "role",
  "override_attributes": {
  }
}

Now copy it.

$ knife role copy test_role test_role_copy
# DROPS YOU INTO $EDITOR
# EDIT TO YOUR HEARTS CONTENT

Magic happens.

$ knife role show -Fj test_role_copy
{
  "name": "test_role_copy",
  "default_attributes": {
    "your": "mom"
  },
  "json_class": "Chef::Role",
  "env_run_lists": {
  },
  "run_list": [
    "recipe[fun_recipe]"
  ],
  "description": "THIS IS A TEST ROLE, LOL (Copy from test_role)",
  "chef_type": "role",
  "override_attributes": {
  }
}

NOTE

LOLJK

About

Knife plugin to copy a role into a new one

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages