Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vinyar/bd84d08f370fca112163 to your computer and use it in GitHub Desktop.
Save vinyar/bd84d08f370fca112163 to your computer and use it in GitHub Desktop.
### Method 1 ###
$ knife role from file roles/windows_web.rb \
--key .chef-test_user/test_user.pem \
--user test_user
Benefits:
* Uses standard knife subcomands
* Out of the box
Caveats:
* Requires the users private keys on the jenkins machine.
* Requires user to exist on the server
### Method 2 ###
# Requires key from the Chef server: /etc/opscode/webui_priv.pem
$ knife raw \
--method DELETE /organizations/eu_org/roles/linux_base \
--key .chef/webui_priv.pem \
--user test_user \
--proxy-auth \
--server-url https://ap-local-chef-server-12.opschef.tv
Benefits:
* Out of the box
* Uses only the webui private key
Caveats:
* --proxy-auth available from knife 12.1.0+
* Uses the raw subcomand for POST, PUT and DELETE API calls
* Requires user to exist on the server
### Method 3 ###
# Requires key from the Chef server: /etc/opscode/webui_priv.pem
$ knife role from file roles/linux_base.rb \
--key .chef/webui_priv.pem \
--user test_user
Benefits:
* Uses standard knife subcomands
* Uses only the webui private key
Caveats:
* Requires user to exist on the server
* Not out of the box at the moment, requires patching basic_client.rb, diff here:
https://gist.github.com/alexpop/227bd98afa21beb36256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment