I've been working on learning puppet and using it to set up a jenkins box. I'm wiring jenkins through tomcat, since I may also end up running other webapps on there.
EDIT: I've installed (via puppet module install puppetlabs-stdlib
) the stdlib provided by puppetlabs to use the file_line type.
This is puppet module manifest for setting up jenkins and tomcat and wiring the two together.
class tomcat_jenkins {
package{'java-1.7':
ensure => installed,
name => 'java-1.7.0-openjdk',
}
package{'tomcat6':
ensure => installed,
require => Package['java-1.7'],
}
package{'jenkins':
ensure => installed,
require => Yumrepo['jenkins'],
}
file{'jenkins-symlink':
name => '/usr/share/tomcat6/webapps/jenkins.war',
require => [Package['tomcat6'], Package['jenkins']],
ensure => link,
target => '/usr/lib/jenkins/jenkins.war',
}
file{ '/srv':
ensure => directory,
owner => 'root',
group => 'root',
}
file{ '/srv/jenkins':
ensure => directory,
owner => 'tomcat',
group => 'tomcat',
require => Package['tomcat6'],
}
file_line{'jenkins_home':
ensure => present,
path => '/etc/tomcat6/tomcat6.conf',
line => 'JENKINS_HOME=/srv/jenkins',
require => [Package['tomcat6'], File['/srv/jenkins']],
}
service{'tomcat6':
ensure => running,
enable => true,
require => [Package['tomcat6'], Package['jenkins'], File_line['jenkins_home']],
subscribe => [Package['jenkins'], File['jenkins-symlink']],
}
}
I see the output from the puppet agent that it is properly applying the catalog, and it pretends like it went ahead and applied the changes, but there's no /jenkins/
in my /etc/tomcat6/tomcat6.conf file. I don't have anything else managing that file.
puppet agent -t -d
output:
info: Applying configuration version '1343250206'
debug: /Stage[main]/Tomcat_jenkins/File_line[jenkins_home]/require: requires Package[tomcat6]
debug: /Stage[main]/Tomcat_jenkins/File_line[jenkins_home]/require: requires File[/srv/jenkins]
debug: /Stage[main]/Epel_repo/Yumrepo[epel]/require: requires File[/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6]
debug: /Stage[main]/Tomcat_jenkins/Package[jenkins]/require: requires Yumrepo[jenkins]
debug: /Stage[main]/Tomcat_jenkins/Service[tomcat6]/require: requires Package[tomcat6]
debug: /Stage[main]/Tomcat_jenkins/Service[tomcat6]/require: requires Package[jenkins]
debug: /Stage[main]/Tomcat_jenkins/Service[tomcat6]/require: requires File_line[jenkins_home]
debug: /Stage[main]/Tomcat_jenkins/Service[tomcat6]/subscribe: subscribes to Package[jenkins]
debug: /Stage[main]/Tomcat_jenkins/Service[tomcat6]/subscribe: subscribes to File[jenkins-symlink]
Asking around on #puppet on irc.freenode.net, I found out that I was missing a configuration parameter on the puppet agent. I needed:
in the
[main]
section. After adding that line, it happily downloaded the plugins, and set up my stuff. Win.