wcm-io-devops / ansible-jenkins-plugins

Ansible role for maintaining plugins on Jenkins instances
Apache License 2.0
5 stars 12 forks source link

failed to load! {'job-dsl': {'cause': 'Failed to load: Job DSL (job-dsl 1.78.3)\n - Plugin is missing: structs (1.19)\n - Plugin is missing: cloudbees-folder (5.14) #13

Closed patsevanton closed 2 years ago

patsevanton commented 2 years ago

Hello! Thanks a lot of ansible-jenkins-plugins!

I try install and configure jenkins as code by ansible.

TASK [wcm_io_devops.jenkins_plugins : assert that there are no failed plugins.] 
fatal: [jenkins]: FAILED! => changed=false 
  assertion: jenkins_facts_plugins_failed | length == 0
  evaluated_to: false
  msg: |-
    1 plugin(s) failed to load! {'job-dsl': {'cause': 'Failed to load: Job DSL (job-dsl 1.78.3)\n - Plugin is missing: structs (1.19)\n - Plugin is missing: cloudbees-folder (5.14)'}}

Inventory

all:
  children:
    jenkins:
      hosts:
        "jenkins":
          ansible_host: "IP"
  vars:
    jenkins_casc_admin_password: XXXX
    jenkins_admin_password: XXXXX
    jenkins_hostname: "jenkins.IP.sslip.io"
    jenkins_plugins_present:
      - name: cloudbees-folder
      - name: antisamy-markup-formatter
      - name: build-timeout
      - name: credentials-binding
      - name: timestamper
      - name: ws-cleanup
      - name: ant
      - name: gradle
      - name: workflow-aggregator
      - name: github-branch-source
      - name: pipeline-github-lib
      - name: pipeline-stage-view
      - name: git
      - name: ssh-slaves
      - name: matrix-auth
      - name: pam-auth
      - name: ldap
      - name: email-ext
      - name: mailer

playbook.yml

- name: "Deploy java, jenkins, letsencrypt, nginx"
  hosts: jenkins
  become: true
  roles:
    - role: robertdebock.java
    - role: geerlingguy.jenkins

- name: "Deploy jcasc"
  hosts: jenkins
  become: true
  vars:
    jenkins_casc_config_path_configure: true
    jenkins_casc_config_path: "/var/lib/jenkins/jcasc-folder"
    jenkins_casc_config_fileglobs:
        - file/jcasc/*.yml
        - file/jcasc/*.yaml
  roles:
    - wcm_io_devops.jenkins_configuration_as_code

*file/jcasc/.yml**

jenkins:
  systemMessage: "Jenkins configured automatically by Jenkins Configuration as Code plugin\n\n"
  globalNodeProperties:
  - envVars:
      env:
      - key: VARIABLE1
        value: foo
      - key: VARIABLE2
        value: bar
tobias-richter commented 2 years ago

@patsevanton as already mentioned in #12 you have to specify missing plugins explicitely. See also https://docs.ansible.com/ansible/2.9/modules/jenkins_plugin_module.html especially the with_dependencies option. When specifying a version you have to take care about the dependencies. Closing this because this is not an issue in our role.