summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjaevans <jaevans@users.sourceforge.net>2018-06-13 19:00:05 +0200
committerAlanCoding <arominge@redhat.com>2019-09-27 20:28:50 +0200
commit623e0f7cc994b39fc4ce2ce4ec72add6a6d23866 (patch)
tree9e529fa9aa2e4f32e535107a4cfca8248719e760
parentUpdating tower_job_template.py (#38821) (diff)
downloadawx-623e0f7cc994b39fc4ce2ce4ec72add6a6d23866.tar.xz
awx-623e0f7cc994b39fc4ce2ce4ec72add6a6d23866.zip
Add support for Tower Smart inventories (#41458)
* Support Smart Inventories Add kind and host_filter fields and pass through to tower_cli. * Add documentation for new Smart Inventories options * Add missing description header for host_filter documentation * Add version added tags to new options * Bumped vesion_added to 2.7
-rw-r--r--lib/ansible/modules/web_infrastructure/ansible_tower/tower_inventory.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_inventory.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_inventory.py
index c05d93e665..dffbdc37c8 100644
--- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_inventory.py
+++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_inventory.py
@@ -37,6 +37,16 @@ options:
variables:
description:
- Inventory variables. Use C(@) to get from file.
+ kind:
+ description:
+ - The kind field. Cannot be modified after created.
+ default: ""
+ choices: ["", "smart"]
+ version_added: "2.7"
+ host_filter:
+ description:
+ - The host_filter field. Only useful when C(kind=smart).
+ version_added: "2.7"
state:
description:
- Desired state of the resource.
@@ -75,6 +85,8 @@ def main():
description=dict(),
organization=dict(required=True),
variables=dict(),
+ kind=dict(choices=['', 'smart'], default=''),
+ host_filter=dict(),
state=dict(choices=['present', 'absent'], default='present'),
))
@@ -88,6 +100,8 @@ def main():
organization = module.params.get('organization')
variables = module.params.get('variables')
state = module.params.get('state')
+ kind = module.params.get('kind')
+ host_filter = module.params.get('host_filter')
json_output = {'inventory': name, 'state': state}
@@ -102,7 +116,8 @@ def main():
if state == 'present':
result = inventory.modify(name=name, organization=org['id'], variables=variables,
- description=description, create_on_missing=True)
+ description=description, kind=kind, host_filter=host_filter,
+ create_on_missing=True)
json_output['id'] = result['id']
elif state == 'absent':
result = inventory.delete(name=name, organization=org['id'])