summaryrefslogtreecommitdiffstats
path: root/awx_collection
diff options
context:
space:
mode:
authorRick Elrod <rick@elrod.me>2023-03-28 16:19:01 +0200
committerRick Elrod <rick@elrod.me>2023-03-28 18:20:24 +0200
commit77743ef406369b40a3c03a2e778eac5ef9ea9bd7 (patch)
treedf89aa3cdc712104e4c6e909b838bf725554c83b /awx_collection
parentAdd more constructed inventory hint examples (diff)
downloadawx-77743ef406369b40a3c03a2e778eac5ef9ea9bd7.tar.xz
awx-77743ef406369b40a3c03a2e778eac5ef9ea9bd7.zip
[collection] Example for constructed inventories (#13755)
Signed-off-by: Rick Elrod <rick@elrod.me>
Diffstat (limited to 'awx_collection')
-rw-r--r--awx_collection/plugins/modules/inventory.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/awx_collection/plugins/modules/inventory.py b/awx_collection/plugins/modules/inventory.py
index 3a479bcd03..3de24bf1ba 100644
--- a/awx_collection/plugins/modules/inventory.py
+++ b/awx_collection/plugins/modules/inventory.py
@@ -100,6 +100,35 @@ EXAMPLES = '''
description: "Our Foo Cloud Servers"
organization: Foo
state: present
+
+# You can create and modify constructed inventories by creating an inventory
+# of kind "constructed" and then editing the automatically generated inventory
+# source for that inventory.
+- name: Add constructed inventory with two existing input inventories
+ inventory:
+ name: My Constructed Inventory
+ organization: Default
+ kind: constructed
+ input_inventories:
+ - "West Datacenter"
+ - "East Datacenter"
+
+- name: Edit the constructed inventory source
+ inventory_source:
+ # The constructed inventory source will always be in the format:
+ # "Auto-created source for: <constructed inventory name>"
+ name: "Auto-created source for: My Constructed Inventory"
+ inventory: My Constructed Inventory
+ limit: host3,host4,host6
+ source_vars:
+ plugin: constructed
+ strict: true
+ use_vars_plugins: true
+ groups:
+ shutdown: resolved_state == "shutdown"
+ shutdown_in_product_dev: resolved_state == "shutdown" and account_alias == "product_dev"
+ compose:
+ resolved_state: state | default("running")
'''