ansible-roles/jenkins/master/tasks/jenkins_init.yml

19 lines
593 B
YAML

---
- block:
- name: Create the groovy directory
file: dest={{ jenkins_dest }}/init.groovy.d state=directory
- name: Install a groovy script to initialize the Jenkins system
template: src=admin_user.groovy dest={{ jenkins_dest }}/init.groovy.d/admin_user.groovy mode=0600
register: jenkins_must_be_restarted
- name: Restart jenkins if needed
become_user: root
service: name=jenkins state=restarted
when: jenkins_must_be_restarted is changed
become: True
become_user: '{{ jenkins_username }}'
when: jenkins_install
tags: [ 'jenkins', 'jenkins_master' ]