From dddf161d07129027cc87014a604fb033e0ae2198 Mon Sep 17 00:00:00 2001 From: Jack Date: Sat, 26 Oct 2024 23:29:40 +0800 Subject: [PATCH] update plugin manager command (#26) --- defaults/main.yml | 11 +++++++++++ tasks/setup-plugin.yml | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 6aa5457..dc3af58 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -70,3 +70,14 @@ jenkins_download_proxy: jenkins_plugin_manager_proxy_port: "{{ '-Dhttp.proxyPort=' ~ jenkins_proxy_port ~ ' -Dhttps.proxyPort=' ~ jenkins_proxy_port if jenkins_proxy_port else '' }}" jenkins_plugin_manager_proxy_host: "{{ '-Dhttp.proxyHost=' ~ jenkins_proxy_host ~ ' -Dhttps.proxyHost=' ~ jenkins_proxy_host if jenkins_proxy_host else '' }}" jenkins_plugin_manager_non_proxy_hosts: "{{ '-Dhttp.nonProxyHosts=' ~ jenkins_non_proxy_hosts if jenkins_non_proxy_hosts else '' }}" + +# no double quotes needed if `>` is used +jenkins_plugin_installation_cmd: > + {{ java_bin }} + {{ jenkins_plugin_manager_proxy_port }} + {{ jenkins_plugin_manager_proxy_host }} + {{ jenkins_plugin_manager_non_proxy_hosts }} + -jar {{ jenkins_plugin_manager_path }} + -w /usr/share/java/jenkins.war + -f {{ jenkins_plugin_file_path }} + -d {{ jenkins_home }}/plugins diff --git a/tasks/setup-plugin.yml b/tasks/setup-plugin.yml index 753cf6f..69737fb 100644 --- a/tasks/setup-plugin.yml +++ b/tasks/setup-plugin.yml @@ -22,7 +22,7 @@ - name: Install plugins ansible.builtin.command: - cmd: "{{ java_bin }} -jar {{ jenkins_plugin_manager_path }} -w /usr/share/java/jenkins.war -f {{ jenkins_plugin_file_path }} -d {{ jenkins_home }}/plugins {{ jenkins_plugin_manager_proxy_port }} {{ jenkins_plugin_manager_proxy_host }} {{ jenkins_plugin_manager_non_proxy_hosts }}" # yamllint disable-line rule:line-length + cmd: "{{ jenkins_plugin_installation_cmd }}" when: copy_result.changed # noqa: no-handler register: command_result changed_when: true