Why do you not want to use knife bootstrap or vagrant? Installing chef client in the template image seems like the wrong way around to me...
On Sat, Jun 2, 2012 at 5:32 PM, Motiejus Jakštys < "> > wrote:
> On Sat, Jun 2, 2012 at 4:48 PM, Motiejus Jakštys < "> > wrote:
>> Hi,
>>
>> we are creating chef nodes using xen-create-image. I am creating a
>> separate role, which is supposed to install chef via omnibus. There
>> are two approaches to that:
>> 1) run chef-client to fully install the system during xen-create-image
>> phase (in chroot)
>> 2) install chef the way that after first reboot it would run
>> chef-client and completely configure by itself.
>>
>> I would prefer (2), because it is more "real" scenario, and would not
>> increase (quite long already) time of xen-create-image.
>>
>> Is there a way to install chef with only chef-client recipe? Or is it
>> generally considered "ok" to do it the (1) way?
>
> Found it! Here is the script :)
>
> chroot ${prefix} http_proxy=http://wwwcache:8080 wget
> -O/tmp/install.sh http://www.opscode.com/chef/install.sh
> chroot ${prefix} http_proxy=http://wwwcache:8080 bash /tmp/install.sh
> chroot ${prefix} knife configure client /etc/chef -s "http://chef.server:4000"
> cp /etc/chef/validation.pem ${prefix}/etc/chef/
> chroot ${prefix} chef-client -o recipe[chef-client]
> chroot ${prefix} /etc/init.d/chef-client stop
>
This has 2 problems:
1) chef-client or its dependency does not stop (and xen-create-image
fails while unmounting the image). Logs are unhelpful. After some
digging I think I will be able to find and fix it.
2) When running chef-client for the first time, chef-client sees its
hostname same as the host hostname... Which is severe. And I could
find no way to change hostname in chroot without affecting the host.
So I will try to make sure chef-client is started on its first
reboot.. And configure itself properly.
--
Motiejus Jakštys
Archive powered by MHonArc 2.6.16.