Hakeem Baba
Hakeem Baba

Reputation: 707

How to automate the activation of role-based strategy plugin in jenkins

I am working to automate the installation and use of the role-based strategy plugin in Jenkins using ansible. At the moment I can easily install the plugin using the API. However, in order to use the plugin, it is necessary to activate it through the Jenkins UI by clicking 'Manage Jenkins, then Configure System and selecting a role-based strategy. I am having difficulty automating the activation process since it seems an API does not exist in Jenkins for that. This is my relevant ansible code

- name: Install a role based plugin if it does not exist
  uri:
    url: "http://localhost:8080/pluginManager/installNecessaryPlugins"
    method: POST
    user: admin
    password: bd7afbedc842418fb7fc27fdf8b3d2e4
    force_basic_auth: yes
    body: '<jenkins><install plugin="[email protected]" /></jenkins>'
    headers:
      Content-Type: "text/xml"
    follow_redirects: all  
  when: "'Role-based Authorization Strategy' not in plugins_output_list.content"
  ignore_errors: yes

After installing the plugin, is there a way I can activate it without using the UI? I really can't see any API for that purpose.

Upvotes: 1

Views: 1523

Answers (1)

Edison LightBulb
Edison LightBulb

Reputation: 1

Your answer is here.

Configure ALL Jenkins initial setup Fully working Jenkins master with:

no hands on keyboard

no click on UI

Upvotes: -2

Related Questions