diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index 9a5eafedb2..aa0a569dbb 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -2390,6 +2390,9 @@ class satellite6(PluginFileInjector): group_patterns = '[]' group_prefix = 'foreman_' want_hostcollections = 'False' + want_ansible_ssh_host = 'False' + rich_params = 'False' + want_facts = 'True' foreman_opts = dict(inventory_update.source_vars_dict.items()) foreman_opts.setdefault('ssl_verify', 'False') for k, v in foreman_opts.items(): @@ -2399,6 +2402,12 @@ class satellite6(PluginFileInjector): group_prefix = v elif k == 'satellite6_want_hostcollections' and isinstance(v, bool): want_hostcollections = v + elif k == 'satellite6_want_ansible_ssh_host' and isinstance(v, bool): + want_ansible_ssh_host = v + elif k == 'satellite6_rich_params' and isinstance(v, bool): + rich_params = v + elif k == 'satellite6_want_facts' and isinstance(v, bool): + want_facts = v else: cp.set(section, k, str(v)) @@ -2410,9 +2419,11 @@ class satellite6(PluginFileInjector): section = 'ansible' cp.add_section(section) cp.set(section, 'group_patterns', group_patterns) - cp.set(section, 'want_facts', 'True') + cp.set(section, 'want_facts', str(want_facts)) cp.set(section, 'want_hostcollections', str(want_hostcollections)) cp.set(section, 'group_prefix', group_prefix) + cp.set(section, 'want_ansible_ssh_host', str(want_ansible_ssh_host)) + cp.set(section, 'rich_params', str(rich_params)) section = 'cache' cp.add_section(section) diff --git a/awx/main/tests/data/inventory/scripts/satellite6/files/file_reference b/awx/main/tests/data/inventory/scripts/satellite6/files/file_reference index 9fb7639c44..efb66e492a 100644 --- a/awx/main/tests/data/inventory/scripts/satellite6/files/file_reference +++ b/awx/main/tests/data/inventory/scripts/satellite6/files/file_reference @@ -10,6 +10,8 @@ group_patterns = foo_group_patterns want_facts = True want_hostcollections = True group_prefix = foo_group_prefix +want_ansible_ssh_host = True +rich_params = True [cache] path = /tmp diff --git a/awx/main/tests/functional/test_inventory_source_injectors.py b/awx/main/tests/functional/test_inventory_source_injectors.py index c41e596edc..656c9a1511 100644 --- a/awx/main/tests/functional/test_inventory_source_injectors.py +++ b/awx/main/tests/functional/test_inventory_source_injectors.py @@ -60,7 +60,11 @@ INI_TEST_VARS = { 'satellite6': { 'satellite6_group_patterns': 'foo_group_patterns', 'satellite6_group_prefix': 'foo_group_prefix', - 'satellite6_want_hostcollections': True + 'satellite6_want_hostcollections': True, + 'satellite6_want_ansible_ssh_host': True, + 'satellite6_rich_params': True, + 'satellite6_want_facts': True + }, 'cloudforms': { 'version': '2.4', diff --git a/awx/main/tests/unit/test_tasks.py b/awx/main/tests/unit/test_tasks.py index 2bae5aef9a..b520c00666 100644 --- a/awx/main/tests/unit/test_tasks.py +++ b/awx/main/tests/unit/test_tasks.py @@ -2146,7 +2146,14 @@ class TestInventoryUpdateCredentials(TestJobExecution): inventory_update.get_cloud_credential = get_cred inventory_update.get_extra_credentials = mocker.Mock(return_value=[]) - inventory_update.source_vars = '{"satellite6_group_patterns": "[a,b,c]", "satellite6_group_prefix": "hey_", "satellite6_want_hostcollections": True}' + inventory_update.source_vars = { + 'satellite6_group_patterns': '[a,b,c]', + 'satellite6_group_prefix': 'hey_', + 'satellite6_want_hostcollections': True, + 'satellite6_want_ansible_ssh_host': True, + 'satellite6_rich_params': True, + 'satellite6_want_facts': False + } private_data_files = task.build_private_data_files(inventory_update, private_data_dir) env = task.build_env(inventory_update, private_data_dir, False, private_data_files) @@ -2159,6 +2166,9 @@ class TestInventoryUpdateCredentials(TestJobExecution): assert config.get('ansible', 'group_patterns') == '[a,b,c]' assert config.get('ansible', 'group_prefix') == 'hey_' assert config.get('ansible', 'want_hostcollections') == 'True' + assert config.get('ansible', 'want_ansible_ssh_host') == 'True' + assert config.get('ansible', 'rich_params') == 'True' + assert config.get('ansible', 'want_facts') == 'False' def test_cloudforms_source(self, inventory_update, private_data_dir, mocker): task = tasks.RunInventoryUpdate()