
'forks' control how many parallel tasks ansible runs, but it does each task in a play in parallel across those forks. 'serial' says to run all the tasks in a play on a host before moving to the next one. Change-Id: I780f55d26bae77a39065e9d9c08e989f9b3e4ef7
15 lines
631 B
YAML
15 lines
631 B
YAML
---
|
|
- hosts: 'jenkins0*.openstack.org'
|
|
# Do the entire play completely for one host at a time
|
|
serial: 1
|
|
# Treat any errors as fatal so that we don't stop all the jenkins
|
|
# masters.
|
|
any_errors_fatal: true
|
|
tasks:
|
|
- shell: '/usr/local/jenkins/bin/safe_jenkins_shutdown --url https://{{ ansible_fqdn }}/ --user {{ user }} --password {{ password }}'
|
|
- service: name=jenkins state=stopped
|
|
# This is necessary because stopping Jenkins is not reliable.
|
|
# We allow return code 1 which means no processes found.
|
|
- shell: 'pkill -9 -U jenkins || [ $? -eq "1" ]'
|
|
- service: name=jenkins state=restarted
|