{"id":14984815,"url":"https://github.com/voxpupuli/puppet-jenkins","last_synced_at":"2025-05-14T19:05:57.212Z","repository":{"id":38401444,"uuid":"9735844","full_name":"voxpupuli/puppet-jenkins","owner":"voxpupuli","description":"Puppet module for Jenkins","archived":false,"fork":false,"pushed_at":"2025-03-19T19:09:21.000Z","size":2684,"stargazers_count":275,"open_issues_count":92,"forks_count":566,"subscribers_count":166,"default_branch":"master","last_synced_at":"2025-04-10T02:18:21.403Z","etag":null,"topics":["centos-puppet-module","hacktoberfest","linux-puppet-module","opensuse-puppet-module","puppet","redhat-puppet-module","sles-puppet-module","ubuntu-puppet-module"],"latest_commit_sha":null,"homepage":"http://forge.puppetlabs.com/puppet/jenkins","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/voxpupuli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"vox-pupuli","github":"voxpupuli"}},"created_at":"2013-04-28T20:34:40.000Z","updated_at":"2025-02-05T12:48:25.000Z","dependencies_parsed_at":"2023-02-16T19:15:39.517Z","dependency_job_id":"8009ec19-db11-4259-b7f4-bc4317b307d9","html_url":"https://github.com/voxpupuli/puppet-jenkins","commit_stats":{"total_commits":1270,"total_committers":206,"mean_commits":6.165048543689321,"dds":0.8488188976377953,"last_synced_commit":"e9be9e92d85822e2b05e1d9b46ec23314e27b2c1"},"previous_names":["jenkinsci/puppet-jenkins"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-jenkins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-jenkins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-jenkins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-jenkins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voxpupuli","download_url":"https://codeload.github.com/voxpupuli/puppet-jenkins/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142906,"owners_count":21054672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["centos-puppet-module","hacktoberfest","linux-puppet-module","opensuse-puppet-module","puppet","redhat-puppet-module","sles-puppet-module","ubuntu-puppet-module"],"created_at":"2024-09-24T14:09:42.589Z","updated_at":"2025-04-10T02:18:26.878Z","avatar_url":"https://github.com/voxpupuli.png","language":"Ruby","funding_links":["https://opencollective.com/vox-pupuli","https://github.com/sponsors/voxpupuli"],"categories":[],"sub_categories":[],"readme":"# puppet-jenkins\n\n[![Build Status](https://travis-ci.org/voxpupuli/puppet-jenkins.svg?branch=master)](https://travis-ci.org/voxpupuli/puppet-jenkins)\n\nThis is intended to be a re-usable\n[Puppet](http://www.puppetlabs.com/puppet/introduction/) module that you can\ninclude in your own tree.\n\n# Experimental Types and Providers\n\n_The experimental types/providers are **not for the faint of heart**. If you are\nstarting out with this module you probably want to skip directly to [Getting\nStarted](#getting-started)._\n\nA family of experimental native types and providers has been added to this\nmodule, in parallel to the existing classes and defined types, with the goal of\nsoliciting feedback.  One of the primary benefits of these new types is not\nrequiring manifest changes to manage jenkins with or without \"security\"\nenabled.  The goal is to eventually replace the functionality of the existing\nclasses/defines with the new types.  _Usage feedback (positive and negative),\nbug reports and/or PRs would be greatly welcomed._\n\n**The semantics and API of these types should be considered _unstable_ and\nalmost certainly will change based on feedback.  It is currently unclear if\nthese types will be considered part of the public API or treated as private to\nthe module.**\n\nSee [NATIVE_TYPES_AND_PROVIDERS.md](NATIVE_TYPES_AND_PROVIDERS.md)\n\n# Jenkins 2.54 and 2.46.2 remoting free CLI and username / password CLI auth\n\nJenkins refactored the CLI in 2.54 and 2.46.2 in response to several security\nincidents (See [JENKINS-41745](https://issues.jenkins-ci.org/browse/JENKINS-41745).\nThis module has been adjusted to support the new CLI.\n\nThe CLI supports proper authentication with username and password. It's a\nrequirement for supporting AD and OpenID authentications (there is no ssh key\nthere). You can supply ```$jenkins::cli_username``` and\n```$jenkins::cli_password``` to use username / password based authentication.\nThen the puppet automation user can also reside in A.D\n\nNote: Jenkins requires a ssh username, so you must also provide\n```$jenkins::cli_username``` for ssh. If you specify both username/password\nand ssh key file, SSH authentication is preferred.\n\n# Using puppet-jenkins\n\n## Getting Started\n```bash\npuppet module install puppet/jenkins\n```\n\n```puppet\n    node 'hostname.example.com' {\n        include jenkins\n    }\n```\nThen the service should be running at [http://hostname.example.com:8080/](http://hostname.example.com:8080/).\n\n### Jenkins' options\n\n#### Master Executor Threads\n\n```puppet\nclass { 'jenkins':\n  executors =\u003e 0,\n}\n```\n\n### Managing Jenkins jobs\n\n\nBuild jobs can be managed using the `jenkins::job` define\n\n#### Creating or updating a build job\n```puppet\n  jenkins::job { 'test-build-job':\n    config =\u003e template(\"${templates}/test-build-job.xml.erb\"),\n  }\n```\n\n#### Removing an existing build job\n```puppet\n  jenkins::job { 'test-build-job':\n    ensure =\u003e 'absent',\n  }\n```\n\n### Installing Jenkins plugins\n\n\nThe Jenkins puppet module defines the `jenkins::plugin` resource which\nwill download and install the plugin \"[by\nhand](https://wiki.jenkins-ci.org/display/JENKINS/Plugins#Plugins-Byhand)\"\n\nThe names of the plugins can be found on the [update\nsite](https://updates.jenkins-ci.org/download/plugins)\n\n#### Latest\n\nBy default, the resource will install the latest plugin, i.e.:\n```puppet\n  jenkins::plugin { 'git': }\n```\n\nIf you specify `version =\u003e 'latest'` in current releases of the module, the\nplugin will be downloaded and installed with *every* run of Puppet. This is a\nknown issue and will be addressed in future releases.\n\n#### By version\nIf you need to peg a specific version, simply specify that as a string, i.e.:\n```puppet\n  jenkins::plugin { 'git':\n    version =\u003e '1.1.11',\n  }\n```\n\nNote that plugin will timeout if it takes longer than 120 seconds to download.\nYou can increase this by specifying a timeout value, i.e: `timeout =\u003e 240`.\n\n#### Verifying\n\nThis module will download the jenkins modules over HTTP, without SSL.\nIn order to add some verification regarding the downloaded file, you\ncan specify a checksum. You can also define a checksum type with\n'digest_type' (default to sha1 if unspecified) ie.:\n\n```puppet\n  jenkins::plugin { 'git':\n    version       =\u003e '2.2.12',\n    digest_string =\u003e '48141822e0eea1faa1a1a99b35372494e7352c2746ca3aa3a19a07f34b021848d2cd0bffc8959c1b809c5be231c1b49e9ffec0430dd68938197ac0f34588ee25',\n    digest_type   =\u003e 'sha512',\n  }\n```\n\n#### Direct URL\n\nDirect URL from which to download plugin without modification.  This is\nparticularly useful for development and testing of plugins which may not be\nhosted in the typical Jenkins' plugin directory structure.\n\n```puppet\n  jenkins::plugin { 'myplugin':\n    source =\u003e 'https://example.org/myplugin.hpi',\n  }\n```\n\nNote that that when `source` is specified, the `version` and `plugin_url`\nparameters will have no effect on the plugin retrieval URL.\n\n#### Plugin dependencies\nDependencies are not automatically installed. You need to manually determine the plugin dependencies and include those as well. The Jenkins wiki is a good place to do this. For example: The Git plugin page is at https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin.\n\n### Slaves\nYou can automatically add slaves to jenkins, and have them auto register themselves.  Most options are actually optional, as nodes will auto-discover the master, and connect.\n\nFull documentation for the slave code is in jenkins::slave.\n\nIt requires the swarm plugin on the master \u0026 the class jenkins::slave on the slaves, as below:\n\n```puppet\n    node /jenkins-slave.*/ {\n      class { 'jenkins::slave':\n        masterurl =\u003e 'http://jenkins-master1.domain.com:8080',\n        ui_user =\u003e 'adminuser',\n        ui_pass =\u003e 'adminpass',\n      }\n    }\n\n    node /jenkins-master.*/ {\n        include jenkins\n        include jenkins::master\n    }\n```\n\n\n### Depending on Jenkins\n\nIf you have any resource in Puppet that *depends* on Jenkins being present, add\nthe following `require` statement:\n```puppet\n  exec { 'some-exec':\n    require =\u003e Class['jenkins::package'],\n    # ... etc\n  }\n```\n\n\n### Advanced features\n1. Plugin Hash - jenkins::plugins\n2. Config Hash - jenkins::config\n3. Configure Firewall - jenkins (init.pp)\n4. Outbound Jenkins Proxy Config - jenkins (init.pp)\n5. [CLI Helper](#cli-helper)\n    * [`exec_cli_helper`](#exec_cli_helper)\n6. Jenkins Users\n7. Credentials\n8. Simple security model configuration\n\n### API-based Resources and Settings (Users, Credentials, security)\n\nThis module includes a groovy-based helper script that uses the\n[Jenkins CLI](https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI) to\ninteract with the Jenkins API. Users, Credentials, and security model\nconfiguration are all driven through this script.\n\nWhen an API-based resource is defined, the Jenkins' CLI is installed and run\nagainst the local system (127.0.0.1). Jenkins is assumed to be listening on\nport 8080, but the module is smart enough to notice if you've configured an\nalternate port using jenkins::config_hash['JENKINS_PORT'].\n\nUsers and credentials are Puppet-managed, meaning that changes made to them\nfrom outside Puppet will be reset at the next puppet run. In this way, you can\nensure that certain accounts are present and have the appropriate login\ncredentials.\n\n### CLI Helper\n\nThe CLI helper assumes unauthenticated access unless configured otherwise.\nYou can configure `jenkins::cli_helper` to use an SSH key on the managed system\nby passing the keyfile path as a class parameter:\n```puppet\n  class {'jenkins':\n    cli_ssh_keyfile =\u003e '/path/to/id_rsa',\n  }\n```\n\n... or via hiera:\n\n    jenkins::cli_ssh_keyfile: \"/path/to/id_rsa\"\n\n__Direct including of the `jenkins::cli_helper` class into the manifest is deprecated.__\n\nThere's an open bug in Jenkins (JENKINS-22346) that causes authentication to\nfail when a key is used but authentication is disabled. Until the bug is fixed,\nyou may need to bootstrap jenkins out-of-band to ensure that resources and\nsecurity policy are configured in the correct order. For example:\n\n    # In puppet:\n      anchor {'jenkins-bootstrap-start': } -\u003e\n        Class['jenkins::cli_helper'] -\u003e\n          Exec[$bootstrap_script] -\u003e\n            anchor {'jenkins-bootstrap-complete': }\n\n    # Code for $bootstrap_script\n    #!/bin/bash -e\n    # Generate an SSH key for the admin user\n    ADMIN_USER='\u003c%= admin_user_name %\u003e'\n    ADMIN_EMAIL='\u003c%= admin_user_email %\u003e'\n    ADMIN_PASSWORD='\u003c%= admin_user_password %\u003e'\n    ADMIN_FULLNAME='\u003c%= admin_user_full_name %\u003e'\n    ADMIN_SSH_KEY='\u003c%= admin_ssh_keyfile %\u003e'\n    JENKINS_CLI='\u003c%= jenkins_libdir %\u003e/jenkins-cli.jar'\n    PUPPET_HELPER='\u003c%= jenkins_libdir %\u003e/puppet_helper.groovy'\n    HELPER=\"java -jar $JENKINS_CLI -s http://127.0.0.1:8080 groovy $PUPPET_HELPER\"\n    DONEFILE='\u003c%= jenkins_libdir %\u003e/jenkins-bootstrap.done'\n\n    ADMIN_PUBKEY=\"$(cat ${ADMIN_SSH_KEY}.pub)\"\n\n    # Create the admin user, passing no credentials\n    $HELPER create_or_update_user \"$ADMIN_USER\" \"$ADMIN_EMAIL\" \"$ADMIN_PASSWORD\" \"$ADMIN_FULLNAME\" \"$ADMIN_PUBKEY\"\n    # Enable security. After this, credentials will be required.\n    $HELPER set_security full_control\n\n    touch $DONEFILE\n\n#### `jenkins::cli::exec`\n\nThe defined type `jenkins::cli::exec` may be used to execute arbitrary CLI helper\ncommands.\n\nArguments to the CLI helper script may be specified as the resource's title.\n\n```puppet\n  jenkins::cli::exec { 'set_num_executors 0': }\n```\n\nOr passed as an array to the `command` parameter.  This example is\nsemantically equivalent to the first.\n\n```puppet\n  jenkins::cli::exec { 'set_num_executors 0':\n    command =\u003e ['set_num_executors', '0'],\n  }\n```\n\nwhich is also equivalent to:\n\n```puppet\n  jenkins::cli::exec { 'set_num_executors 0':\n    command =\u003e 'set_num_executors 0',\n  }\n```\n\nIf the `unless` parameter is specified, an environment variable named\n`$HELPER_CMD` is declared which contains the complete string needed to execute\nthe CLI helper script (minus arguments).  This may be useful in constructing\nidempotent `exec` statements.\n\n```puppet\n  $num_executors = 0\n  jenkins::cli::exec { \"set_num_executors ${num_executors}\":\n    unless =\u003e \"[ \\$(\\$HELPER_CMD get_num_executors) -eq ${num_executors} ]\"\n  }\n```\n\n#### Users\n\nEmail and password are required.\n\nCreate a `johndoe` user account whose full name is \"Managed by Puppet\":\n```puppet\n  jenkins::user { 'johndoe':\n    email    =\u003e 'jdoe@example.com',\n    password =\u003e 'changeme',\n  }\n```\n\n### Credentials\n\nPassword is required. For ssh credentials, `password` is the key passphrase (or\n'' if there is none). `private_key_or_path` is the text of key itself or an\nabsolute path to a key file on the managed system.\n\nCreate ssh credentials named 'github-deploy-key', providing an unencrypted\nprivate key:\n```puppet\n    jenkins::credentials { 'github-deploy-key':\n      password            =\u003e '',\n      private_key_or_path =\u003e hiera('::github_deploy_key'),\n    }\n```\n\n*_Setting a UUID:_*\n\nYou can also specify a UUID to use with the credentials, which will be used to\nidentify the credentials from within the job config. This is necessary when setting\ncredentials for use with the [git plugin](http://docs.openstack.org/infra/jenkins-job-builder/scm.html#scm.git), for example.\n\nYou can either manually generate a UUID from a site like [UUIDTools.com](https://www.uuidtools.com/generate/v4),\nor use the UUID from an existing user, which is accessible within the URL of the\nJenkins console when managing an existing user's credentials.\n\n```puppet\n    jenkins::credentials { 'deploy-user':\n      password            =\u003e '',\n      private_key_or_path =\u003e hiera('::deploy_key'),\n      uuid                =\u003e hiera('::deploy_credentials_uuid'),\n    }\n```\n\n### Configuring Security\n\nThe Jenkins security model can be set to one of two modes:\n\n* `full_control` - Users have full control after login. Authentication uses\n  Jenkins' built-in user database.\n* `unsecured` - Authentication is not required.\n\nJenkins security is not managed by puppet unless jenkins::security is defined.\n\n## Using from Github / source\n\n### With librarian\n\nIf you use [librarian-puppet](https://github.com/rodjek/librarian-puppet), add\nthe following to your `Puppetfile`:\n\n```ruby\nmod \"puppet/jenkins\"\n```\n\n### With the \"puppet module\" tool\n\nThis module is compatible with the puppet module tool. Appropriately this\nmodule has been released to the [Puppet Forge](http://forge.puppetlabs.com/),\nallowing you to easily install the released version of the module\n\nTo quickly try this module with the puppet module tool:\n\n    % sudo puppet module install puppet/jenkins\n    % sudo puppet apply -v -e 'include jenkins'\n    info: Loading facts in facter_dot_d\n    info: Loading facts in facter_dot_d\n    info: Applying configuration version '1323459431'\n    notice: /Stage[main]/Jenkins::Repo::El/Yumrepo[jenkins]/descr: descr changed '' to 'Jenkins'\n    notice: /Stage[main]/Jenkins::Repo::El/Yumrepo[jenkins]/baseurl: baseurl changed '' to 'http://pkg.jenkins-ci.org/redhat/'\n    notice: /Stage[main]/Jenkins::Repo::El/Yumrepo[jenkins]/gpgcheck: gpgcheck changed '' to '1'\n    notice: /Stage[main]/Jenkins::Repo::El/File[/etc/yum/jenkins-ci.org.key]/ensure: defined content as '{md5}9fa06089848262c5a6383ec27fdd2575'\n    notice: /Stage[main]/Jenkins::Repo::El/Exec[rpm --import /etc/yum/jenkins-ci.org.key]/returns: executed successfully\n    notice: /Stage[main]/Jenkins::Package/Package[jenkins]/ensure: created\n    notice: /Stage[main]/Jenkins::Service/Service[jenkins]/ensure: ensure changed 'stopped' to 'running'\n    notice: Finished catalog run in 27.46 seconds\n\n### Overriding the jenkins package name\nIt's possible to specify a different package name to the default `jenkins` if you wish:\n```\nclass { 'jenkins':\n  package_name =\u003e 'jenkins_custom',\n}\n```\n\n### Installing from a hosted RPM\nSometimes you don't have an RPM repository available and are not allowed to\ndirectly install from repositories on the Internet.  In this case, you can\nstill install Jenkins with this module by hosting the jenkins RPM file\nsomewhere accessible (http server, S3 bucket, etc.) and tell\n\n```\nclass { 'jenkins':\n  direct_download =\u003e 'http://myserver/rpms/jenkins-x.xxx-1-1.rpm',\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpupuli%2Fpuppet-jenkins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoxpupuli%2Fpuppet-jenkins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpupuli%2Fpuppet-jenkins/lists"}