Cookbook Recipe : 9

 

Example9: Installing RPM file on Node-1.

[root@chef-workstation cookbooks]# chef generate cookbook chefws
Generating cookbook chefws
- Ensuring correct cookbook content
- Committing cookbook files to git

Your cookbook is ready. Type `cd chefws` to enter it.

There are several commands you can run to get started locally developing and testing your cookbook.

Why not start by writing an InSpec test? Tests for the default recipe are stored at:

test/integration/default/default_test.rb

If you'd prefer to dive right in, the default recipe can be found at:

recipes/default.rb


[root@chef-workstation cookbooks]# cd chefws/recipes
[root@chef-workstation recipes]# vi default.rb
[root@chef-workstation recipes]#
[root@chef-workstation recipes]# cat default.rb
#
# Cookbook:: chefws
# Recipe:: default
#
# Copyright:: 2022, The Authors, All Rights Reserved.

package "/sai/chef-workstation-22.4.861-1.el7.x86_64.rpm" do
action :install
end
[root@chef-workstation recipes]#
[root@chef-workstation recipes]# knife node run_list add Node-1 "recipe[chefws]"
Node-1:
  run_list:
    recipe[chefws]
[root@chef-workstation recipes]# 
[root@chef-workstation recipes]# knife node show Node-1
Node Name:   Node-1
Environment: _default
FQDN:        node1
IP:          192.168.2.133
Run List:    recipe[chefws]
Roles:
Recipes:     httpd, httpd::default
Platform:    centos 7.9.2009
Tags:
[root@chef-workstation recipes]#
[root@chef-workstation recipes]# knife cookbook upload chefws
Uploading chefws         [0.1.0]
Uploaded 1 cookbook.
[root@chef-workstation recipes]# 


Node1: 





----------------------------End of Example9---------------------------------------

Cookbook Recipe : 10

Comments

Popular posts from this blog

To change the data directory location for PostgreSQL after installation

AWR

GIT