Merge pull request #4264 from jladdjr/satellite6_want_ansible_ssh_host

Add support for satellite6_want_ansible_ssh_host
This commit is contained in:
Jim Ladd 2020-04-27 11:39:03 -07:00 committed by GitHub
commit 45f8f0f412
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -2577,6 +2577,12 @@ class satellite6(PluginFileInjector):
def inventory_as_dict(self, inventory_update, private_data_dir):
ret = super(satellite6, self).inventory_as_dict(inventory_update, private_data_dir)
want_ansible_ssh_host = False
foreman_opts = inventory_update.source_vars_dict.copy()
for k, v in foreman_opts.items():
if k == 'satellite6_want_ansible_ssh_host' and isinstance(v, bool):
want_ansible_ssh_host = v
# Compatibility content
group_by_hostvar = {
"environment": {"prefix": "foreman_environment_",
@ -2603,6 +2609,9 @@ class satellite6(PluginFileInjector):
ret['want_facts'] = True
ret['want_params'] = True
if want_ansible_ssh_host:
ret['compose'] = {'ansible_ssh_host': "foreman['ip6'] | default(foreman['ip'], true)"}
return ret

View File

@ -1,3 +1,5 @@
compose:
ansible_ssh_host: foreman['ip6'] | default(foreman['ip'], true)
keyed_groups:
- key: foreman['environment_name'] | lower | regex_replace(' ', '') | regex_replace('[^A-Za-z0-9\_]', '_') | regex_replace('none', '')
prefix: foreman_environment_