icto / ansible-jenkins Goto Github PK
View Code? Open in Web Editor NEWAnsible playbook: Jenkins
License: MIT License
Ansible playbook: Jenkins
License: MIT License
Hi can we refactor to use custom port instead of default 8080.
Thanks.
Please add such information. I want to use it for some of my projects. Thanks!
I have the role configured and running correctly, but when I get to the get jenkins update task, I get the following failure
I can ssh into vagrant and directly curl that URL, so little confused whats failing. I am able to connect both in and out of the VM to and pull the update json via curl
TASK: [ansible-jenkins | Get Jenkins updates] *********************************
failed: [127.0.0.1] => {"failed": true}
msg: Failed to connect to updates.jenkins-ci.org:443.
Any suggestions would be appreciated, and thanks!
When running this role
fatal: [192.168.33.10]: FAILED! => {"changed": false, "cmd": "apt-get update", "failed": true, "msg": "[Errno 2] No such file or directory", "rc": 2}
on CentOS 6 and ansible 2.1.0.0
when trying to run the jenkins cli in plugins.yml, i get an error about authentication
ERROR: You must authenticate to access this Jenkins.
Use --username/--password/--password-file parameters or login command.
i have tried using admin with locally stored admin password to no avail. how did you work around this or fix?
TASK [flyapen.jenkins : Install dependencies] **********************************
[DEPRECATION WARNING]: Using bare variables is deprecated. Update your
playbooks so that the environment value uses the full variable syntax
('{{jenkins.deb.dependencies}}').
This feature will be removed in a future
release. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
And maybe a few more ...
I guess this all due to Jenkins 2.0 being released. Looks like there is a lot more changes...
Was probably intermittent - and the old links work again ....
The "Restart Jenkins" handler uses {{ jenkins.cli_dest }} to restart the service which assumes that the client is running on the server. This is not strictly necessary though and a Jenkins server can exist without having a client running on it. So, it might be preferable to define the handler as:
- name: Restart Jenkins
sudo: True
service: name=jenkins state=restarted
I have Jenkins' own database authentication turned on with matrix based security and the ansible script can't install extensions or restart Jenkins:
failed: [10.0.0.10] => {"changed": true, "cmd": ["java", "-jar", "/opt/jenkins/jenkins-cli.jar", "-s", "http://localhost:8080", "safe-restart"], "delta": "0:00:00.866460", "end": "2014-12-10 15:55:43.202089", "rc": 1, "start": "2014-12-10 15:55:42.335629"}
stderr: hudson.security.AccessDeniedException2: anonymous is missing the Overall/Read permission
Could we have the ability to provide a username and password to use for these commands? This, and/or public key auth:
https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI#JenkinsCLI-WorkingwithCredentials
AWS EC2
Ubuntu 16.04
ansible 2.2.0
failed: [50.16.73.148](item=[u'openjdk-7-jre', u'openjdk-7-jdk', u'git', u'curl']) => {"failed": true, "item": ["openjdk-7-jre", "openjdk-7-jdk", "git", "curl"], "msg": "No package matching 'openjdk-7-jre' is available"}
Ubuntu 16.04
Jenkins 2.19.1
I was running into a problem starting the Jenkins service.
Running from: /usr/share/jenkins/jenkins.war
Oct 09, 2016 7:02:16 AM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Logging initialized @631ms
Oct 09, 2016 7:02:16 AM winstone.Logger logInternal
INFO: Beginning extraction from war file
Oct 09, 2016 7:02:16 AM org.eclipse.jetty.util.log.JavaUtilLog warn
WARNING: Empty contextPath
Oct 09, 2016 7:02:16 AM winstone.Logger logInternal
INFO: Winstone shutdown successfully
Oct 09, 2016 7:02:16 AM winstone.Logger logInternal
SEVERE: Container startup failed
java.io.IOException: Failed to start a listener: winstone.Ajp13ConnectorFactory
at winstone.Launcher.spawnListener(Launcher.java:207)
at winstone.Launcher.<init>(Launcher.java:148)
at winstone.Launcher.main(Launcher.java:352)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at Main._main(Main.java:246)
at Main.main(Main.java:91)
Caused by: java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:592)
at java.lang.Integer.parseInt(Integer.java:615)
at winstone.cmdline.Option.intArg(Option.java:291)
at winstone.cmdline.Option$OInt.get(Option.java:203)
at winstone.Ajp13ConnectorFactory.start(Ajp13ConnectorFactory.java:24)
at winstone.Launcher.spawnListener(Launcher.java:205)
... 8 more
To get Jenkins to start I went into /etc/default/jenkins
and removed the --ajp13Port=$AJP_PORT
from JENKINS_ARGS
. The $AJP_PORT
variable does not exist in the current file. The JENKINS_ARGS
value is set in the config.yml
https://github.com/ICTO/ansible-jenkins/blob/development/tasks/config.yml#L39
I had some trouble running Jenkins under Ubuntu 16.04 with systemd. This seems to have been resolved by creating a systemd service file at /etc/systemd/system/jenkins.service
:
[Unit]
Description=Jenkins Daemon
[Service]
Environment="JENKINS_HOME=/var/lib/jenkins"
ExecStart=/usr/bin/java -jar /usr/share/jenkins/jenkins.war
User=jenkins
[Install]
WantedBy=multi-user.target
(This is cobbled together and there may well be some extra bits needed, but it seems to be working for me)
Run on ubuntu xenial -
TASK [flyapen.jenkins : Install/update plugins] ********************************
task path: /mnt/mmcblk0p1/tmp/work/xvt-dpe-cloud-infrastructure-stream2/roles/flyapen.jenkins/tasks/plugins.yml:7
failed: [13.54.197.74] (item=plugins) => {"changed": true, "cmd": "java -jar /opt/jenkins/jenkins-cli.jar -s http://localhost:8081 install-plugin plugins", "delta": "0:00:00.690971", "end": "2017-01-14 11:07:45.015734", "failed": true, "item": "plugins", "rc": 6, "start": "2017-01-14 11:07:44.324763", "stderr": "\nERROR: anonymous is missing the Overall/Read permission", "stdout": "", "stdout_lines": [], "warnings": []}
This role seems primarily focused on configuring the master. What would be my best path forward for setting up slaves on other boxes?
Hi,
I was trying to set up a requirements.txt file for ansible roles and found that I either suck at searching or this role is not uploaded on galaxy.ansible.com. Is there any reason not to do so? If not, could someone register it there?
Thanks in advance!
Pretty simple reason, really: the last line of the /etc/default/jenkins
file is this:
JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT"
To fix this, that line just has to be modified to this:
JENKINS_ARGS="--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT --prefix=$PREFIX"
So I'm using this plugin via Vagrant (created an ansible/roles directory; my .yml that includes the ansible-jenkins role is in ansible. Vagrant file is in .)
I see the following:
TASK: [ansible-jenkins | Get Jenkins CLI] *************************************
failed: [build] => {"dest": "/opt/jenkins/jenkins-cli.jar", "failed": true, "response": "HTTP Error 503: Service Unavailable", "state": "absent", "status_code": 503, "url": "http://localhost:8080/jnlpJars/jenkins-cli.jar"}
msg: Request failed
Seems to be failing here where you get the CLI jar file from the running Jenkins instance:
# Get Jenkins CLI from localhost
- name: Get Jenkins CLI
sudo: yes
action: get_url url=http://localhost:8080/jnlpJars/jenkins-cli.jar dest={{ jenkins.cli_dest }} mode=0440
Not sure if something is different with the new Jenkins version... leaving work right now but I'll try to figure this out when I get home and get up a patch.
Hi,
i tried changing the default installation directory to /opt/jenkins, but the installation defaulted to /var/lib/jenkins
how to change the installation directory?
Hi, thanks @flyapen for releasing on ansible galaxy, unfortunately the release you pushed there is quite old (commit b311158), could you make a new tag targeting current development branch?
Hi,
I'm using cntlm (127.0.0.1:3128) to connect to the corporate proxy.
rpm_key and get_url commands do not work behind a proxy. I've to manually or use wget to download the key and deploy.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.