Deploying Connector on the Endpoint Itself Overview
Prepare The Script
There are 2 ways to download the connector to an endpoint:
1. Download the connector from the internet using the scripts below:
- For CentOS, RHEL, Ubuntu, OracleLinux, SUSE, AmazonLinux (Chef-DeployJetPatchConnectorFromInternetOnLinux.sh)
Create the Cookbook
1. From your workstation, move to your chef-repo/cookbooks
directory:
cd chef-repo/cookbooks
2. Create the cookbook. In this instance, the cookbook is titled jetpatch_connector
:
chef generate cookbook jetpatch_connector
3. Move to your cookbook’s recipes newly-created directory:
cd jetpatch_connector/recipes
4. 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
5. 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
If /files/default
doesn't exist in the directory jetpatch_connector create it.
mkdir -p ~/chef-repo/cookbooks/jetpatch_connector/files/default/
cd ~/chef-repo/cookbooks/jetpatch_connector/files/default/
6. Once uploaded, change the permission of the script:
chmod +x Chef-DeployJetPatchConnectorFromInternetOnLinux.sh
7. Test the recipe and add the jetpatch_connector cookbook to the Chef server:
knife cookbook upload jetpatch_connector
8. 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
1. Ensure that your workstation’s /etc/hosts
file contains its own IP address, the Chef server’s IP address and fully qualified domain name, and the IP address and hostname for any nodes you will interact with from the workstation.
2. 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]"
3. From your workstation, apply the configurations defined in the cookbook by running the chef-client on your node.
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.
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.