I've been looking for a puppet package website such as https://packagist.org/ but with no luck, are there any websites out there where you can search for a mongodb/php or elascticsearch puppet package?
I've looked at puphpet but it doesn't have all the packages that I'm looking for.
Thanks.
When I am searching for puppet modules, the first place I go to is the official puppetlabs forge:
https://forge.puppetlabs.com/
You can install puppet modules directly from the puppetforge using the following command line:
puppet module install puppetlabs-apache --version 0.0.2
(http://docs.puppetlabs.com/puppet/latest/reference/modules_installing.html)
Related
I am experimenting with Puppet using Vagrant. I'm new to Puppet.
I'm installing modules in my Puppet manifest using the approach suggested at: Can I install puppet modules through puppet manifest?
My default.pp contains something like:
$dsesterojava = 'dsestero-java'
exec { 'dsestero-java':
command => "puppet module install ${dsesterojava}",
unless => "puppet module list | grep ${dsesterojava}",
path => ['/usr/bin', '/bin']
}
include java::java_7
I'm trying to import a module and then immediately use the classes defined in it.
Currently, I get:
Error: Could not find class java::java_7
If I comment out the include line and re-run it. The module installs. If I then removed the comment and run the provisioning again then it works.
There is some kind of "chicken and egg" situation here. Can I use a module in the same Puppet manifest that installs it?
How should I solve it?
No, you cannot do this. When your catalog is compiled, Puppet will search in the appropriate directories for all of the required code and data. Since the java module does not exist until catalog application, the compilation of a catalog (occurs prior to application) depending upon it will fail. You are absolutely dealing with a "chicken and egg" situation here. I highly recommend against using Puppet code to install Puppet code.
Alternatively, the recommended approach to install and manage your Puppet modules is to use one of these solutions:
librarian-puppet: http://librarian-puppet.com/
r10k: https://github.com/puppetlabs/r10k
code-manager (PE only): https://puppet.com/docs/pe/2017.3/code_management/code_mgr.html
These will also solve the problem for you within the Vagrant if you are using the agent provisioner and subscribing the Vagrant instance to a Puppet Master.
If you are using the apply provisioner inside of Vagrant, then you will need to go a different route. The simplest solution is to use the shell provisioner to install Puppet modules via module install after the Puppet installation (unless you are using a Vagrant box with Puppet baked in, in which case you are probably not installing Puppet on it). Alternatively, you could share a directory with the host where your modules are installed, or install the librarian-puppet or r10k gems onto the Vagrant box and then use them to install into the appropriate path. I can go into more detail on these upon request.
I have found this DNSimple ansible module:
http://docs.ansible.com/ansible/dnsimple_module.html
but can not find anywhere on that page to download and install it? How do I go about downloading and installing ansible modules like this. Thanks.
The accepted answer solved the questioner's problem but didn't address the broader scope of the question.
How to install an Ansible module? The documentation is currently vague as to how to achieve this simple requirement!
An excellent general guide to writing modules (I've no connection to the author) can be found here.
The quickest way is to simply have a folder called library/ in the same folder as your playbook. Inside this folder, place the python script for the Ansible Module. You should now have a corresponding task available to your playbook.
If you want to share your module across multiple projects, then you can add an entry to /etc/ansible/ansible.cfg pointing to a shared library location, eg:
library = /usr/share/ansible/library
The module itself is part of ansible since version 1.6 (as stated here). To use it, you need to have dnsimple on your host machine (also stated in the above description). Install it with sudo pip install dnsimple
It is important to know that base ansible modules are not installed by default on devel version, which is the default installed version when you build from source.
Only few modules are present for developpment purpose.
So when you'll run your playbook it'll complain about not found module with following error message
couldn't resolve module/action 'xxx'
If you have no choice but building for source, don't forget to checkout the stable branch to install all basic ansible modules!
We are trying to create a debian package from ruby source code. It's for fluentd software. We know that a pre-built debian package for fluentd already exists. But because of the build systems in our ocmpany we have to create a debian package manually.
We did try out deb2gem to create a deb package source but running into issues while building it.
Any pointers about how to build a debian package from scratch - using ruby source code would be helpful.
So here are the steps I followed.
Our work environment - doesn't let outside connections from the production hosts. So I can't just gem install fluentd.
Since it's a debian Wheezy build, I need to build a debian package and install on it. We can't download the binary debian package which fluentd provides and use it - so I have to build it from source.
So, I followed this procedure:
Download the actual gem of fluentd from here - https://rubygems.org/gems/fluentd
Then use gem2deb tool to create a debian source files/templates. The debian/control file looks like this - http://pastebin.com/CHJXdJMi
So when I run debuild -uc -us -b now - technically it should build a .deb package. But I get errors like these - http://pastebin.com/fEYFARRQ
The ruby version on the host I am doing is 2.3.1 But I think gem2deb uses ruby 1.9.1. And fluentd needs ruby >=1.9.3 to build it from source.
So this is where I am stuck at. I think if I don't use gem2deb then I have to figure out a way to just checkout the source code of fluentd from git and build a debian package from scratch.
There is not much info about how to go about that anywhere except this - https://wiki.debian.org/Teams/Ruby/Packaging
Appreciate any help in advance!
Thanks
So I am tasked with packaging a Ruby application. The idea is to eliminate the need to apt-get any packages or gem install anything. the package is all-inclusive.
I've gotten as far as finding Omnibus (there is also fmp-cookery but it doesnt seem to be as well known)
I've figured out the general structure of omnibus projects but now getting problems with specifics:
1) I have a bunch of recipies that run with Chef AT INSTALL TIME. These setup the DB and nginx configs. Whats the best way to run through these on target machine?
2) I added a bundle install line in my build scripts, but this now dubplicates my requirements. For example nokogiri gets installed twice. Once as my actual project Gem and another time as another requirement of omnibus. So then I end up with 2 binaries one in /#{instal_dir}/embedded/bin and one in ${install_dir}/embedded/lib/ruby/.../gems any way to prevent this?
Building an installer is bit more involved than creating a chef cookbook.
User needs to write a DSL for each module (this has instructions on gathering the artifacts and installing it on specific OS).
After creating the omnibus project, refer to the README file to get started with basics.
Refer to this github project for details on how to build your own DSLs. Gitlab omnibus project has DSLs for some modules like postgresql etc.
https://gitlab.com/gitlab-org/omnibus-gitlab/tree/master
Example DSL for embedding nginx module in your installer looks like this:
name "nginx"
default_version "1.9.10"
dependency "pcre"
dependency "openssl"
source url: "http://nginx.org/download/nginx-#{version}.tar.gz",
md5: "64cc970988356a5e0fc4fcd1ab84fe57"
relative_path "nginx-#{version}"
build do
command ["./configure",
"--prefix=#{install_dir}/embedded",
"--with-http_ssl_module",
"--with-http_stub_status_module",
"--with-http_gzip_static_module",
"--with-http_v2_module",
"--with-ipv6",
"--with-debug",
"--with-ld-opt=-L#{install_dir}/embedded/lib",
"--with-cc-opt=\"-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include\""].join(" ")
command "make -j #{workers}", :env => {"LD_RUN_PATH" => "#{install_dir}/embedded/lib"}
command "make install"
end
I'm new to chef and planning for disaster recovery plan such that will be having all my configuration files, list of packages installed on system in chef cookbooks. I wondering how could i mention a text file in recipe for the package installation.
I have taken list of packages with dpkg --get-selections > packages.txt.
I would like chef to read a package from that list one by one and install it. Would be great if someone can guide me on this.
Thanks,
Swaroop.
Blueprint could help you for your task. It inspects the system and generates a chef cookbook out of it.
Disclaimer: I haven't tried it, yet. But it looks very interesting.
I am not aware of a way to read a file from a cookbook. But you can install a number of packages with the following code in a recipe:
%w{
package-1
package-2
}.each do |pkg|
package pkg
end