Jenkins - 通过 Ansible 或 CLI 安装推荐的插件

Jenkins - Install recommended plugins via Ansible or CLI

有没有办法在使用 Ansible 时安装 Jenkins 推荐的插件(通过向导安装时显示)?

我什至开始在我的 Ansible YML 中创建列表,但它很长而且名称有时与存储库列表不匹配here

- name: Install plugin
    community.general.jenkins_plugin:
      name: "{{ item }}"
      url_username: "{{ jenkins_admin_username }}"
      url_password: "{{ jenkins_admin_password }}"
      url: http://localhost:8080
      timeout: 90
    with_items:
      - git
      - maven
      - thinbackup
      - build-pipeline-plugin
      - trilead-api
      - ant

通过 CLI 的解决方案也可以正常工作。 谢谢!

Here 包含推荐插件的列表。

- name: Install plugin
        community.general.jenkins_plugin:
          name: "{{ item }}"
          url_username: "{{ jenkins_admin_username }}"
          url_password: "{{ jenkins_admin_password }}"
          url: http://localhost:8080
          timeout: "{{ jenkins_plugins_timeout }}"
          state: latest
        with_items:  
          - ace-editor
          - ant
          - antisamy-markup-formatter
          - apache-httpcomponents-client-4-api
          - bootstrap4-api
          - bootstrap5-api
          - bouncycastle-api
          - branch-api
          - build-timeout
          - caffeine-api
          - checks-api
          - cloudbees-folder
          - command-launcher
          - credentials
          - credentials-binding
          - display-url-api
          - durable-task
          - echarts-api
          - email-ext
          - font-awesome-api
          - git
          - git-client
          - git-server
          - github
          - github-api
          - github-branch-source
          - gradle
          - handlebars
          - jackson2-api
          - jaxb
          - jdk-tool
          - jjwt-api
          - jquery3-api
          - jsch
          - junit
          - ldap
          - lockable-resources
          - mailer
          - matrix-auth
          - matrix-project
          - momentjs
          - okhttp-api
          - pam-auth
          - pipeline-build-step
          - pipeline-github-lib
          - pipeline-graph-analysis
          - pipeline-input-step
          - pipeline-milestone-step
          - pipeline-model-api
          - pipeline-model-definition
          - pipeline-model-extensions
          - pipeline-rest-api
          - pipeline-stage-step
          - pipeline-stage-tags-metadata
          - pipeline-stage-view
          - plain-credentials
          - plugin-util-api
          - popper-api
          - popper2-api
          - resource-disposer
          - scm-api
          - script-security
          - snakeyaml-api
          - ssh-credentials
          - ssh-slaves
          - sshd
          - structs
          - timestamper
          - token-macro
          - trilead-api
          - workflow-aggregator
          - workflow-api
          - workflow-basic-steps
          - workflow-cps
          - workflow-cps-global-lib
          - workflow-durable-task-step
          - workflow-job
          - workflow-multibranch
          - workflow-scm-step
          - workflow-step-api
          - workflow-support
          - ws-cleanup

无法与 Ansible 部分对话,因为我不使用它,尽管确实有 Ansible 模块可以帮助您:community.general.jenkins_plugin – Add or remove Jenkins plugin

recommended plugins is found in GitHub的主列表;这就是 UI 的来源。

推荐的安装插件的 CLI 工具是 Plugin Installation Manager Tool for Jenkins

CLI 工具可以检索与您拥有的 Jenkins 版本或特定版本兼容的最新版本。

我不知道 Ansible 模块是否处理依赖插件,但 CLI 和 UI 可以。