ansible_playbook: add support for DoNotSpecify inventory type
Change-Id: Idc72f9c1081a571bfc1ca69b74815b2c2033ef96 Signed-off-by: Evgeni Golov <evgeni@golov.de>
This commit is contained in:
parent
2c60aff806
commit
e3e83fc96e
|
@ -3902,6 +3902,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
|
||||
|
||||
|
@ -3965,7 +3966,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()
|
||||
|
||||
|
@ -3989,6 +3990,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)
|
||||
|
|
|
@ -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>
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
builders:
|
||||
- ansible-playbook:
|
||||
playbook: "path/to/playbook.yml"
|
||||
inventory-type: "do-not-specify"
|
Loading…
Reference in New Issue