My Requirement is to call manifest file in puppet using java code to checkout an application from svn and store it in the local folder in desktop..
1) I have to write a java code to call puppet Manifest in controller
2) Commands to call svn and checkout the application to local folder in Manifest file..
I am new to Puppet..
Can any one please help..
Thanks in Advance..
You can use a puppet forge module to checkout repository.
Example with the vcsrepo module:
vcsrepo { '/tmp/vcstest-svn-checkout':
ensure => present,
provider => svn,
source => 'http://svn.edgewall.org/repos/babel/trunk',
}
Source : https://forge.puppetlabs.com/puppetlabs/vcsrepo
Related
I'm installing the latest sensu-plugins-mysql with the following puppet code successfully:
ensure_packages('sensu-plugins-mysql', { provider => sensu_gem, ensure => latest})
But I want to use my fork nagyt234/sensu-plugins-mysql, created from sensu-plugins/sensu-plugins-mysql, how to do it? The source option doesn't work:
ensure_packages('sensu-plugins-mysql', { provider => sensu_gem, source => 'https://github.com/nagyt234/sensu-plugins-mysql.git', ensure => latest})
The problem is, that sensu_gem is not able to install a gem directly from a github repository, so the sensu-plugins-mysql was always installed from rubygem.org. I had to generate my own gem with a different name and publish it to rubygem.org.
I have to get remote git information using NodeJS. I have managed to get info from a cloned repo using simple-git. The code I have test is the following:
require('simple-git')('/my/local/git/repo/path')
.pull()
.tags(function(err, tags) {
console.log("These are my tags: %s", tags.all);
});
However, it requires the repo to be locally cloned. Is there any way (using this or another module) to connect the remote git to get this info?
You need to specify the path to any valid repo or leave it empty considered git repo is under current directory. That's just required to make commands worked.
After that you can use listRemote method in the following way:
require('simple-git')([optional path])
// .init() - in case it's totally empty folder
.addRemote('remote_repo_alias', 'path/to/remote/repo')
.listRemote(['--tags', 'remote_repo_alias'], function(err, tags) {
// ...
});
I am playing around with puppet and am trying to copy a file from my local directory (my laptop) on to my puppet agent. I have two VM's running, one is puppet master and one is puppet agent. I looked up at this answer here but it seems like it was an older version on puppet. I am running puppet 3.4.3 . I have gone through the pro puppet book and the puppet tutorials but find them way to confusing (the former having very glaring typos). It would be BIG help if someone helped me out with the process in simple steps. This is what I have till now.
I created a folder named my_module in /etc/puppet/.
In /etc/puppet/my_module is created two folders files, manifests and a file init.pp .
Init.pp looks like this:
class myfile {
file { "/home/me/myfolder/file.py":
mode => "0440",
owner => 'root',
group => 'root',
source => 'puppet:///modules/module_name/datas.xls',
}
}
I then copied the file file.py to the files folder I created above. I am unsure how to proceed after this step. Any help?
please read this documentation regarding creating your own modules. The module you created is in the wrong location right now. Should be /etc/puppet/modules or wherever the modulepath in /etc/puppet/puppet.conf points to on the puppet master.
The file given with source => 'puppet:///modules/module_name/datas.xls' is the one which will be placed in /home/me/myfolder/file.py on the client where you run the puppet agent -t command to rollout your changes.
Another good source for examples how to use the standard builtin puppet features is Type Reference of puppetlabs.
I need to use an Ftp location where latest packages are dumped, then get the latest file and copy it over to node using Puppet.
Would like to know the best way to do this in node.pp file.
I am not sure about ftp, but an example of http location could work like this using puppet's package resource,
package {
"package name" :
ensure => "latest",
source => "http://url",
provider => "rpm",
}
Lets take the example, I am having a jboss-4.2.3 installers as a .tar file. In general to install jboss, i ll
1. untar the jboss-4.2.3 into a prefefined folder (opt/server/jbossas/) into multiple servers
2. untar the openjdk into a preferined path (/opt/software/java)set the path in the bash.profile
3. Create server profile in the place where jboss is installed
4. Start the server.
Lets say that I have to do this in 16 nodes (servers).
Now, I should store the jboss and openjdk installers at a central location and it should be transferred to the nodes before the 1st step can begin.
I wrote the manifest to perform the requirements form 1 to 4. But not sure how can I automate the transfer of the installers from a central repo. I am not worried about the type of central repo. It can be a ftp or puppet or anything else.
Please help me. I was going through filebucket. Will this help or should i write a manifest to get this file from a ftp server?
How to create a file repo which can be referred in puppet manifests?
I am not sure about your exact problem, but you can have a look at this and get an idea...
In most of the usage the files are transferred from the puppetmaster to the clients. If you have your policies defined in a module to untar and install the packages, e.g. module name jboss, you can keep the tarball in these kind of structure in the puppet master and run puppet agent from puppet client :
/etc/puppet/module/jboss/files/jboss_pkg.tar
Your policy for your clients should then say something like the following in the :
In e.g,
/etc/puppet/modules/jboss/manifests/init.pp
class jboss {
file { '/tmp/installation/jboss_pkg.tar' :
source => "puppet:///modules/jboss/jboss_pkg.tar",
}
#You can then right a small script that will execute all the installation process. You can use 'exec' in puppet to do that.
exec { 'install_jboss' :
command => "/path/to/install_jboss.sh",
require => File["/tmp/installation/jboss_pkg.tar"],
onlyif => "/check/that/it/is/not/installed/already",
}
## and write other execs to start the server or enable services etc...
}
# In site.pp
node 'client.mytest.org' {
include jboss
}
The general solution to provide installers to Puppet is to set up your own package repository (rather than just a file repo).
http://www.techrepublic.com/blog/opensource/create-your-own-yum-repository/609
Then, you can use Puppet's built in package resource for easy install/upgrade/uninstall
http://docs.puppetlabs.com/references/latest/type.html#package
The following projects seem to provide a rpm/deb version of JBoss that you can publish to your repository
https://github.com/floreal/jboss-deb-package
http://code.google.com/p/jboss-rpm/