Skip to main content

Skill assembly

A skill assembly defines a set of skills that are installed or removed from a set of nodes.

Create a skill assembly

To create a skill assembly, follow these steps:

  1. Create a JSON file that defines the skills you want to add to a skill assembly:

    {
      "name": "<SKILL_ASSEMBLY_NAME>",
      "skills": [
        {
          "action": "add",
          "skill": {
            "channel": "stable",
            "name": "<SKILL_NAME>",
            "value": ["<SKILL_VERSION>"]
          }
        },
        {
          "action": "add",
          "skill": {
            "channel": "stable",
            "name": "<SKILL_NAME>",
            "value": ["<SKILL_VERSION>"]
          }
        }
      ]
    }
    

    Replace:

    • <SKILL_ASSEMBLY_NAME> with a name for the skill assembly.
    • <SKILL_NAME> with the name of the skill you are installing.
    • <SKILL_VERSION> with the version of the skill you are installing. See the release notes for details for the skill version supported by the version of Chef 360 Platform that you’re running.
  2. Create the skill assembly:

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

    The response is similar to the following:

    {
    "item": {
        "skillAssemblyId": "e2e66c8a-79ff-4bdc-a4cd-739c3f02f9e9"
      }
    }
    

    Save the skill assembly ID, you’ll use it to create a node cohort.

Example

This example defines a skill assembly for several required skills in Chef 360 Platform.

  1. Create a file named skill-assembly.json and paste in the following skill assembly definition:

    {
      "name": "my-skill-assembly",
      "skills": [
        {
          "action": "add",
          "skill": {
            "name": "courier-runner",
            "channel": "stable",
            "value": [
              "1.4.4"
            ]
          }
        },
        {
          "action": "add",
          "skill": {
            "channel": "stable",
            "name": "chef-gohai",
            "value": [
              "1.0.3"
            ]
          }
        },
        {
          "action": "add",
          "skill": {
            "name": "shell-interpreter",
            "channel": "stable",
            "value": [
              "1.0.3"
            ]
          }
        },
        {
          "action": "add",
          "skill": {
            "name": "inspec-interpreter",
            "channel": "stable",
            "value": [
              "1.0.4"
            ]
          }
        },
        {
          "action": "add",
          "skill": {
            "name": "restart-interpreter",
            "channel": "stable",
            "value": [
              "1.0.2"
            ]
          }
        },
        {
          "action": "add",
          "skill": {
            "name": "chef-client-interpreter",
            "channel": "stable",
            "value": [
              "1.0.4"
            ]
          }
        }
      ]
    }

    Replace each skill’s version number with the version supported by the version of Chef 360 Platform that you’re running. See the release notes for details.

  2. Create the skill assembly:

    chef-node-management-cli management assembly create-assembly --body-file skill-assembly.json --profile <NODE_MANAGER_PROFILE_NAME>
    

    The response is similar to the following:

    {
    "item": {
        "skillAssemblyId": "e2e66c8a-79ff-4bdc-a4cd-739c3f02f9e9"
      }
    }
    

    Save the value of skillAssemblyId, you will use it to create a node cohort.

Update a skill assembly

You can add or remove skills from nodes by updating an existing skill assembly.

Add skills

  1. Use the add action to add a skill:

    {
      "name": "<SKILL_ASSEMBLY_NAME>",
      "skills": [
        {
          "action": "add",
          "skill": {
            "channel": "stable",
            "name": "<SKILL_NAME>",
            "value": ["<DESIRED_VERSION>"]
          }
        }
      ]
    }
    

    Replace:

    • <SKILL_ASSEMBLY_NAME> with the skill assembly name
    • <SKILL_NAME> with the name of the skill, for example shell-interpreter
    • <DESIRED_VERSION> with the version you want to install
  2. Use the assembly update-assembly subcommand to update the skill assembly:

    chef-node-management-cli management assembly update-assembly --skillAssemblyId <SKILL_ASSEMBLY_ID> --body-file <PATH_TO_JSON_FILE> --profile <NODE_MANAGER_PROFILE_NAME>
    

Remove skills

Use the remove action to define skills that are removed. You can use logical operators to remove a range of skills:

  1. Use an operator like <, >, or = to remove a skill version or a range of versions:

    {
      "name": "<SKILL_ASSEMBLY_NAME>",
      "skills": [
        {
          "action": "remove",
          "skill": {
            "channel": "stable",
            "name": "<SKILL_NAME>",
            "value": ["<OPERATOR> <VERSION>"]
          }
        }
      ]
    }
    

    Replace:

    • <SKILL_ASSEMBLY_NAME> with the skill assembly name
    • <SKILL_NAME> with the name of the skill, for example shell-interpreter
    • <OPERATOR> with a logical operator, for example <, >, or =
    • <VERSION> with the version or versions you want to remove
  2. Use the assembly update-assembly subcommand to update the skill assembly:

    chef-node-management-cli management assembly update-assembly --skillAssemblyId <SKILL_ASSEMBLY_ID> --body-file <PATH_TO_JSON_FILE> --profile <NODE_MANAGER_PROFILE_NAME>
    

Example

In this skill assembly example, all Restart Interpreter skills less than version 0.1.2 are removed, Shell Interpreter version 0.1.5 is removed, and the Courier Runner and Chef Gohai skills are added.

{
  "name": "skill-assembly-name",
  "skills": [
    {
      "action": "remove",
      "skill": {
        "channel": "stable",
        "name": "shell-interpreter",
        "value": ["= 0.1.5"]
      }
    },
    {
      "action": "remove",
      "skill": {
        "channel": "stable",
        "name": "restart-interpreter",
        "value": ["< 0.1.2"]
      }
    },
    {
      "action": "add",
      "skill": {
        "channel": "stable",
        "name": "courier-runner",
        "value": ["1.3.1"]
      }
    },
    {
      "action": "add",
      "skill": {
        "channel": "stable",
        "name": "chef-gohai",
        "value": ["0.3.1"]
      }
    }
  ]
}

Troubleshooting

Run the following command to verify that the skill assembly was created or updated:

chef-node-management-cli management assembly find-one-assembly --skillAssemblyId <SKILL_ASSEMBLY_ID> --profile <NODE_MANAGER_PROFILE_NAME>

Thank you for your feedback!

×