Skip to content
This repository has been archived by the owner on Jul 5, 2020. It is now read-only.

Commit

Permalink
Merge pull request #54 from infOpen/fix_implicit_tasks_params
Browse files Browse the repository at this point in the history
Fix missing libraries args management in tasks
  • Loading branch information
achaussier committed May 5, 2016
2 parents 169d8f8 + b3a6125 commit a6f779c
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 10 deletions.
7 changes: 5 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ jenkins_etc_args:
- "--prefix={{ jenkins_etc_prefix }}"

# Jenkins cli
jenkins_base_url: "http://localhost:{{ jenkins_etc_http_port }}"
jenkins_base_url: "{{ 'http://' ~ jenkins_etc_listen_address ~ ':'
~ jenkins_etc_http_port ~ jenkins_etc_prefix }}"
jenkins_cli_download_url: "{{ jenkins_base_url }}/jnlpJars/jenkins-cli.jar"
jenkins_cli: "{{ jenkins_etc_home_location }}/jenkins-cli.jar"
jenkins_cli_path: "{{ jenkins_etc_home_location }}/jenkins-cli.jar"
jenkins_deployment_ssh_key: "{{ jenkins_etc_home_location }}/.ssh/id_rsa"
jenkins_groovy_scripts_path: "{{ jenkins_etc_home_location }}/groovy_scripts"

# Jenkins waiting availability test
jenkins_waiting_available_retries: 10
Expand Down
2 changes: 1 addition & 1 deletion tasks/manage_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
become_user: "{{ jenkins_etc_user }}"
get_url:
url: "{{ jenkins_cli_download_url }}"
dest: "{{ jenkins_cli }}"
dest: "{{ jenkins_cli_path }}"
force: True
8 changes: 8 additions & 0 deletions tasks/manage_credentials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
become_user: "{{ jenkins_etc_user }}"
remove_jenkins_credentials:
credentials_domain: "{{ item }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
with_items: "{{ jenkins_credentials_domains_to_empty }}"


Expand All @@ -24,6 +28,10 @@
private_key_passphrase: "{{ item.private_key_passphrase }}"
description: "{{ item.description }}"
state: "{{ item.state }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
no_log: True
register: 'jenkins_change_ssh_credentials'
with_items: "{{ jenkins_credentials }}"
Expand Down
20 changes: 20 additions & 0 deletions tasks/manage_main_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
authorization_strategy: "{{ jenkins_authorization_strategy }}"
crumb_issuer: "{{ jenkins_crumb_issuer }}"
use_private_key: False
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
no_log: True
register: 'jenkins_change_deployment_user_without_ssh_key'
ignore_errors: True
Expand All @@ -35,6 +39,10 @@
security_realm: "{{ jenkins_security_realm }}"
authorization_strategy: "{{ jenkins_authorization_strategy }}"
crumb_issuer: "{{ jenkins_crumb_issuer }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
no_log: True
register: 'jenkins_change_deployment_user'
with_items:
Expand All @@ -59,6 +67,10 @@
security_realm: "{{ jenkins_security_realm }}"
authorization_strategy: "{{ jenkins_authorization_strategy }}"
crumb_issuer: "{{ jenkins_crumb_issuer }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
no_log: True
register: 'jenkins_change_users_or_security'
with_items: "{{ jenkins_users }}"
Expand All @@ -80,6 +92,10 @@
quiet_period: "{{ jenkins_config_quiet_period }}"
scm_checkout_retry_count: "{{ jenkins_config_scm_checkout_retry_count }}"
slave_agent_port: "{{ jenkins_config_slave_agent_port }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
register: 'jenkins_change_main_configuration'


Expand All @@ -90,6 +106,10 @@
email: "{{ jenkins_location_administrator_email }}"
full_name: "{{ jenkins_location_administrator_full_name }}"
jenkins_url: "{{ jenkins_location_url }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
register: 'jenkins_change_administrator_email_address'
when:
- "{{ jenkins_location_administrator_email != '' }}"
Expand Down
5 changes: 4 additions & 1 deletion tasks/manage_plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
register: 'jenkins_tasks_enable_plugins'
enable_jenkins_plugin:
name: "{{ item.name }}"
cli_path: '/var/lib/jenkins/jenkins-cli.jar'
use_ssh_key: "{{ (jenkins_authentication_disabled is defined)
and (jenkins_authentication_disabled | skipped) }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
with_items: "{{ jenkins_plugins }}"


Expand Down
44 changes: 44 additions & 0 deletions tasks/manage_plugins_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
create_accounts: "{{ jenkins_plugin_git_create_account_based_on_email }}"
email: "{{ jenkins_plugin_git_global_email }}"
full_name: "{{ jenkins_plugin_git_global_full_name }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
register: 'jenkins_change_plugin_git'
when:
- "{{ 'git' in (jenkins_plugins | map(attribute='name')) }}"
Expand All @@ -27,6 +31,10 @@
smtp_port: "{{ jenkins_plugin_mailer_smtp_port }}"
smtp_user: "{{ jenkins_plugin_mailer_smtp_user }}"
use_ssl: "{{ jenkins_plugin_mailer_use_ssl }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
no_log: True
register: 'jenkins_change_plugin_mailer'
when:
Expand All @@ -39,6 +47,10 @@
become_user: "{{ jenkins_etc_user }}"
remove_jenkins_github_servers:
do_task: True
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
register: 'jenkins_change_plugin_github_remove_servers'
when:
- "{{ 'github' in (jenkins_plugins | map(attribute='name')) }}"
Expand All @@ -54,6 +66,10 @@
credentials_id: "{{ item.credentials_id }}"
custom_url: "{{ item.custom_url }}"
client_cache_size: "{{ item.client_cache_size }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
register: 'jenkins_change_plugin_github'
with_items: "{{ jenkins_plugin_github_servers }}"
when:
Expand All @@ -70,6 +86,10 @@
public_key: "{{ jenkins_plugin_debian_package_builder_gpg.public_key }}"
private_key: "{{ jenkins_plugin_debian_package_builder_gpg.private_key }}"
passphrase: "{{ jenkins_plugin_debian_package_builder_gpg.passphrase }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
no_log: True
register: 'jenkins_change_plugin_debian_package_builder_gpg'
when:
Expand All @@ -83,6 +103,10 @@
become_user: "{{ jenkins_etc_user }}"
remove_jenkins_debian_package_builder_repo:
do_task: True
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
register: 'jenkins_change_plugin_debian_package_builder_remove_repo'
when:
- "{{ jenkins_plugin_debian_package_builder_remove_repositories }}"
Expand All @@ -103,6 +127,10 @@
key_path: "{{ item.key_path }}"
options: "{{ item.options }}"
state: "{{ item.state }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
no_log: True
register: 'jenkins_change_plugin_debian_package_builder_repo'
with_items: "{{ jenkins_plugin_debian_package_builder_repo }}"
Expand All @@ -119,6 +147,10 @@
api_token: "{{ jenkins_plugin_gitlab_api_token }}"
host_url: "{{ jenkins_plugin_gitlab_host_url }}"
ignore_cert_error: "{{ jenkins_plugin_gitlab_ignore_cert_error }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
no_log: True
register: 'jenkins_change_plugin_gitlab'
when:
Expand All @@ -135,6 +167,10 @@
v2_enabled: "{{ jenkins_plugin_hipchat_v2_enabled }}"
room: "{{ jenkins_plugin_hipchat_room }}"
send_as: "{{ jenkins_plugin_hipchat_send_as }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
no_log: True
register: 'jenkins_change_plugin_hipchat'
when:
Expand All @@ -152,6 +188,10 @@
color: "{{ item.color }}"
message_template: "{{ item.message_template }}"
state: "{{ item.state }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
register: 'jenkins_change_plugin_hipchat_notifications'
with_items: "{{ jenkins_plugin_hipchat_notifications }}"
when:
Expand All @@ -171,6 +211,10 @@
credentials_id: "{{ item.credentials_id }}"
templates: "{{ item.templates }}"
state: "{{ item.state }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
register: 'jenkins_change_plugin_docker_clouds'
with_items: "{{ jenkins_plugin_docker_clouds }}"
when:
Expand Down
10 changes: 8 additions & 2 deletions tasks/manage_plugins_installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
register: 'jenkins_tasks_dependencies_plugins'
get_plugin_dependencies:
name: "{{ item.name }}"
cli_path: '/var/lib/jenkins/jenkins-cli.jar'
use_ssh_key: "{{ (jenkins_authentication_disabled is defined)
and (jenkins_authentication_disabled | skipped) }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
with_items: "{{ jenkins_plugins }}"
changed_when: False

Expand All @@ -22,9 +25,12 @@
install_jenkins_plugin:
name: "{{ item.1 }}"
state: "{{ jenkins_plugins_state }}"
cli_path: '/var/lib/jenkins/jenkins-cli.jar'
use_ssh_key: "{{ (jenkins_authentication_disabled is defined)
and (jenkins_authentication_disabled | skipped) }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
with_subelements:
- "{{ jenkins_tasks_dependencies_plugins.results }}"
- 'output'
Expand Down
10 changes: 8 additions & 2 deletions tasks/manage_plugins_upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
become: True
become_user: "{{ jenkins_etc_user }}"
get_jenkins_plugins:
cli_path: '/var/lib/jenkins/jenkins-cli.jar'
use_ssh_key: "{{ (jenkins_authentication_disabled is defined)
and (jenkins_authentication_disabled | skipped) }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
register: 'jenkins_list_plugins_for_upgrade'
changed_when: False

Expand All @@ -19,10 +22,13 @@
register: 'jenkins_tasks_upgrade_plugins'
install_jenkins_plugin:
name: "{{ item }}"
cli_path: '/var/lib/jenkins/jenkins-cli.jar'
state: 'latest'
use_ssh_key: "{{ (jenkins_authentication_disabled is defined)
and (jenkins_authentication_disabled | skipped) }}"
cli_path: "{{ jenkins_cli_path }}"
deployment_ssh_key: "{{ jenkins_deployment_ssh_key }}"
groovy_scripts_path: "{{ jenkins_groovy_scripts_path }}"
url: "{{ jenkins_base_url }}"
with_items: "{{ jenkins_list_plugins_for_upgrade.has_update }}"


Expand Down
4 changes: 2 additions & 2 deletions tests/common_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
register: 'jenkins_list_plugins_test'
shell: >
java
-jar {{ jenkins_cli }}
-jar {{ jenkins_cli_path }}
-s {{ jenkins_base_url }}
list-plugins
| awk '{ print $1 }'
Expand All @@ -56,7 +56,7 @@
register: 'jenkins_list_plugins_with_upgrade_test'
shell: >
java
-jar {{ jenkins_cli }}
-jar {{ jenkins_cli_path }}
-s {{ jenkins_base_url }}
list-plugins
| grep ')$'
Expand Down

0 comments on commit a6f779c

Please sign in to comment.