You could write your own recipe in your own custom “my-base” cookbook.
In your “my-base” cookbook’s default recipe, you can write:
In your “my-base” cookbook’s metadata, be sure to write:
That last line in the metadata doesn’t actually add “recipe[apt]” to the
run-list. It just makes sure that the apt cookbook gets downloaded to the
chef-client, so that it can be run by your recipe, if you want to run it.
Then you can remove “recipe[apt]” from your base role’s run-list. Instead,
you can add “recipe[my-base]”, which includes the apt recipe only on ubuntu.
On Sat, May 12, 2012 at 5:31 PM, Cooper Simmons email@example.com:
I would like to bootstrap a server with a base role and not care if it’s
rhel/centos or ubuntu/debian.
I’m experimenting and using a base role to run the cookbooks users, sudo,
But ubuntu also needs the apt cookbook to run ‘apt-get update’ first. My
bootstrap for rhel/centos is failing because it can’t run the apt cookbook.
Is there something in the yum & apt cookbooks (or any cookbook for that
matter) that essentially says “only run this if you’re platform X, else
skip this cookbook”?
I’m fairly new and it seems like there should be a simple way to solve