- From: Sean OMeara <
>
- To: "
" <
>
- Subject: [chef] Re: Writing a cross-platform template definition
- Date: Fri, 14 Nov 2014 13:06:31 +0100
Hi Simon!
Cross-platform patterns are Hard, and usually devolve into spaghetti.
I always preach maximizing for grokability, as your code will often be
read by other people for the first time in operations scenarios.
Usually, its more than just the individual resource that differ from
platform to platform, but the pattern as a whole.
If your cookbook is a language runtime, using include_recipe,
switching on platform may be appropriate.
If your cookbook is setting up a service, I'd suggest making a
resource for it, and encapsulating the code into different providers.
http://www.slideshare.net/someara/cookbook-reusability-chef-community-summit-2014
github.com/opscode-cookbooks/mysql
github.com/opscode-cookbooks/httpd
-s
On Fri, Nov 14, 2014 at 12:51 PM, Simon Detheridge
<
>
wrote:
>
Hi,
>
>
I'm trying to write a recipe that works on Linux and Windows.
>
>
If I write:
>
user "root"
>
in a template, Windows throws an error declaring "No mapping between
>
account names and security IDs was done."
>
>
The docs suggest that I should be using 'rights' instead of 'user', but
>
this means I'd have to write all of my templates or recipes twice. Is there
>
a workaround? (Can I map 'root' to 'Administrator'?)
>
>
I can set a 'root_user' attribute on my nodes, but this makes the cookbook
>
non-usable outside of my environment. Is there an accepted way to
>
accomplish this?
>
>
--
>
Simon Detheridge - CTO, Widgit Software
>
26 Queen Street, Cubbington, CV32 7NA - Tel: +44 (0)1926 333680
Archive powered by MHonArc 2.6.16.