How to automate the configuration of LDAP and other plugins for Jenkins using ansible or some other tool - jenkins

I am working on a project where I need to automate the LDAP and other plugin configuration without manual intervention .Is this possible using Ansible?Or can experts some one suggest a better way to do it.Thank you

The recommended approach for configuring plugins is JCasC. You must inatall the JCasC plugin. LDAP plugin supports JCasC.
Note: JCasC does not manage the installation of plugins themselves, that's a separate topic, just the configuration.

Related

JiraTestResultReporter configuration not showed in Jsac Configuration-as-code plugin

We are using Jenkins Jcasc to deploy and configure jenkins. This is working fine, with every deployment all required plugins and
integration of different tools with credentials is working fine. I want to add JiraTestReusltReporter configuration using Jcasc. But the details regarding this tool is not found in Configuration as Code.
Go to Manage Jenkins->ConfigureSysytem->Add JiraTestResultReporter details and save it.
Go to Manage Jenkins->Configuration as Code
Here, I would like to know How JiraTestReusltReporter configuration saved, But the details are not showed here.
How do I add JiraTestResultReporter configuration details in Jcasc.
Thanks.

There is no AWS Codedeploy Plugin in Jenkins

I use two different Jenkins servers(tomcat jenkins) and i was trying to install a plugin for aws codedeploy.
However, I couldn't find it in the list of a Jenkins but another one has it.
Why the plugin libraries are different? even though i install them in a same way.
Also, How can i add a particular plugin in my Jenkins server?
Thank you.
Why the plugin libraries are different?
The plugin libraries shouldn't be different.
Which way did you search the plugin (jenkins gui, in the web)? Both your servers are on the same Jenkins version?
Also, How can i add a particular plugin in my Jenkins server?
I do it always via the GUI as described here: https://jenkins.io/doc/book/managing/plugins/

How to use configuration management to configure Jenkins?

I am looking for a way to add/remove/update Jenkins master environment variables using some way of configuration management.
If this can be done with Ansible even better.
Please note that I would like to avoid patching the config.xml file manually, especially because this would risk to create issues and a Jenkins restart would be required and this is to be avoided whenever is possible.
In case it was not clear, I am trying to find an automation solution for altering Manage Jenkins - Configure System - Global properties.
you can configure all your Jenkins master using groovy.
I just did the same when we upgrade to Jenkins 2.
here are some links : https://pghalliday.com/jenkins/groovy/sonar/chef/configuration/management/2014/09/21/some-useful-jenkins-groovy-scripts.html
https://github.com/DotCi/jenkinsci-dotci-example/blob/master/configure-dotci.groovy
https://gist.github.com/vrivellino/97954495938e38421ba4504049fd44ea
BTW , you can install your plugins using CLI it will save you time in the future.
and you can create all your jobs using DSL , so all changes will be in github.
if you have specific question , let me know

Jenkings on DCOS - Marathon-plugin missing after install

I added the Marathon plugin to Jenkins through the Jenkins management Web UI. It showed up as a list of available plugins to install. I also downloaded the HPI and added the plugin manually. In both cases, the Marathon option doesn't show up in my pipeline config. I'm following the steps here: https://dcos.io/docs/1.7/usage/tutorials/jenkins/#building-a-docker-image-and-deploying-it-to-marathon
Use version mesosphere/jenkins:3.0.1-2.32.2 in combination with persisting your Jenkins data on NFS. Installation and updates of plugins works for me with this combination.
You should consider missing functionality in older versions of Jenkins in DC/OS as described in this thread: https://github.com/mesosphere/dcos-jenkins-service/issues/105
Do you use a NFS share to persist your Jenkins data? In my experience you can not use DC/OS Jenkins properly without persisting Jenkins' data.

Using Jenkins CLI to configure plugins

I am working on installing and configuring Jenkins automatically using the Jenkins CLI. I am able to install plugins such as the Active Directory plugin, but haven't figured out how to configure it. Is it possible to perform such tasks from the CLI? From a Jenkins GUI standpoint, I'd like to check the Enable security checkbox under Security Realm check the Active Directory option, provide parameters to Active Directory, and under Authorization check the Anyone can do anything option.
I'm using a Puppet module (https://forge.puppetlabs.com/rtyler/jenkins) for the automation.
Greetings,
Kenneth
If you want to modify their configuration files manually using scripts called from the CLI, then yes.
Else, I don't believe there is. At least, not a general way for all plugins. Plugins are capable of adding CLI commands, as per this documentation page:
https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI
Extending CLI
Plugins installed on Jenkins server can add custom CLI commands. See Writing CLI commands for more details.
So, some of the plugins you're using may have specific commands to configure them from the CLI.
So as far as I know those are your options. Manual configuration through editing their config files, or hoping your plugin includes some commands in the CLI that is specific to it.
There is currently a new Plugin in development called "Configuration as Code Plugin" to provide a way for configuration of plugins using YAML: https://github.com/jenkinsci/configuration-as-code-plugin/
They are currently in an early development stage but this could help solve this kind of problem.

Resources