Everybody just keep calm and carry on loving Chef =)
Bráulio!
I totally understand where you're coming from. It's as if a million
blog posts, tutorials, and Vagrant files suddenly cried out in horror.
You can't add a resource directly to a run_list, and that's annoying.
Meau Culpa.
I love that this conversation is happening. Let's riff on this a bit.
First, lets address resources vs cookbooks, then we can talk about
dynamically driven cookbooks via node attributes.
Here's the thing. Chef is supposed to be easy. People think it's hard.
Its usually people's experience consuming community cookbooks that
drives this perception. Simple cookbooks grow in scope and complexity
over time, as platform support grows, new platform versions come out,
and new versions of the technology under automation are released.
We're trying to get back to here: http://bit.ly/1mIOlyG
I don't think this is controversial. The trend towards publishing
cookbooks that ship new resources is a direct result of this. Creating
a resource has a lot of advantages over cookbooks.... First, it forces
the author to write down the interface (via parameters), defines a
scope, creates a closure around variables, and defines a domain of
predictability.
Regarding the lack or recipes in this cookbook:
The reason I chose not to ship any recipes is because that's the
simplest possible thing to do. (from the my perspective.) Breaking the
normal consumption pattern of "run list add" or include_recipe, drives
home the primitive-ness of this cookbook. This is a Chef module that
provides a new autonomous test-and-repair-bot, not a piece of
opinionated policy.
You know what you should totally do? Repair that consumption pattern.
Be the person who writes the popular cookbook that consumes this.
Publish it on the Supermarket.
Have your cookbook be the one appears in all the blog posts and
tutorials. Drive it with attributes. Call it "dynamic_httpd", or
something more clever.
Shipping the primitives gives you the freedom to do that.
-s
On Mon, Aug 25, 2014 at 1:22 PM, Jesse Nelson spheromak@gmail.com wrote:
Using a wrapper cookbook you wouldn't need to set attributes if you didn't
want to. For example If in my org I know the absolute authority for
configuring httpd is my cookbook then I have no need for attributes and can
declare exactly what I want in the recipe. In your attribute model you force
someone like me to use attributes when he doesn't want too. With just an
LWRP model you get the most flexibility with the least amount of assumptions
on implementation.
Turns out high levels of flexibility with low levels of baked in assumptions
is what most people want in a shared cookbook. If you want something that
works out of the box then wait for someone to come along and publish a more
apache2 like cookbook that used this httpd library cook.
WRT Simple I contest that this is the more simple thing:
https_service "mything" do
listen 80
run_user "awesemo"
end
VS
https_service node[:some_namespace][:http_service_name] do
listen node[:some_namespace][:http_port]
run_user node[:some_namespace][:http_user]
end
Which one of those is easier to operate ? If it's that you just want to set
attributes in an environment or role. Then I would give you the benefit and
say yea maybe the library cook isn't as easy as the non-library
'attribute-driven' cookbook. In this case I would also argue that the
management and operation of that model will far outweigh the time of
building a simple 'top level' cookbook to build your thing that is
declarative and easy to reason about.
Thanks Sean for all the work on this http cookbook I look forward to abusing
it soon.
On Mon, Aug 25, 2014 at 9:52 AM, Bráulio Bhavamitra brauliobo@gmail.com
wrote:
On Mon, Aug 25, 2014 at 1:15 PM, Sean OMeara someara@opscode.com wrote:
You can absolutely use node attributes to drive your recipe... same
way you would use core Chef resource.
Your example would look more like this...
node['httpd']['services'].each do |service_name, val1, val2|
httpd_service service_name do
listen_ports val1
run_user val2
end
end
Correct, except that I would still use the send method.
What I'm suggesting is that a code like this must be on the httpd
cookbook, so that people can use it very fast for simple cases, without a
wrapper cookbook.
-s
On Mon, Aug 25, 2014 at 11:22 AM, Bráulio Bhavamitra
brauliobo@gmail.com wrote:
But why left node values forgotten? LWRP can be used with node values,
for
example:
node[:httpd][:services].each do |service|
httpd_service do
service.each{ |key, value| send key, value }
end
end
Also, the provider could have a way to specify how node attributes
should
fill LWRP
cheers,
bráulio
On Sat, Aug 23, 2014 at 1:04 AM, Lamont Granquist lamont@opscode.com
wrote:
Yep, agreed with all of that. There's the detail of why shareable
recipes
have failed, though, and have been replaced by LWRPs. The more
involved
members of the community have all come to that realization, but its
come
at the
cost of years of fighting with it. I don't think the failures have
been
enumerated
clearly so that others understand it.
On Fri Aug 22 18:54:45 2014, Adam Jacob wrote:
I look at a little differently. I think, for most people, the promise
of shareable recipes that encode policy has failed. If you make them
flexible enough to matter (apaxhe2, say) you have a very complicated
beast, when you probably only needed 20 lines of it.
I think it may well be that the having resources be the prime unit of
re-use, rather than recipes, may well be the right abstraction in the
end.
Adam
On Aug 22, 2014 6:31 PM, "Lamont Granquist" <lamont@opscode.com
mailto:lamont@opscode.com> wrote:
On Fri Aug 22 18:12:27 2014, Bráulio Bhavamitra wrote:
I still cannot get this model of "all done by a wrapper
cookbook using
LWRP". It is just simpler to read node values...
When you go down that road you eventually wind up needing two of
a
thing on a server and not just one instance. Then you start
putting arrays of hashes in your attributes. Since you're now
looping over an array and firing off a lot of resources you'll
want to internally implement that problem as LWRPs anyway. Then
eventually you'll wind up wanting to merge arrays in your
attributes and you'll wind up on this page eventually:
https://coderanger.net/arrays-__and-chef/
<https://coderanger.net/arrays-and-chef/>
Its much easier to just expose the LWRPs. Then the user can use
node attributes, drive them with databags, or just statically
code
them in the LWRP.
--
"Lute pela sua ideologia. Seja um com sua ideologia. Viva pela sua
ideologia. Morra por sua ideologia" P.R. Sarkar
EITA - Educação, Informação e Tecnologias para Autogestão
Blog - Bráulio Bhavamitra
http://eita.org.br
"Paramapurusha é meu pai e Parama Prakriti é minha mãe. O universo é
meu lar
e todos nós somos cidadãos deste cosmo. Este universo é a imaginação da
Mente Macrocósmica, e todas as entidades estão sendo criadas,
preservadas e
destruídas nas fases de extroversão e introversão do fluxo imaginativo
cósmico. No âmbito pessoal, quando uma pessoa imagina algo em sua
mente,
naquele momento, essa pessoa é a única proprietária daquilo que ela
imagina,
e ninguém mais. Quando um ser humano criado mentalmente caminha por um
milharal também imaginado, a pessoa imaginada não é a propriedade desse
milharal, pois ele pertence ao indivíduo que o está imaginando. Este
universo foi criado na imaginação de Brahma, a Entidade Suprema, por
isso a
propriedade deste universo é de Brahma, e não dos microcosmos que
também
foram criados pela imaginação de Brahma. Nenhuma propriedade deste
mundo,
mutável ou imutável, pertence a um indivíduo em particular; tudo é o
patrimônio comum de todos."
Restante do texto em
A problemática de hoje em dia - Bráulio Bhavamitra
--
"Lute pela sua ideologia. Seja um com sua ideologia. Viva pela sua
ideologia. Morra por sua ideologia" P.R. Sarkar
EITA - Educação, Informação e Tecnologias para Autogestão
Blog - Bráulio Bhavamitra
http://eita.org.br
"Paramapurusha é meu pai e Parama Prakriti é minha mãe. O universo é meu
lar e todos nós somos cidadãos deste cosmo. Este universo é a imaginação da
Mente Macrocósmica, e todas as entidades estão sendo criadas, preservadas e
destruídas nas fases de extroversão e introversão do fluxo imaginativo
cósmico. No âmbito pessoal, quando uma pessoa imagina algo em sua mente,
naquele momento, essa pessoa é a única proprietária daquilo que ela imagina,
e ninguém mais. Quando um ser humano criado mentalmente caminha por um
milharal também imaginado, a pessoa imaginada não é a propriedade desse
milharal, pois ele pertence ao indivíduo que o está imaginando. Este
universo foi criado na imaginação de Brahma, a Entidade Suprema, por isso a
propriedade deste universo é de Brahma, e não dos microcosmos que também
foram criados pela imaginação de Brahma. Nenhuma propriedade deste mundo,
mutável ou imutável, pertence a um indivíduo em particular; tudo é o
patrimônio comum de todos."
Restante do texto em
A problemática de hoje em dia - Bráulio Bhavamitra