From 77743ef406369b40a3c03a2e778eac5ef9ea9bd7 Mon Sep 17 00:00:00 2001 From: Rick Elrod Date: Tue, 28 Mar 2023 09:19:01 -0500 Subject: [collection] Example for constructed inventories (#13755) Signed-off-by: Rick Elrod --- awx_collection/plugins/modules/inventory.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'awx_collection') 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: " + 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") ''' -- cgit v1.2.3