Skip to main content

Skill settings

You can manage a skill’s settings using global default settings or override settings.

When you create a skill definition, it has a base64-encoded string as the value of the content key. This base64-encoded string is encoded from a TOML string that 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 global default settings or override settings for that skill.

global default settings
Global default settings contain key-value pairs that a skill needs to function on a node. Global default settings apply to all nodes unless overridden by the override settings.
override settings
Override settings contain key-value pairs that a skill needs to function on a node. All nodes in a node cohort receive settings defined in the override settings assigned to that cohort. Override settings override global default settings.

Create override settings

To create an override setting, follow these steps:

  1. Create a JSON file that defines settings for each skill:

    {
      "name":"sample-node-setting",
      "skills":[
        {
          "skillName":"chef-gohai",
          "settings":[
            {
              "name":"log_level",
              "value":"debug"
            }
          ]
        },
        {
          "skillName":"courier-runner",
          "settings":[
            {
              "name":"credentials_api_key",
              "value":""
            },
            {
              "name":"credentials_api_secret",
              "value":""
            },
            {
              "name":"shell_interpreter",
              "value":"chef-platform/shell-interpreter"
            },
            {
              "name":"restart_interpreter",
              "value":"chef-platform/restart-interpreter"
            },
            {
              "name":"chef_client_interpreter",
              "value":"chef-platform/chef-client-interpreter"
            },
            {
              "name":"inspec_interpreter",
              "value":"chef-platform/inspec-interpreter"
            },
            {
              "name":"log_dir",
              "value":"/hab/svc/courier-runner/logs"
            },
            {
              "name":"log_format",
              "value":"json"
            },
            {
              "name":"log_level",
              "value":"debug"
            },
            {
              "name":"log_output",
              "value":"file"
            },
            {
              "name":"queue_provider",
              "value":"0"
            },
            {
              "name":"reporter_authentication_type",
              "value":"basic"
            },
            {
              "name":"reporter_dir",
              "value":"/hab/svc/courier-runner/data"
            },
            {
              "name":"reporter_host_url",
              "value":""
            },
            {
              "name":"reporter_interval_in_sec",
              "value":"3"
            },
            {
              "name":"reporter_name",
              "value":"server"
            },
            {
              "name":"reporter_retry_interval_in_sec",
              "value":"4"
            },
            {
              "name":"reporter_total_retry_duration_in_min",
              "value":"2"
            }
          ]
        }
      ]
    }
    

    This file defines settings for the Gohai and Courier Runner skills with Shell and Restart interpreters. If you have installed additional interpreters, you should define them in the Courier Runner Settings

  2. Create the override setting:

    chef-node-management-cli management setting create-setting --body-file <PATH_TO_JSON_FILE> --profile <NODE_MANAGER_PROFILE_NAME>
    

    The response is similar to the following:

    {
        "item": {
            "settingId": "31e1b6f2-3044-49f9-96b9-335672c140b7"
        }
    }
    

Update override settings

If you need to update your override settings, you should do so skill-by-skill. The steps in the example below could be used if you want to update the skill settings for the Courier Runner:

  1. Create a JSON file that contains the Courier Runner override settings and make the necessary changes.

    {
      "skillName":"courier-runner",
      "settings":[
        {
          "name":"credentials_api_key",
          "value":""
        },
        {
          "name":"credentials_api_secret",
          "value":""
        },
        {
          "name":"shell_interpreter",
          "value":"chef-platform/shell-interpreter"
        },
        {
          "name":"restart_interpreter",
          "value":"chef-platform/restart-interpreter"
        },
        {
          "name":"inspec_interpreter",
          "value":"chef-platform/inspec-interpreter"
        },
        {
          "name":"chef_client_interpreter",
          "value":"chef-platform/chef-client-interpreter"
        },
        {
          "name":"log_dir",
          "value":"/hab/svc/courier-runner/logs"
        },
        {
          "name":"log_format",
          "value":"json"
        },
        {
          "name":"log_level",
          "value":"debug"
        },
        {
          "name":"log_output",
          "value":"file"
        },
        {
          "name":"queue_provider",
          "value":"0"
        },
        {
          "name":"reporter_authentication_type",
          "value":"basic"
        },
        {
          "name":"reporter_dir",
          "value":"/hab/svc/courier-runner/data"
        },
        {
          "name":"reporter_host_url",
          "value":""
        },
        {
          "name":"reporter_interval_in_sec",
          "value":"5"
        },
        {
          "name":"reporter_name",
          "value":"server"
        },
        {
          "name":"reporter_retry_interval_in_sec",
          "value":"4"
        },
        {
          "name":"reporter_total_retry_duration_in_min",
          "value":"2"
        }
      ]
    }
    
  2. Update the node override setting for Courier Runner:

    chef-node-management-cli management setting update-skillSettings --skillName courier-runner --settingId <SETTING_ID> --body-file <JSON_FILE_PATH> --profile <NODE_MANAGER_PROFILE_NAME>
    

Troubleshooting

Run the below command to verify whether the setting was created successfully:

chef-node-management-cli management setting find-one-setting --settingId <SETTING_ID> --profile <NODE_MANAGER_PROFILE_NAME>

Update Node Management agent settings

The Node Management agent is a special skill that is installed first at the time of enrollment and is responsible for installing and managing other skills.

If you want to update the Node Management agent settings to be able to download skills from your on-prem deployment of Chef Habitat Builder, download Node Management agent from a specific channel, or update the check in interval, you can do that by updating your existing Node Management agent override settings.

  1. Create a JSON file that contains updated settings:

    {
      "settings":[
        {
          "name":"bldrUrl",
          "value":"https://bldr.habitat.sh"
        },
        {
          "name":"bldrAuthToken",
          "value":""
        },
        {
          "name":"bldrChannel",
          "value":"stable"
        },
        {
          "name":"nodeCheckinInterval",
          "value":"3600"
        },
        {
          "name":"updateSkillMetadataInterval",
          "value":"3600"
        },
        {
          "name":"logLevel",
          "value":"debug"
        }
      ],
      "skillName":"node-management-agent"
    }
    
  2. Update the node override setting for Node Management agent:

    chef-node-management-cli management setting update-skillSettings --skillName node-management-agent --settingId <SETTING_ID> --body-file <PATH_TO_JSON_FILE> --profile <NODE_MANAGER_PROFILE_NAME>
    

Thank you for your feedback!

×