[AETHER-852] - Mask the service to enusre Jenkins will load the latest config.
- Only generate the init groovy script for first-time installation
- Remove init groovy script after first-time instllation.
- Moved the variable location
Change-Id: I0c0fb01f21353c817e2de986c86903df0387b9e4
diff --git a/tasks/Debian.yml b/tasks/Debian.yml
index 85ca137..4ca519d 100644
--- a/tasks/Debian.yml
+++ b/tasks/Debian.yml
@@ -24,14 +24,18 @@
repo: "{{ jenkins_repo_url }}"
update_cache: true
+# We need to prepare both init groovy script and Jenkins setting before starting it.
+- name: Mask the Jenkins to avoid it starting after first-time installation
+ systemd:
+ name: "{{ jenkins_service }}"
+ masked: true
+ when: "'jenkins' not in ansible_facts.packages"
+
- name: Install Jenkins packages (Debian)
apt:
name: "jenkins"
state: "present"
update_cache: true
cache_valid_time: 3600
-
-- name: Enable Jenkins Service
- service:
- name: "{{ jenkins_service }}"
- enabled: true
+ notify:
+ - start-jenkins