- From: AJ Christensen <
>
- To:
- Subject: [chef] Re: chef + managed-directory pain
- Date: Thu, 23 Aug 2012 09:41:30 +1200
Hello,
I has an idea:
On 23 August 2012 03:06,
<
>
wrote:
>
Hi,
>
>
has anybody a solution how to realize managed directories with chef ?
>
>
>
remote_directory with "purge true" isn't a solution in the following cases:
>
>
>
Ubuntu:
>
>
>
Case 1:
>
>
1. clean out /etc/apt/sources.list.d/
>
>
2. create apt-repo-files with "apt_repository" in /etc/apt/sources.list.d/
>
>
3. remote_directory-resource deletes the files from 2.
Don't mix resources (and providers) to manage the same content.
Dynamically consume data pertaining to your infrastructure and create
the Resources required via the Recipe DSL:
node['apt_repositories']['enabled_repositories'].each do |repo|
apt_repository repo['name'] do
...
end
end
A similar (contrived) example could be made for the other scenario you
posted below.
Generally, I'd (personally) say jamming files in a cookbook and
remote_directory transferring them around is an anti-pattern that
should be avoided (YMMV)
--AJ
>
>
>
>
Case 2:
>
>
1. clean out /etc/apache2/conf.d/
>
>
2. generate apache config-files (with template resource) in
>
/etc/apache2/conf.d/
>
>
3. remote_directory-resource deletes the files from 2.
>
>
>
>
I've looked at https://github.com/zts/chef-cookbook-managed_directory ,but
>
ths solution has the same problems.
>
>
>
Thats the last big hurdle on our migration to chef, I hope somebody have an
>
idea.
>
>
Archive powered by MHonArc 2.6.16.