Clark Boylan e8d1948f0a Use ansible service restart instead of start
The ansible service module is smart and will check the status of a
daemon and only start it if deemed necessary when asked to start a
service. The problem with this is that jenkins can go sideways confusing
the daemon system making it think the service is up even though we have
kill -9'd it into oblivion. The simple work around for this is to use
restart which will always bounce the service in ansible.

Change-Id: I240c318e9fa824d88bb817cf382d50ba2902d668
2015-10-14 12:15:37 -07:00

13 lines
562 B
YAML

---
- hosts: 'jenkins0*.openstack.org'
# 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