Skip to content

Commit

Permalink
update systemd unit file logic (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhan9san authored Oct 26, 2024
1 parent 98317c8 commit 0dfa9df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
2 changes: 0 additions & 2 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
jenkins_java_home: /opt/jdk-21.0.2
jenkins_plugin_file: plugins.txt
jenkins_jcasc_template: jenkins.yaml.j2
jenkins_systemd_unit_envs:
java_home: "{{ jenkins_java_home }}"
tasks:
- name: "Include zhan9san.java"
ansible.builtin.include_role:
Expand Down
24 changes: 11 additions & 13 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,18 @@
- name: Install Jenkins
ansible.builtin.include_tasks: "setup-{{ ansible_os_family | lower }}.yml"

- name: Ensure Jenkins systemd unit file dir exists
ansible.builtin.file:
path: /etc/systemd/system/jenkins.service.d
state: directory
mode: "0755"

- name: Update Jenkins systemd unit file
when: jenkins_systemd_unit_envs is defined and jenkins_systemd_unit_envs
block:
- name: Ensure Jenkins systemd unit file dir exists
ansible.builtin.file:
path: /etc/systemd/system/jenkins.service.d
state: directory
mode: "0755"
- name: Update Jenkins systemd unit file
ansible.builtin.template:
src: override.conf.j2
dest: /etc/systemd/system/jenkins.service.d/override.conf
mode: "0644"
notify: Reload systemd units
ansible.builtin.template:
src: override.conf.j2
dest: /etc/systemd/system/jenkins.service.d/override.conf
mode: "0644"
notify: Reload systemd units

- name: Set up Nginx
ansible.builtin.include_tasks:
Expand Down

0 comments on commit 0dfa9df

Please sign in to comment.