How do I configure Artifactory with Chef repositories?

Prequisites:
1. Install Chef Development Kit (ChefDK)
2. It is important to know that Knife command line tool does not support basic authentication and only supports authentication with RSA keys. In case your Artifactory requires authentication, you will need to install the knife-art.gem plugin. For installation instructions, please refer to the Artifactory User Guide). 

Steps to configure "Knife" Chef client to work with Artifactory:
1. First we will create Chef repositories using the Quick Setup. This will create a virtual repository (chef) that aggregates a remote (chef-remote) and a local (chef-local) repositories.
2. Edit the 'knife.rb' (located in $USER_HOME/.chef/). If the file does not exist, please create it. The following is the file configuration:

  • $ vim knife.rb
  • User-added image
  • In this example, Artifactory requires authentication. We added basic authentication configuration to the URL. In order to perform this you will need to install the knife-art plugin mentioned in the prerequisites above.To check whether the plugin was installed successfully you can use the command "knife artifactory". For example:
  •  User-added image

4. After installing and configure the client with Artifactory we will resolve a package from the default Chef registry:
User-added image
User-added image

The package seven_zip is successfully installed. 

Steps to deploy your own cookbook to Artifactory:

1. For example purposes, we generated a new cookbook in our cookbooks location:
User-added image

2. After creating the cookbook, it is now ready for deployment to Artifactory. In order to deploy to Artifactory, we will use the following command:
User-added image

3. We can see that the package reached to Artifactory successfully
User-added image