Overview
This article provides instructions for deploying the JetPatch Connector using the Chef automation tool.
The process involves preparing deployment scripts, creating a Chef cookbook, and executing the installation across remote machines.
Deploying the Connector on the Endpoint Itself
Prepare The Script
There are 2 ways to download the connector to an endpoint:
Method 1: Download from the Internet
- Download the connector from the internet using the scripts below:
- For CentOS, RHEL, Ubuntu, OracleLinux, SUSE, AmazonLinux (Chef-DeployJetPatchConnectorFromInternetOnLinux.sh)
Method 2: Download from Mounted Disk
Create the Cookbook
From your workstation, move to your chef-repo/cookbooks directory:
| cd chef-repo/cookbooks |
Create the cookbook. In this instance, the cookbook is titled jetpatch_connector:
| chef generate cookbook jetpatch_connector |
Move to your cookbook's recipes newly-created directory:
| cd jetpatch_connector/recipes |
Open the default.rb file and add the following code:
|
cookbook_file "/tmp/Chef-DeployJetPatchConnectorFromInternetOnLinux.sh" do source "Chef-DeployJetPatchConnectorFromInternetOnLinux.sh" mode 0755 end
execute "install JetPatch Connector" do command "sh /tmp/Chef-DeployJetPatchConnectorFromInternetOnLinux.sh" end |
Upload the script you have prepared (In this example, we will be using Chef-DeployJetPatchConnectorFromInternetOnLinux.sh) to the directory chef-repo/cookbooks/jetpatch-connector/files/default
| Important: If /files/default doesn't exist in the directory, jetpatch_connector creates it. |
|
mkdir -p ~/chef-repo/cookbooks/jetpatch_connector/files/default/ cd ~/chef-repo/cookbooks/jetpatch_connector/files/default/ |
Once uploaded, change the permission of the script:
| chmod +x Chef-DeployJetPatchConnectorFromInternetOnLinux.sh |
Test the recipe and add the jetpatch_connector cookbook to the Chef server:
| knife cookbook upload jetpatch_connector |
Verify that the recipe has been added to the Chef server:
| knife cookbook list |
You should see a similar output:
|
Uploading jetpatch_connector [0.1.0] Uploaded 1 cookbook |
Run The Script On Remote Machines
Add the recipe to your chosen node's run list, replacing nodename with your node's name:
| knife node run_list add nodename "recipe[jetpatch_connector]" |
|
Important: The example requires a user account with sudo privileges. Readers who use a limited user account will need to prefix commands with sudo when issuing commands to the Chef client node and replace -x root with -x username where username is your limited user account. |
From your workstation, apply the configurations defined in the cookbook by running the chef-client on your node.
Replace nodename with the name of your node:
| knife ssh 'name:nodename' 'sudo chef-client' -x root |
Your output should display a successful Chef run. If not, review your code for any errors, usually defined in the output of the chef-client run.
Comments
0 comments
Article is closed for comments.