Можно установить программное обеспечение с помощью Ansible и Puppet, загрузив роль из galaxy или puppetforge и запустив ее без мастера.
Цель
Цель - установить MongoDB с использованием повара без мастера. Я просто хочу скачать кулинарную книгу и запустить ее.
Попытка
knife cookbook site download mongodb3
сохранил поваренную книгу в /home/user/mongodb3-5.3.0.tar.gz
chef-client --local -o recipe['mongodb3']
, но это привело к:[2016-11-18T10:35:28+01:00] WARN: No config file found or specified on command line, using command line options.
[2016-11-18T10:35:28+01:00] WARN: No cookbooks directory found at or above current directory. Assuming /home/user.
Starting Chef Client, version 12.15.19
[2016-11-18T10:36:05+01:00] WARN: Run List override has been provided.
[2016-11-18T10:36:05+01:00] WARN: Original Run List: []
[2016-11-18T10:36:05+01:00] WARN: Overridden Run List: [recipe[mongodb3]]
resolving cookbooks for run list: ["mongodb3"]
================================================================================
Error Resolving Cookbooks for Run List:
================================================================================
Missing Cookbooks:
------------------
No such cookbook: mongodb3
Expanded Run List:
------------------
* mongodb3
Platform:
---------
x86_64-linux
Running handlers:
[2016-11-18T10:36:05+01:00] ERROR: Running exception handlers
Running handlers complete
[2016-11-18T10:36:05+01:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 36 seconds
[2016-11-18T10:36:05+01:00] FATAL: Stacktrace dumped to /home/user/.chef/local-mode-cache/cache/chef-stacktrace.out
[2016-11-18T10:36:05+01:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-11-18T10:36:05+01:00] ERROR: 412 "Precondition Failed"
[2016-11-18T10:36:05+01:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Попытка 2
Код Chef можно запустить, используя пример как предоставлено @TimHaintz:
[2016-11-28T08:19:12+01:00] WARN: No config file found or specified on command line, using command line options.
Starting Chef Client, version 12.15.19
[2016-11-28T08:19:15+01:00] WARN: Run List override has been provided.
[2016-11-28T08:19:15+01:00] WARN: Original Run List: []
[2016-11-28T08:19:15+01:00] WARN: Overridden Run List: [recipe[helloworld]]
resolving cookbooks for run list: ["helloworld"]
Synchronizing Cookbooks:
- helloworld (0.0.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 1 resources
Recipe: helloworld::default
* file[/home/user/x.txt] action create
- create new file /home/user/x.txt
- update content in file /home/user/x.txt from none to 787ec7
--- /home/user/x.txt 2016-11-28 08:19:15.527057085 +0100
+++ /home/user/.chef-x20161128-7678-no5ia3.txt 2016-11-28 08:19:15.527057085 +0100
@@ -1 +1,2 @@
+HELLO WORLD
- restore selinux security context
[2016-11-28T08:19:15+01:00] WARN: Skipping final node save because override_runlist was given
Running handlers:
Running handlers complete
Chef Client finished, 1/1 resources updated in 03 seconds
Вопросы
knife
, chef-apply
, chef-client
, chef-shell
или chef-solo
?knife cookbook site download
просто предоставляет вам необработанный tarball, не в формате, который вы можете использовать напрямую с Chef. Если вы ищете полнофункциональный рабочий процесс для шеф-повара, я бы использовал knife-solo
плагин вместе с Berkshelf.
Поместите поваренные книги, которые хотите использовать, в Berksfile
а затем используйте knife solo cook
передать их на целевой узел и запустить chef-solo
.
@coderanger посоветовал использовать berkshelf и следующие фрагменты были найдены в эта документация:
Berksfile
source "https://supermarket.chef.io"
cookbook "terraform"
Установка поваренных книг
user@host ~ $ berks install
Resolving cookbook dependencies...
Fetching cookbook index from https://supermarket.chef.io...
Installing ark (1.1.0)
Installing compat_resource (12.16.2)
Installing seven_zip (2.0.2)
Installing build-essential (7.0.2)
Installing ohai (4.2.2)
Using terraform (0.5.3)
Installing mingw (1.2.4)
Installing windows (2.1.1)
user@host ~ $ berks vendor
Resolving cookbook dependencies...
Using terraform (0.5.3)
Using ark (1.1.0)
Using mingw (1.2.4)
Using ohai (4.2.2)
Using build-essential (7.0.2)
Using seven_zip (2.0.2)
Using compat_resource (12.16.2)
Using windows (2.1.1)
Vendoring ark (1.1.0) to /home/user/berks-cookbooks/ark
Vendoring build-essential (7.0.2) to /home/user/berks-cookbooks/build-essential
Vendoring compat_resource (12.16.2) to /home/user/berks-cookbooks/compat_resource
Vendoring mingw (1.2.4) to /home/user/berks-cookbooks/mingw
Vendoring ohai (4.2.2) to /home/user/berks-cookbooks/ohai
Vendoring seven_zip (2.0.2) to /home/user/berks-cookbooks/seven_zip
Vendoring terraform (0.5.3) to /home/user/berks-cookbooks/terraform
Vendoring windows (2.1.1) to /home/user/berks-cookbooks/windows
следующие фрагменты основаны на этот ответ:
config.rb
cookbook_path [
'/home/user/berks-cookbooks'
]
config.json
{
"run_list": [
"terraform"
]
}
Бегать
sudo chef-solo -c config.rb -j config.json