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
|
## TODO
|
||||||
|
|
||||||
- stop execution if host is running an untested system ?
|
- 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.
|
- update plugins, or at least display a warning when they are not up to date.
|
||||||
- integrate docker-plugin nicely
|
- 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
|
## License
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: restart jenkins
|
# Avoid to use this one as it doesn't wait for Jenkins to be ready
|
||||||
service: name=jenkins state=restarted
|
# and thus, next invocation of jenkins-cli may fail.
|
||||||
|
|
||||||
- name: safe-restart jenkins
|
- name: safe-restart jenkins
|
||||||
shell: "{{ jenkins_cli_command }} safe-restart"
|
shell: "{{ jenkins_cli_command }} safe-restart"
|
||||||
|
|
||||||
|
@ -10,5 +9,9 @@
|
||||||
- name: safe-restart jenkins and wait
|
- name: safe-restart jenkins and wait
|
||||||
import_tasks: roles/jenkins-php-v1/tasks/include_saferestartandwait.yml
|
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
|
- name: reload nginx
|
||||||
service: name=nginx state=reloaded
|
service: name=nginx state=reloaded
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
value: '"--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --httpListenAddress=127.0.0.1"'
|
value: '"--webroot=/var/cache/$NAME/war --httpPort=$HTTP_PORT --httpListenAddress=127.0.0.1"'
|
||||||
no_extra_spaces: yes
|
no_extra_spaces: yes
|
||||||
register: tmp
|
register: tmp
|
||||||
notify: restart jenkins
|
notify: system restart jenkins and wait
|
||||||
- name: Etckeeper - commit
|
- name: Etckeeper - commit
|
||||||
command: "etckeeper commit 'Ansible/jenkins: maintaining /etc/default/jenkins'"
|
command: "etckeeper commit 'Ansible/jenkins: maintaining /etc/default/jenkins'"
|
||||||
when: tmp.changed and etckeeper_installed
|
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