]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ansible: REstart the jenkins agent service when changes are made 1661/head
authorDavid Galloway <dgallowa@redhat.com>
Wed, 16 Sep 2020 16:07:33 +0000 (12:07 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Wed, 16 Sep 2020 16:07:33 +0000 (12:07 -0400)
Signed-off-by: David Galloway <dgallowa@redhat.com>
ansible/examples/slave.yml

index 5d432f6a72d0f2040ee1278c4b4f0398e6b83e35..f4ec84296c6e9d5087edd2fc12cea9cf3041f88d 100644 (file)
             url: "{{ api_uri }}/jnlpJars/slave.jar"
             dest: "/home/{{ jenkins_user }}/slave.jar"
             force: yes
+          register: jar_changed
 
         - name: Install the systemd unit files for jenkins
           template:
           with_items:
             - service
             - secret
+          register: unit_files_changed
 
         - name: Reload systemd unit files (to pick up potential changes)
           systemd:
             name: jenkins
             state: started
             enabled: yes
+
+        - name: REstart jenkins service (if necessary)
+          service:
+            name: jenkins
+            state: restarted
+            enabled: yes
+          when: jar_changed is changed or unit_files_changed is changed
       when: permanent|bool