small rework
This commit is contained in:
parent
525c41bc88
commit
319c3bfb1c
4 changed files with 27 additions and 6 deletions
|
@ -57,10 +57,12 @@ adapt.
|
|||
## TODO
|
||||
|
||||
- stop execution if host is running an untested system ?
|
||||
- use jenkins-cli to maintain credentials.xml ? It's not really easy to manipulate in Ansible at the moment...
|
||||
- lookup more throroughfully at [configuration as code plugin](https://plugins.jenkins.io/configuration-as-code/)
|
||||
- update plugins, or at least display a warning when they are not up to date.
|
||||
- integrate docker-plugin nicely
|
||||
- lookup more throroughfully at [configuration as code plugin](https://plugins.jenkins.io/configuration-as-code/)
|
||||
- test [Job DSL](https://plugins.jenkins.io/job-dsl/) (but jenkins-php.org gives only the .xml and job-dsl can't yet generate the groovy code of an existing job)
|
||||
- use jenkins-cli to maintain credentials.xml ? It's not really easy to manipulate in Ansible at the moment...
|
||||
|
||||
|
||||
## License
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
---
|
||||
|
||||
- name: restart jenkins
|
||||
service: name=jenkins state=restarted
|
||||
|
||||
# Avoid to use this one as it doesn't wait for Jenkins to be ready
|
||||
# and thus, next invocation of jenkins-cli may fail.
|
||||
- name: safe-restart jenkins
|
||||
shell: "{{ jenkins_cli_command }} safe-restart"
|
||||
|
||||
|
@ -10,5 +9,9 @@
|
|||
- name: safe-restart jenkins and wait
|
||||
import_tasks: roles/jenkins-php-v1/tasks/include_saferestartandwait.yml
|
||||
|
||||
# As of now (Ansible 2.7.7), Ansible doesn't support blocks in handlers
|
||||
- name: system restart jenkins and wait
|
||||
import_tasks: roles/jenkins-php-v1/tasks/include_restartandwait.yml
|
||||
|
||||
- name: reload nginx
|
||||
service: name=nginx state=reloaded
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
value: '"--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --httpListenAddress=127.0.0.1"'
|
||||
no_extra_spaces: yes
|
||||
register: tmp
|
||||
notify: restart jenkins
|
||||
notify: system restart jenkins and wait
|
||||
- name: Etckeeper - commit
|
||||
command: "etckeeper commit 'Ansible/jenkins: maintaining /etc/default/jenkins'"
|
||||
when: tmp.changed and etckeeper_installed
|
||||
|
|
16
roles/jenkins-php-v1/tasks/include_restartandwait.yml
Normal file
16
roles/jenkins-php-v1/tasks/include_restartandwait.yml
Normal file
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
|
||||
- name: system-restart jenkins and wait (include)
|
||||
block:
|
||||
- name: restart jenkins
|
||||
service: name=jenkins state=restarted
|
||||
- name: Loop until Jenkins is available
|
||||
get_url:
|
||||
url: "http://localhost:8080/login"
|
||||
dest: "/dev/null"
|
||||
force: True
|
||||
register: result
|
||||
until: result.status_code is defined and result.status_code == 200
|
||||
retries: 100
|
||||
delay: 5
|
||||
changed_when: False
|
Reference in a new issue