仅用于安装mongodb-shell的厨师食谱

时间:2020-12-05 00:25:16

I am trying to install a mongo client via chef. Essentially this is what I have been doing in manual installs:

我正在尝试通过厨师安装mongo客户端。基本上这就是我在手动安装中所做的事情:

sudo vi /etc/yum.repos.d/mongodb.repo 

    [mongodb]
    name=MongoDB Repository
    baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
    gpgcheck=0
    enabled=1

sudo yum install mongodb-org-shell-2.6.7

I don't want to reinvent the wheel here, nor do I want to install anything other than the shell. This cookbook looks like a good resource, but I cannot get it to install just the shell:

我不想在这里重新发明*,也不想安装除了外壳之外的任何东西。这本食谱看起来像一个很好的资源,但我不能让它只安装shell:

https://github.com/edelight/chef-mongodb  

But it seems to not allow for any of the main components to be installed. Will i need to LWRP?

但它似乎不允许安装任何主要组件。我需要LWRP吗?

1 个解决方案

#1


Well i picked apart the mongodb cookbook - to this tune:

好吧,我挑选了mongodb食谱 - 这个曲调:

yum_repository 'mongodb-org-3.0' do
  description 'mongodb RPM Repository'
  baseurl "http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/#{node['kernel']['machine']  =~ /x86_64/ ? 'x86_64' : 'i686'}"
  action :create
  gpgcheck false
  enabled true
end  


case node['platform_family']
when 'debian'
  # this options lets us bypass complaint of pre-existing init file
  # necessary until upstream fixes ENABLE_MONGOD/DB flag
  packager_opts = '-o Dpkg::Options::="--force-confold" --force-yes'
when 'rhel'
  # Add --nogpgcheck option when package is signed
  # see: https://jira.mongodb.org/browse/SERVER-8770
  packager_opts = '--nogpgcheck'
else
  packager_opts = ''
end


package node[:frt_mongodb][:package_name] do
  options packager_opts
  action :install
  version node[:frt_mongodb][:package_version]
end

That said it looks like I should be able to use that cookbook configured with the right attributes to aCcomplish this. The biggest problem is that the recipe within manipulates files that aren't necessary for the shell.

这说看起来我应该能够使用配置了正确属性的菜谱来完成此任务。最大的问题是,处理内部的配方操作shell不需要的文件。

#1


Well i picked apart the mongodb cookbook - to this tune:

好吧,我挑选了mongodb食谱 - 这个曲调:

yum_repository 'mongodb-org-3.0' do
  description 'mongodb RPM Repository'
  baseurl "http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/#{node['kernel']['machine']  =~ /x86_64/ ? 'x86_64' : 'i686'}"
  action :create
  gpgcheck false
  enabled true
end  


case node['platform_family']
when 'debian'
  # this options lets us bypass complaint of pre-existing init file
  # necessary until upstream fixes ENABLE_MONGOD/DB flag
  packager_opts = '-o Dpkg::Options::="--force-confold" --force-yes'
when 'rhel'
  # Add --nogpgcheck option when package is signed
  # see: https://jira.mongodb.org/browse/SERVER-8770
  packager_opts = '--nogpgcheck'
else
  packager_opts = ''
end


package node[:frt_mongodb][:package_name] do
  options packager_opts
  action :install
  version node[:frt_mongodb][:package_version]
end

That said it looks like I should be able to use that cookbook configured with the right attributes to aCcomplish this. The biggest problem is that the recipe within manipulates files that aren't necessary for the shell.

这说看起来我应该能够使用配置了正确属性的菜谱来完成此任务。最大的问题是,处理内部的配方操作shell不需要的文件。