blob: a776bae0efaeb90bdd5a197f700c3deedd6ff17b [file] [log] [blame]
Hung-Wei Chiu80dc18d2020-10-20 23:56:46 +00001---
2- name: Configure proxy config for Jenkins
3 template:
4 src: proxy.xml
5 dest: "{{ jenkins_home }}/proxy.xml"
6 owner: "{{ jenkins_process_user }}"
7 group: "{{ jenkins_process_group }}"
8 mode: 0664
9 register: jenkins_proxy_config
10 when:
11 - jenkins_proxy_host | length > 0
12 - jenkins_proxy_port | length > 0
13
14- name: Modify variables in init file.
15 lineinfile:
16 dest: "{{ jenkins_init_file }}"
17 insertafter: '^{{ item.option }}='
18 regexp: '^{{ item.option }}=\"\${{ item.option }} '
19 line: '{{ item.option }}="${{ item.option }} {{ item.value }}"'
20 state: present
21 mode: 0644
22 with_items: "{{ jenkins_init_changes }}"
23 register: jenkins_init_prefix
24
25- name: Create custom init scripts directory.
26 file:
27 path: "{{ jenkins_home }}/init.groovy.d"
28 state: directory
29 owner: "{{ jenkins_process_user }}"
30 group: "{{ jenkins_process_group }}"
31 mode: 0775
Hung-Wei Chiua5672f82020-10-23 21:50:56 +000032
33- name: generate groovy for initializing local admin account
34 template:
35 src: init_admin.groovy.j2
36 dest: "{{ jenkins_home }}/init.groovy.d/basic-security.groovy"
37 owner: "{{ jenkins_process_user }}"
38 group: "{{ jenkins_process_group }}"
39 mode: 0775
40 when: "'jenkins' not in ansible_facts.packages"
41 notify:
42 - unmask-jenkins
43 - enable-jenkins
44 - start-jenkins