Merge "ansible_playbook: add support for DoNotSpecify inventory type"

This commit is contained in:
Zuul 2017-10-23 18:07:06 +00:00 committed by Gerrit Code Review
commit 441add1aad
3 changed files with 31 additions and 1 deletions

View File

@ -3953,6 +3953,7 @@ def ansible_playbook(parser, xml_parent, data):
:inventory-type values:
* **path**
* **content**
* **do-not-specify**
:arg dict inventory: Inventory data, depends on inventory-type
@ -4016,7 +4017,7 @@ def ansible_playbook(parser, xml_parent, data):
except KeyError as ex:
raise MissingAttributeError(ex)
inventory_types = ('path', 'content')
inventory_types = ('path', 'content', 'do-not-specify')
inventory_type = str(
data.get('inventory-type', inventory_types[0])).lower()
@ -4040,6 +4041,9 @@ def ansible_playbook(parser, xml_parent, data):
XML.SubElement(inventory, 'content').text = content
XML.SubElement(inventory, 'dynamic').text = str(
inv_data.get('dynamic', False)).lower()
elif inventory_type == 'do-not-specify':
inventory.set(
'class', 'org.jenkinsci.plugins.ansible.InventoryDoNotSpecify')
else:
raise InvalidAttributeError(
'inventory-type', inventory_type, inventory_types)

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<builders>
<org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder>
<playbook>path/to/playbook.yml</playbook>
<inventory class="org.jenkinsci.plugins.ansible.InventoryDoNotSpecify"/>
<limit/>
<tags/>
<skippedTags/>
<startAtTask/>
<credentialsId/>
<sudo>false</sudo>
<forks>5</forks>
<unbufferedOutput>true</unbufferedOutput>
<colorizedOutput>false</colorizedOutput>
<hostKeyChecking>false</hostKeyChecking>
<additionalParameters/>
<copyCredentialsInWorkspace>false</copyCredentialsInWorkspace>
</org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder>
</builders>
</project>

View File

@ -0,0 +1,5 @@
---
builders:
- ansible-playbook:
playbook: "path/to/playbook.yml"
inventory-type: "do-not-specify"