Can we write a chef cookbook to enable epel repository on centos

I have configured 3 centos servers for chefworkstation, chefserver and chefclient. Now I want to install nginx using the cookbook. For that I have below script. package ‘nginx’ do action :install end This did not work because there were not enabled epel-release. Is there a way to enable epel repository before running above script? Answer … Read more

Chef certification check fail “cookbook upload” despite success “knife ssl check”

I had placed crt key from “Distributor”, and then checked and successed. But “knife cookbook upload” failed. Chef Server Hostname : “Distributor” Cent OS 7 chef-server-core-12.4.1-1.el7.x86_64 Workstation(kitchen) Hostname : “Workstation” Cent OS 7 chefdk-0.11.2-1.el7.x86_64.rpm Why certification failed, and what is workaround? [account@Workstation chef-repo]$ knife ssl check Connecting to host Distributor:443 Successfully verified certificates from `Distributor’ … Read more

knife cookbook site downland with all dependencies

I’m just starting out with chef, and I’m following http://gettingstartedwithchef.com. One thing it suggests is using knife cookbook site download $COOKBOOK_NAME to get community cookbooks. However sometimes they come with dependencies, and I then have to wait untill Vagrant tells me there’s a problem and then manually download and install the packages one by one. … Read more

How to allow HTTP traffic using chef cookbook?

Previously, I have installed nginx using chef cookbook. Then I did research about firewall rules. For allowing HTTP traffic I have below script. firewall_rule ‘http’ do port 80 protocol :tcp position 1 command :allow end But I am getting error NoMethodError: undefined method `firewall_rule’ for cookbook: firewall, recipe: default :Chef::Recipe How can I resolve this? … Read more

Chef – not able to install sysstat

I am having trouble installing sysstat using a chef (v0.9.8) recipe. Any help or pointers would be greatly appreciated! I have included my chef recipe towards the end. After running this recipe, I am unable to execute /etc/init.d/sysstat start I get an error something like this: * Starting the system activity data collector sadc Usage: … Read more

How can I serialize postgresql.conf multiple times during a Chef run when using cookbook postgresql?

I am creating a Chef recipe that does a couple of things, amongst others a big import of data into a Postgresql database. I am using the Supermarket ‘postgresql’ cookbook which allows me to create a config file via node[‘postgresql’][‘config’] attributes. I would like to update the config in postgresql.conf during my recipe run, namely … Read more