diff options
author | Christian Kanthak <c.k@xyz.de> | 2020-05-15 11:11:22 +0200 |
---|---|---|
committer | Christian Kanthak <c.k@xyz.de> | 2020-05-15 11:24:34 +0200 |
commit | d8fa4f41269356ad85bd6d80d253bb5494d82bc9 (patch) | |
tree | 009109202adec95a38166e39e4f1e8c3ea58a9e0 /jenkins_jobs | |
parent | 074985c7ff9360bb58be80ffab686746267f814f (diff) | |
download | python-jenkins-job-builder-d8fa4f41269356ad85bd6d80d253bb5494d82bc9.tar.gz python-jenkins-job-builder-d8fa4f41269356ad85bd6d80d253bb5494d82bc9.tar.xz python-jenkins-job-builder-d8fa4f41269356ad85bd6d80d253bb5494d82bc9.zip |
Introduce disable-host-key-checking for builder ansible-playbook
Implemented new parameter "disable-host-key-checking" to make the
"anbile-playbook" builder compatible with version >=1.0 of the ansible
plugin. The parameter defaults to "false" for security reasons (as the
plugin does).
The old parameter "host-key-checking" is still written to XML to keep
code working in a setup with plugin version <1.0. This has no impact
on newer setups because the plugin with version >=1.0 ignores the old
parameter value.
For same security reasons the default value of old parameter
"host-key-checking" was changed to "true" to "fix" older setups which
have the parameter not defined.
Change-Id: I4a592c1a4d6ba8bb4f365ce505296cf5c09f7e19
Task: 39789
Story: 2007678
Diffstat (limited to 'jenkins_jobs')
-rw-r--r-- | jenkins_jobs/modules/builders.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/jenkins_jobs/modules/builders.py b/jenkins_jobs/modules/builders.py index 248ad90d..e26f98bb 100644 --- a/jenkins_jobs/modules/builders.py +++ b/jenkins_jobs/modules/builders.py @@ -4445,8 +4445,8 @@ def ansible_playbook(parser, xml_parent, data): (default true) :arg bool colorized-output: Check this box to allow ansible to render ANSI color codes in the Jenkins console. (default false) - :arg bool host-key-checking: Check this box to enforce the validation of - the hosts SSH server keys. (default false) + :arg bool disable-host-key-checking: Check this box to disable the + validation of the hosts SSH server keys. (>= 1.0) (default false) :arg str additional-parameters: Any additional parameters to pass to the ansible command. (default '') :arg list variables: List of extra variables to be passed to ansible. @@ -4457,6 +4457,12 @@ def ansible_playbook(parser, xml_parent, data): * **value** (`str`) -- Desired value (default '') * **hidden** (`bool`) -- Hide variable in build log (default false) + Outdated Options for versions >= 1.0 of plugin: + + :arg bool host-key-checking: Outdated, replaced with disable-host-key-checking. + Check this box to enforce the validation of the hosts SSH server keys. + (< 1.0) (default true) + Example: .. literalinclude:: @@ -4468,6 +4474,12 @@ def ansible_playbook(parser, xml_parent, data): .. literalinclude:: /../../tests/builders/fixtures/ansible-playbook002.yaml :language: yaml + + Example(s) versions < 1.0: + + .. literalinclude:: + /../../tests/builders/fixtures/ansible-playbook005.yaml + :language: yaml """ plugin = XML.SubElement( xml_parent, "org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder" @@ -4528,8 +4540,11 @@ def ansible_playbook(parser, xml_parent, data): XML.SubElement(plugin, "colorizedOutput").text = str( data.get("colorized-output", False) ).lower() + XML.SubElement(plugin, "disableHostKeyChecking").text = str( + data.get("disable-host-key-checking", False) + ).lower() XML.SubElement(plugin, "hostKeyChecking").text = str( - data.get("host-key-checking", False) + data.get("host-key-checking", True) ).lower() XML.SubElement(plugin, "additionalParameters").text = str( data.get("additional-parameters", "") |