Define skills
Define the following skills on Chef 360 Platform and then install them on each node:
- Courier Runner: Interprets the Courier Job definitions sent to it by the Courier Dispatcher and executes them on the node.
- Gohai: Collects attributes about a node and attributes collected by the Node Management Agent.
- Shell Interpreter: Executes OS commands through a Courier Job.
- Restart Interpreter: Reboots nodes and continues with subsequent steps through a Courier Job.
- Infra Client Interpreter: Executes Infra Client actions through a Courier Job.
To manage any skill through Node Management, add the skill’s definition to the Node Management skill definitions. A definition includes the skill’s name, Habitat package (canister) information, whether it will run as a Habitat service, and any configuration file templates needed to configure the skill on a node.
To define Courier Runner as a service skill in Chef 360:
Create a JSON file containing the skill definition for Courier Runner:
{ "name": "courier-runner", "canister": { "name": "courier-runner", "origin": "chef-platform", "service": true }, "configurationTemplates": [ { "content": "W2xvZ10KZGlyID0gInt7LnNldHRpbmdzLmxvZ19kaXJ9fSIKZm9ybWF0ID0gInt7LnNldHRpbmdzLmxvZ19mb3JtYXR9fSIKbGV2ZWwgPSAie3suc2V0dGluZ3MubG9nX2xldmVsfX0iCm91dHB1dCA9ICJ7ey5zZXR0aW5ncy5sb2dfb3V0cHV0fX0iCgpbbm9kZV0Kbm9kZV9pZCA9ICJ7ey5hZ2VudC5ub2RlSWR9fSIKCnt7aWYgaW5kZXggLnNldHRpbmdzICJzaGVsbF9pbnRlcnByZXRlciJ9fQpbW2ludGVycHJldGVyc11dCm5hbWUgPSAie3suc2V0dGluZ3Muc2hlbGxfaW50ZXJwcmV0ZXJ9fSIKe3tlbmR9fQp7e2lmIGluZGV4IC5zZXR0aW5ncyAicmVzdGFydF9pbnRlcnByZXRlciJ9fQpbW2ludGVycHJldGVyc11dCm5hbWUgPSAie3suc2V0dGluZ3MucmVzdGFydF9pbnRlcnByZXRlcn19Igp7e2VuZH19Cnt7aWYgaW5kZXggLnNldHRpbmdzICJpbnNwZWNfaW50ZXJwcmV0ZXIifX0KW1tpbnRlcnByZXRlcnNdXQpuYW1lID0gInt7LnNldHRpbmdzLmluc3BlY19pbnRlcnByZXRlcn19Igp7e2VuZH19Cnt7aWYgaW5kZXggLnNldHRpbmdzICJjaGVmX2NsaWVudF9pbnRlcnByZXRlciJ9fQpbW2ludGVycHJldGVyc11dCm5hbWUgPSAie3suc2V0dGluZ3MuY2hlZl9jbGllbnRfaW50ZXJwcmV0ZXJ9fSIKe3tlbmR9fQoKW3JlcG9ydGVyXQpuYW1lID0gInt7LnNldHRpbmdzLnJlcG9ydGVyX25hbWV9fSIKYXV0aGVudGljYXRpb25UeXBlID0gICJ7ey5zZXR0aW5ncy5yZXBvcnRlcl9hdXRoZW50aWNhdGlvbl90eXBlfX0iCmRpciA9ICJ7ey5zZXR0aW5ncy5yZXBvcnRlcl9kaXJ9fSIKaW50ZXJuYWxJblNlYyA9IHt7LnNldHRpbmdzLnJlcG9ydGVyX2ludGVydmFsX2luX3NlY319CnJldHJ5SW50ZXJ2YWxJblNlYyA9IHt7LnNldHRpbmdzLnJlcG9ydGVyX3JldHJ5X2ludGVydmFsX2luX3NlY319CnRvdGFsUmV0cnlEdXJhdGlvbkluTWluID0ge3suc2V0dGluZ3MucmVwb3J0ZXJfdG90YWxfcmV0cnlfZHVyYXRpb25faW5fbWlufX0KCltnYXRld2F5X2NvbmZpZ10KdGVuYW50ZnFkbnMgPSAie3suYWdlbnQudGVuYW50RnFkbnN9fSIKbm9kZV9yb2xlX2xpbmtfaWQgPSAie3suc2tpbGwubm9kZVJvbGVMaW5rSWR9fSIKcGxhdGZvcm1fY3JlZGVudGlhbF9wYXRoID0gInt7LnNraWxsLnBsYXRmb3JtQ3JlZGVudGlhbHNQYXRofX0iCnJvb3RfY2FfcGF0aCA9ICJ7ey5hZ2VudC5yb290Q2FQYXRofX0iCmluc2VjdXJlID0gInt7LmFnZW50Lmluc2VjdXJlfX0iCgpbcXVldWVdCnByb3ZpZGVyID0gMA==", "fileName": "user.toml", "filePath": "/hab/user/courier-runner/config", "name": "courier-runner-template", "windowsFilePath": "c:\\hab\\user\\courier-runner\\config" } ] }
Note
To register the skill as a service, set theservice
attribute totrue
.Note
If the skill is registered as a service, then thename
andcanister.name
fields must be identical.Create the skill:
chef-node-management-cli management skill create-skill --body-file <PATH_TO_JSON_FILE>
Skill definition content
The value of the content
key in the above payload is the base64-encoded value of the TOML file that defines settings for Courier Runner.
This TOML defines settings for the skill and uses handlebars syntax to insert values for each setting.
The Node Management agent on the node inserts values for each setting from the skill’s global default settings or override settings for that skill.
Some skills (like the Shell Interpreter and Courier Runner skills) don’t require override settings to function, so you don’t have to create a TOML file that defines settings for those skills or other Chef-owned skills. You can use the base64-encoded value provided above in your payload because the required settings are predefined for Chef-owned skills.
The following TOML defines settings for the Courier Runner skill:
[log]
dir = "{{.settings.log_dir}}"
format = "{{.settings.log_format}}"
level = "{{.settings.log_level}}"
output = "{{.settings.log_output}}"
[node]
node_id = "{{.agent.nodeId}}"
{{if index .settings "shell_interpreter"}}
[[interpreters]]
name = "{{.settings.shell_interpreter}}"
{{end}}
{{if index .settings "restart_interpreter"}}
[[interpreters]]
name = "{{.settings.restart_interpreter}}"
{{end}}
{{if index .settings "inspec_interpreter"}}
[[interpreters]]
name = "{{.settings.inspec_interpreter}}"
{{end}}
{{if index .settings "chef_client_interpreter"}}
[[interpreters]]
name = "{{.settings.chef_client_interpreter}}"
{{end}}
[reporter]
name = "{{.settings.reporter_name}}"
authenticationType = "{{.settings.reporter_authentication_type}}"
dir = "{{.settings.reporter_dir}}"
internalInSec = {{.settings.reporter_interval_in_sec}}
retryIntervalInSec = {{.settings.reporter_retry_interval_in_sec}}
totalRetryDurationInMin = {{.settings.reporter_total_retry_duration_in_min}}
[gateway_config]
tenantfqdns = "{{.agent.tenantFqdns}}"
node_role_link_id = "{{.skill.nodeRoleLinkId}}"
platform_credential_path = "{{.skill.platformCredentialsPath}}"
root_ca_path = "{{.agent.rootCaPath}}"
insecure = "{{.agent.insecure}}"
[queue]
provider = 0