stouts / stouts.jenkins Goto Github PK
View Code? Open in Web Editor NEWAnsible role which manage Jenkins CI
License: MIT License
Ansible role which manage Jenkins CI
License: MIT License
Hi,
Im getting:
fatal: [tooling-live] => input file not found at [...]/Stouts.jenkins/vars/Debian-wily.yml or [...]/Debian-wily.yml
When trying to run against my Ubuntu Wily box AWS ami id: ami-9d9926ee
perhaps you could default the vars file used with smth like:
with_first_found:
- files:
- {{ ansible_distribution }}.yml
- default.yml
in https://github.com/Stouts/Stouts.jenkins/blob/develop/tasks/main.yml#L7
Ive manually changed the role to point to Debian-wheezy.yml
and the role works as expected...
Thanks
Ref to discussion with mpdehaan.
I'm using Ansible v1.9.0.1.
Errors are occurring after restart handler is called. Looking into the handlers, I see multiple handlers with the same name. Although this might have worked at one time, it seems as if it's unsupported and may not work any more. I think it may be necessary to name them differently and chain them manually as shown in the above-mentioned discussion.
NOTIFIED: [Stouts.jenkins | jenkins restart] **********************************
changed: [jenkins.example.com]
NOTIFIED: [Stouts.jenkins | jenkins reload configuration] *********************
failed: [jenkins.example.com] => {"changed": true, "cmd": ["java", "-jar", "/var/lib/jenkins/jenkins-cli.jar", "-noKeyAuth", "-s", "http://jenkins.example.com:8080/", "reload-configuration"], "delta": "0:00:00.285201", "end": "2015-07-21 17:56:28.045029", "rc": 1, "start": "2015-07-21 17:56:27.759828", "warnings": []}
stderr: Exception in thread "main" java.io.IOException: Failed to connect to http://jenkins.example.com:8080/
...
Hi!
I just tried this plugin and it looks great thanks.
I'm having a problem when configuring jobs. The role is failing because here, job.chucknorris
is undefined. Shouldn't a default False
value be provided?
When changing a Jenkins job in an ansible run where the jenkins_prefix
is different than the default, the job.sh
template will fail. Here I paste the error:
RUNNING HANDLER [Stouts.jenkins : jenkins update jobs] *************************
failed: [192.168.230.3] => (item={u'src': u'/home/vagrant/.ansible/tmp/ansible-tmp-1455289178.34-170283538283404/source', u'md5sum': u'7c1cd3484a86437b322f1e4c8c375a5e', u'group': u'jenkins', u'uid': 104, u'dest': u'/var/lib/jenkins/jobs/python-nfon-api.xml', u'checksum': u'def52c32ed36b4bfb02b1659c1d2ef4f9c195b08', 'changed': True, u'owner': u'jenkins', '_ansible_no_log': False, 'item': {u'name': u'python-nfon-api', u'template': u'roles/nfon.ci/files/python-nfon-api.xml'}, u'state': u'file', u'gid': 106, u'mode': u'0644', 'invocation': {u'module_args': {u'src': u'/home/vagrant/.ansible/tmp/ansible-tmp-1455289178.34-170283538283404/source', u'directory_mode': None, u'force': True, u'remote_src': None, u'dest': u'/var/lib/jenkins/jobs/python-nfon-api.xml', u'selevel': None, u'seuser': None, u'setype': None, u'group': u'jenkins', u'content': None, u'serole': None, u'original_basename': u'python-nfon-api.xml', u'delimiter': None, u'mode': None, u'regexp': None, u'owner': u'jenkins', u'follow': True, u'validate': None, u'backup': False}}, '_ansible_notify': [u'jenkins check web ready', u'jenkins check cli ready', u'jenkins update jobs'], u'size': 2338}) => {"changed": true, "cmd": ["/var/lib/jenkins/jobs/job.sh", "python-nfon-api"], "delta": "0:00:00.149526", "end": "2016-02-12 14:59:43.204369", "failed": true, "item": {"_ansible_no_log": false, "_ansible_notify": ["jenkins check web ready", "jenkins check cli ready", "jenkins update jobs"], "changed": true, "checksum": "def52c32ed36b4bfb02b1659c1d2ef4f9c195b08", "dest": "/var/lib/jenkins/jobs/python-nfon-api.xml", "gid": 106, "group": "jenkins", "invocation": {"module_args": {"backup": false, "content": null, "delimiter": null, "dest": "/var/lib/jenkins/jobs/python-nfon-api.xml", "directory_mode": null, "follow": true, "force": true, "group": "jenkins", "mode": null, "original_basename": "python-nfon-api.xml", "owner": "jenkins", "regexp": null, "remote_src": null, "selevel": null, "serole": null, "setype": null, "seuser": null, "src": "/home/vagrant/.ansible/tmp/ansible-tmp-1455289178.34-170283538283404/source", "validate": null}}, "item": {"name": "python-nfon-api", "template": "roles/nfon.ci/files/python-nfon-api.xml"}, "md5sum": "7c1cd3484a86437b322f1e4c8c375a5e", "mode": "0644", "owner": "jenkins", "size": 2338, "src": "/home/vagrant/.ansible/tmp/ansible-tmp-1455289178.34-170283538283404/source", "state": "file", "uid": 104}, "rc": 255, "start": "2016-02-12 14:59:43.054843", "stderr": "java.io.IOException: There's no Jenkins running at http://0.0.0.0:8080/\n\tat hudson.cli.CLI.getCliTcpPort(CLI.java:288)\n\tat hudson.cli.CLI.(CLI.java:128)\n\tat hudson.cli.CLIConnectionFactory.connect(CLIConnectionFactory.java:72)\n\tat hudson.cli.CLI._main(CLI.java:479)\n\tat hudson.cli.CLI.main(CLI.java:390)\n\tSuppressed: java.io.FileNotFoundException: http://0.0.0.0:8080/cli\n\t\tat sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1835)\n\t\tat sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)\n\t\tat hudson.cli.FullDuplexHttpStream.(FullDuplexHttpStream.java:78)\n\t\tat hudson.cli.CLI.connectViaHttp(CLI.java:158)\n\t\tat hudson.cli.CLI.(CLI.java:132)\n\t\t... 3 more", "stdout": "", "stdout_lines": [], "warnings": []}
I think this is fixed changing the L4 job.sh.j2
to
export CLI="java -jar {{jenkins_home}}/jenkins-cli.jar {{jenkins_cli_extra_opts}} -s {{ jenkins_url }}{{ jenkins_prefix }}"
Right now it isnt clear that the nginx or apache servers arent going to be installed. If there is a good reason to not install them, perhaps the documentation can be clearer about this?
When running ansible with -b (become, or sudo), the error is "Failed to set permissions on the temporary files Ansible needs to create when becoming an unprivileged user. For information on working around this, see https://docs.ansible.com/ansible/become.html#becoming-an-unprivileged-user"
I personally am going through a bunch of old roles I have in my playbooks and either throwing them away or rewriting them if they require -b to work. Please feel free to close this issue if it's just The Wrong Way to do it. But perhaps adding something to the README that gently reminds people to not use -b, and write all their roles to sudo when necessary? Also I find the line "The role needs a root access to run. Add sudo: yes in your playbook." in the readme to be deprecated, as I notice that this role has been rewritten to sudo when necessary.
ERROR: apache2_module is not a legal parameter in an Ansible task or handler
Install from ansible-galaxy give version 3.2.0? It Is last stable version? Thanks.
Hello,
I have a strange behavior :
I'm trying to access some url like :
https://myjenkins/login
=> it works
I login, then, 404 not found on :
https://myjenkins/j_acegi_security_check
Also, a 404 not found on /bitbucket-hook url. I tried a curl on http://127.0.0.1:8000/j_acegi_security_check (or bitbucket-webhook), but got a 404 too even if I'm bypassing the reverse proxy.
Any idea please ?
Here are the parameters used for the role :
jenkins_proxy: nginx
jenkins_proxy_hostname: myjenkins
jenkins_proxy_port: 80
jenkins_plugins:
- build-pipeline-plugin
- packer
- bitbucket
- bitbucket-approve
- Parameterized-Remote-Trigger
- slack
- ssh-agent
I am using this role to setup nginx as a reverse proxy, and I am getting https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+says+my+reverse+proxy+setup+is+broken
Hi,
This role doesn't seem to install jenkins to jenkins_home
as expected.
First of all, I'm a fan of this ansible role already, thanks for this.
It would be nice to be able to specify the contents of the SSH key in a variable so that it can be stored in an yml encrypted with ansible-vault. Maybe as an option to specify either the file or the contents of the file?
When changing a Jenkins job in an ansible run where the jenkins_prefix
is different than the default, the job.sh
template will fail, as it still tries to connect to / instead of the new url. Here I paste the error:
RUNNING HANDLER [Stouts.jenkins : jenkins update jobs] *************************
failed: [192.168.230.3] => (item={u'src': u'/home/vagrant/.ansible/tmp/ansible-tmp-1455289178.34-170283538283404/source', u'md5sum': u'7c1cd3484a86437b322f1e4c8c375a5e', u'group': u'jenkins', u'uid': 104, u'dest': u'/var/lib/jenkins/jobs/python-nfon-api.xml', u'checksum': u'def52c32ed36b4bfb02b1659c1d2ef4f9c195b08', 'changed': True, u'owner': u'jenkins', '_ansible_no_log': False, 'item': {u'name': u'python-nfon-api', u'template': u'roles/nfon.ci/files/python-nfon-api.xml'}, u'state': u'file', u'gid': 106, u'mode': u'0644', 'invocation': {u'module_args': {u'src': u'/home/vagrant/.ansible/tmp/ansible-tmp-1455289178.34-170283538283404/source', u'directory_mode': None, u'force': True, u'remote_src': None, u'dest': u'/var/lib/jenkins/jobs/python-nfon-api.xml', u'selevel': None, u'seuser': None, u'setype': None, u'group': u'jenkins', u'content': None, u'serole': None, u'original_basename': u'python-nfon-api.xml', u'delimiter': None, u'mode': None, u'regexp': None, u'owner': u'jenkins', u'follow': True, u'validate': None, u'backup': False}}, '_ansible_notify': [u'jenkins check web ready', u'jenkins check cli ready', u'jenkins update jobs'], u'size': 2338}) => {"changed": true, "cmd": ["/var/lib/jenkins/jobs/job.sh", "python-nfon-api"], "delta": "0:00:00.149526", "end": "2016-02-12 14:59:43.204369", "failed": true, "item": {"_ansible_no_log": false, "_ansible_notify": ["jenkins check web ready", "jenkins check cli ready", "jenkins update jobs"], "changed": true, "checksum": "def52c32ed36b4bfb02b1659c1d2ef4f9c195b08", "dest": "/var/lib/jenkins/jobs/python-nfon-api.xml", "gid": 106, "group": "jenkins", "invocation": {"module_args": {"backup": false, "content": null, "delimiter": null, "dest": "/var/lib/jenkins/jobs/python-nfon-api.xml", "directory_mode": null, "follow": true, "force": true, "group": "jenkins", "mode": null, "original_basename": "python-nfon-api.xml", "owner": "jenkins", "regexp": null, "remote_src": null, "selevel": null, "serole": null, "setype": null, "seuser": null, "src": "/home/vagrant/.ansible/tmp/ansible-tmp-1455289178.34-170283538283404/source", "validate": null}}, "item": {"name": "python-nfon-api", "template": "roles/nfon.ci/files/python-nfon-api.xml"}, "md5sum": "7c1cd3484a86437b322f1e4c8c375a5e", "mode": "0644", "owner": "jenkins", "size": 2338, "src": "/home/vagrant/.ansible/tmp/ansible-tmp-1455289178.34-170283538283404/source", "state": "file", "uid": 104}, "rc": 255, "start": "2016-02-12 14:59:43.054843", "stderr": "java.io.IOException: There's no Jenkins running at http://0.0.0.0:8080/\n\tat hudson.cli.CLI.getCliTcpPort(CLI.java:288)\n\tat hudson.cli.CLI.(CLI.java:128)\n\tat hudson.cli.CLIConnectionFactory.connect(CLIConnectionFactory.java:72)\n\tat hudson.cli.CLI._main(CLI.java:479)\n\tat hudson.cli.CLI.main(CLI.java:390)\n\tSuppressed: java.io.FileNotFoundException: http://0.0.0.0:8080/cli\n\t\tat sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1835)\n\t\tat sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)\n\t\tat hudson.cli.FullDuplexHttpStream.(FullDuplexHttpStream.java:78)\n\t\tat hudson.cli.CLI.connectViaHttp(CLI.java:158)\n\t\tat hudson.cli.CLI.(CLI.java:132)\n\t\t... 3 more", "stdout": "", "stdout_lines": [], "warnings": []}
I think this is fixed changing the L4 job.sh.j2
to
export CLI="java -jar {{jenkins_home}}/jenkins-cli.jar {{jenkins_cli_extra_opts}} -s {{ jenkins_url }}{{ jenkins_prefix }}"
in configure.yml
get_url should be as below (missing prefix)
- name: jenkins-configure | Copy jenkins-cli
get_url: url=http://localhost:{{jenkins_http_port}}{{ jenkins_prefix }}/jnlpJars/jenkins-cli.jar dest={{jenkins_home}}/jenkins-cli.jar
I got this error using your role with ansible 1.7.2
TASK: [Stouts.jenkins | jenkins-ssh | Copy private key pt. 1] *****************
fatal: [192.168.1.*] => error while evaluating conditional: /tmp/ssh/id_rsa
I had to update relevant conditional to
when: jenkins_ssh_key_file is defined
I run this on ubuntu 15.04
ansible-playbook -i localhost -c local jenkins.yml
Here is the jenkins.yml playbook
- hosts: localhost
roles:
- role: Stouts.nginx
- role: Stouts.jenkins
sudo: yes
vars:
jenkins_proxy: nginx
jenkins_proxy_hostname: jenkins.redacted.com
jenkins_ssh_key_file: "files/ssh_key/redacted-bot"
jenkins_jobs:
- name: mixer
repo: https://github.com/klen/mixer.git
command: make test
And the result is:
PLAY [localhost]
GATHERING FACTS
ok: [localhost]
TASK: [Stouts.nginx | Install dependencies] ***********************************
ok: [localhost]
TASK: [Stouts.nginx | Add nginx repository] ***********************************
ok: [localhost]
TASK: [Stouts.nginx | Install Dependencies] ***********************************
ok: [localhost] => (item=nginx,python-passlib)
TASK: [Stouts.nginx | Delete default site] ************************************
skipping: [localhost]
TASK: [Stouts.nginx | Encrypt http auth passwords] ****************************
skipping: [localhost]
TASK: [Stouts.nginx | Configure nginx] ****************************************
ok: [localhost]
TASK: [Stouts.jenkins | Include OS-specific variables.] ***********************
skipping: [localhost]
TASK: [Stouts.jenkins | Include OS-specific variables.] ***********************
ok: [localhost]
TASK: [Stouts.jenkins | jenkins-install | Add apt key] ************************
ok: [localhost]
TASK: [Stouts.jenkins | jenkins-install | Add apt repo] ***********************
ok: [localhost]
TASK: [Stouts.jenkins | jenkins-install | Install jenkins] ********************
ok: [localhost] => (item=curl,jenkins)
TASK: [Stouts.jenkins | jenkins-install | Install additional deb packages] ****
skipping: [localhost]
TASK: [Stouts.jenkins | jenkins-install | Setup passlib] **********************
skipping: [localhost]
TASK: [Stouts.jenkins | jenkins-configure | Configure Jenkins Service] ********
ok: [localhost]
TASK: [Stouts.jenkins | Create home folder] ***********************************
ok: [localhost]
TASK: [Stouts.jenkins | jenkins-configure | Ensure Jenkins restarted] *********
ok: [localhost]
TASK: [Stouts.jenkins | Wait untils Jenkins web API is available] *************
failed: [localhost] => {"attempts": 10, "changed": true, "cmd": "curl --head --silent http://127.0.0.1:8000//cli/", "delta": "0:00:00.020527", "end": "2015-06-09 15:11:35.615232", "failed": true, "rc": 7, "start": "2015-06-09 15:11:35.594705", "warnings": ["Consider using get_url module rather than running curl"]}
msg: Task failed as maximum retries was encountered
FATAL: all hosts have already failed -- aborting
Hi, I am using the version from ansible galaxy, when I run it I get msg: Destination /etc/default not writable
for the jenkins-configure task. Shouldnt this be sudo: yes
? Or am I doing something wrong? This is on a ubuntu 14.04 instance.
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.