I am currently trying to delete nodes through API once they will be
terminated (autoscaling instances in AWS).
client_name = ENV[‘HOSTNAME’]
rest = Chef::REST.new(Chef::Config[:chef_server_url],client_name)
node_name = 'x’
node_deleted = rest.get_rest("/nodes/" + node_name)
puts “deleted node: " + node_name
client_deleted = rest.get_rest(”/clients/" + node_name)
puts "deleted client: " + node_name
During invocation I get:
/opt/chef-server/embedded/lib/ruby/1.9.1/net/http.rb:2633:in `error!’: 403
I am using chef open source 11.8 and I understand that I can:
change in the web interface the client to admin=true?
add some permissions for the client so that he will be able to delete
nodes from /nodes endpoint?
is a manual action and I would like to automate this. For chef 11.8
actions such as chef-server-ctl user-edit (
https://docs.chef.io/ctl_chef_server.html) are not available. Is there an
automated way to change admin=false to admin=true for the node?
I did not manage to find any usable docs about this.
Are there any other solutions? Can anyone help with 1) or 2)?