keepmoving
keepmoving

Reputation: 2043

Where to find list of jenkins plugins for Ansible

I am using ansible and Jenkins and want to install plugin throw ansible. So for that I did following piece of code.

- name: Install Jenkins plugins using password.
  jenkins_plugin:
    name: "{{ item }}"
    jenkins_home: "{{ jenkins_home }}"
    url_username: "{{ jenkins_admin_username }}"
    url_password: "{{ jenkins_admin_password }}"
    state: "{{ jenkins_plugins_state }}"
    timeout: "{{ jenkins_plugin_timeout }}"
    updates_expiration: "{{ jenkins_plugin_updates_expiration }}"
    url: "http://{{ jenkins_hostname }}:{{ jenkins_http_port }}{{ jenkins_url_prefix }}"
    with_dependencies: "{{ jenkins_plugins_install_dependencies }}"
  **with_items: "{{ jenkins_plugins }}"**
  when: jenkins_admin_password != ""
  notify: restart jenkins
  tags: ['skip_ansible_lint']

you will see Jenkins_plugins is variable and its value is coming from one variable.yml file. where value looks like following code.

jenkins_plugins: [Git]

With this code ansible successfully installed the git plugin in Jenkins. Going forward using the same technique I want to install few more plugin for Jenkins.

Now I have two question.

  1. Where I can find the list of plugins for ansible like maven, sonar etc.

  2. I tried to installed maven using same approach and following is piece of code for that.

    jenkins_plugins: [maven;sonar] or jenkins_plugins: [maven,sonar]

But nothing is working otherthan Git plugin installation.

Upvotes: 0

Views: 679

Answers (2)

Rafik Benmansour
Rafik Benmansour

Reputation: 11

The URL to get the list of Jenkins available plugins is:

http://updates.jenkins-ci.org/download/plugins/

To install a list of plugins, you may do this:

- name: Install Jenkins plugins
  jenkins_plugin:
    name: "{{ item }}"
    jenkins_home: "{{ jenkins_home_directory }}"
    url_username: "admin_username"
    url_password: "admin_password"
    state: present
    with_dependencies: yes
  with_items:
    - git
    - maven

Upvotes: 0

clockworknet
clockworknet

Reputation: 3046

Where I can find the list of plugins for ansible like maven, sonar etc.

I am not entirely sure what you mean by 'plugins for ansible'. As far as I understand your question, you are looking for a list of plugins for Jenkins. Getting the right name to use with Ansible, can be tricky. I find the easiest way is to simply install the plugin manually and then look inside the 'plugins' directory in your Jenkins install and then look for the name of the directory that contains the relevant plugin - that will be the name to pass to Ansible.

Based on the code you have supplied, you are having problems installing the other plugins because you are not formatting a list correctly and not using the right names. Try this:

jenkins_plugins:
  - git
  - maven-plugin

or

jenkins_plugins: [git, maven-plugin]

(We don't have the Sonar plugin installed, and I am not sure which specific plugin you are referring to, so have left off the example above)

(Also assuming that the two stars in front of 'with_items' is a typo. If not, remove them and make sure that 'with_items', lines up with 'jenkins_plugin')

Upvotes: 1

Related Questions