emmetog / ansible-jenkins

Ansible role to install and fully configure Jenkins CI in Docker
MIT License
105 stars 90 forks source link

Docker installation on CentOS VM fails to install plugins #40

Open nmusatti opened 5 years ago

nmusatti commented 5 years ago

Expected Behavior

My working environment is a Windows 10 PC on which I run one VirtualBox based, Vagrant controlled CentOS 7 VM as Ansible master and another one as installation target. These are configured with one NAT NIC and one Host Only NIC each. I'm running behind a firewall so I setup proxy configurations in various places. The ansible-jenkins role is included from another role which sets up the environment: installs Docker, creates the Jenkins config directory, etc. My settings are very similar to the examples from the README file:

jenkins_version: "2.73.1"
jenkins_url: "http://127.0.0.1"
jenkins_port: 8080
jenkins_install_via: "docker"
jenkins_config_owner: "vagrant"
jenkins_config_group: "vagrant"
jenkins_java_opts: "-Djenkins.install.runSetupWizard=false"
jenkins_home: /data/jenkins
jenkins_source_dir_configs: files/jenkins-configs
jenkins_source_dir_jobs: "{{ jenkins_source_dir_configs }}/jobs"
jenkins_include_custom_files: true
jenkins_custom_files:
  - src: "proxy.xml"
    dest: "proxy.xml"
jenkins_jobs:
  - "my-first-job"
jenkins_plugins:
  - git
  - log-parser
  - copyartifact
  - workflow-aggregator
  - workflow-multibranch
  - docker-workflow
  - subversion
  - template-project

I'm running Jenkins as vagrant because it has uid 1000 in my VM's. I'd expect this installation to complete successfully.

Actual Behavior

Installation fails at the wait_for task. None of the *.jpi files ever appear in the /data/jenkins/plugins/ directory. From the logs I see that all the attempts to install the specified plugins have similar results:

ok: [owf-dev-server] => (item=template-project) => {
    "changed": false, 
    "connection": "close", 
    "date": "Mon, 25 Feb 2019 11:23:59 GMT", 
    "invocation": {
        "module_args": {
            "attributes": null, 
            "backup": null, 
            "body": "<jenkins><install plugin=\"template-project@latest\" /></jenkins>", 
            "body_format": "raw", 
            "client_cert": null, 
            "client_key": null, 
            "content": null, 
            "creates": null, 
            "delimiter": null, 
            "dest": null, 
            "directory_mode": null, 
            "follow": false, 
            "follow_redirects": "safe", 
            "force": false, 
            "force_basic_auth": false, 
            "group": null, 
            "headers": {
                "Content-Type": "text/xml"
            }, 
            "http_agent": "ansible-httpget", 
            "method": "POST", 
            "mode": null, 
            "owner": null, 
            "regexp": null, 
            "remote_src": null, 
            "removes": null, 
            "return_content": false, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": null, 
            "status_code": [
                "200", 
                "302"
            ], 
            "timeout": 30, 
            "unsafe_writes": null, 
            "url": "http://127.0.0.1:8080/pluginManager/installNecessaryPlugins", 
            "url_password": null, 
            "url_username": null, 
            "use_proxy": true, 
            "validate_certs": true
        }
    }, 
    "item": "template-project", 
    "location": "http://127.0.0.1:8080/updateCenter", 
    "msg": "HTTP Error 302: Found", 
    "redirected": false, 
    "server": "Jetty(9.4.z-SNAPSHOT)", 
    "status": 302, 
    "url": "http://127.0.0.1:8080/pluginManager/installNecessaryPlugins", 
    "x_content_type_options": "nosniff"

Is it correct that location points to a localhost URI?

Steps to Reproduce the Problem

I'm afraid it's not easy to reproduce my setup, as it's rather convoluted. I'm eager to provide additional information, but I'm not sure about what could be of use.

nmusatti commented 5 years ago

I dug in a little deeper and I suspect this problem is due to the fact that I add my proxy configuration as part of the additional configuration files which are handled after plugin installation. Does this make sense?