I was using Vagrant, which automates the chef-client installation and well as provisioning.
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu2204"
config.vm.network "forwarded_port", guest: 80, host: 8085
config.vm.provision "chef_zero" do |chef|
chef.cookbooks_path = "../cookbooks"
chef.add_recipe "hello_web"
chef.nodes_path = "nodes"
chef.log_level = "debug"
chef.arguments = "--chef-license accept-silent"
end
end
This used an internal cookbook, but I will remove that and use the community cookbook for nginx. However, I am not sure how or where to specify this to get this all to work.
The automation with vagrant will create a dna.json with something like this:
{
"run_list": [
"recipe[hello_web]"
]
}
And a client.rb with this (substitution COOKBOOK_PATH and NODE_PATH for dynamically mounted directories):
cookbook_path ["$COOKBOOK_PATH"]
role_path []
log_level :debug
verbose_logging false
enable_reporting false
encrypted_data_bag_secret nil
data_bag_path []
chef_zero.enabled true
local_mode true
node_path ["$NODE_PATH"]
So I am fuzzy how to fetch nginx from the supermarket and use it here. Where would I put a Policyfile for this to be fetched out.
I can also use a chef_client and point it to a Chef Server, which I can install locally and reference it at chefserver01.local.
As I understand, the Policyfile is used on the server and fetched from there so that it is available locally with chef client, but if I had a minimal chef zero setup, how would I then use Policyfile in this setup, not sure.
Side note. For the above parts, I used this in my blog, and now I want to extend this to not use an internal cookbook, but use an external cookbook.