mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
Support passing instance filters to tower inventory src
* Switch ignore ssl errors to default on * Application inventory source defaults for Tower src
This commit is contained in:
@@ -1092,7 +1092,7 @@ def tower(cls):
|
|||||||
'env': {
|
'env': {
|
||||||
'TOWER_HOSTNAME': '{{host}}',
|
'TOWER_HOSTNAME': '{{host}}',
|
||||||
'TOWER_USERNAME': '{{username}}',
|
'TOWER_USERNAME': '{{username}}',
|
||||||
'TOWER_PASSWORD': '{{password}}'
|
'TOWER_PASSWORD': '{{password}}',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1203,7 +1203,7 @@ class InventorySourceOptions(BaseModel):
|
|||||||
raise ValidationError(_('Invalid filter expression: %(filter)s') %
|
raise ValidationError(_('Invalid filter expression: %(filter)s') %
|
||||||
{'filter': ', '.join(invalid_filters)})
|
{'filter': ', '.join(invalid_filters)})
|
||||||
return instance_filters
|
return instance_filters
|
||||||
elif self.source == 'vmware':
|
elif self.source in ('vmware', 'tower'):
|
||||||
return instance_filters
|
return instance_filters
|
||||||
else:
|
else:
|
||||||
return ''
|
return ''
|
||||||
|
|||||||
@@ -1912,6 +1912,8 @@ class RunInventoryUpdate(BaseTask):
|
|||||||
for env_k in inventory_update.source_vars_dict:
|
for env_k in inventory_update.source_vars_dict:
|
||||||
if str(env_k) not in env and str(env_k) not in settings.INV_ENV_VARIABLE_BLACKLIST:
|
if str(env_k) not in env and str(env_k) not in settings.INV_ENV_VARIABLE_BLACKLIST:
|
||||||
env[str(env_k)] = unicode(inventory_update.source_vars_dict[env_k])
|
env[str(env_k)] = unicode(inventory_update.source_vars_dict[env_k])
|
||||||
|
elif inventory_update.source == 'tower':
|
||||||
|
env['TOWER_INVENTORY'] = inventory_update.instance_filters
|
||||||
elif inventory_update.source == 'file':
|
elif inventory_update.source == 'file':
|
||||||
raise NotImplementedError('Cannot update file sources through the task system.')
|
raise NotImplementedError('Cannot update file sources through the task system.')
|
||||||
# add private_data_files
|
# add private_data_files
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ def parse_configuration():
|
|||||||
host_name = os.environ.get("TOWER_HOSTNAME", None)
|
host_name = os.environ.get("TOWER_HOSTNAME", None)
|
||||||
username = os.environ.get("TOWER_USERNAME", None)
|
username = os.environ.get("TOWER_USERNAME", None)
|
||||||
password = os.environ.get("TOWER_PASSWORD", None)
|
password = os.environ.get("TOWER_PASSWORD", None)
|
||||||
ignore_ssl = os.environ.get("TOWER_IGNORE_SSL", "0").lower() in ("1", "yes", "true")
|
ignore_ssl = os.environ.get("TOWER_IGNORE_SSL", "1").lower() in ("1", "yes", "true")
|
||||||
inventory = os.environ.get("TOWER_INVENTORY", None)
|
inventory = os.environ.get("TOWER_INVENTORY", None)
|
||||||
|
|
||||||
errors = []
|
errors = []
|
||||||
|
|||||||
@@ -832,6 +832,16 @@ OVIRT4_HOST_FILTER = r'^.+$'
|
|||||||
OVIRT4_EXCLUDE_EMPTY_GROUPS = True
|
OVIRT4_EXCLUDE_EMPTY_GROUPS = True
|
||||||
OVIRT4_INSTANCE_ID_VAR = 'id'
|
OVIRT4_INSTANCE_ID_VAR = 'id'
|
||||||
|
|
||||||
|
# ---------------------
|
||||||
|
# ----- Tower -----
|
||||||
|
# ---------------------
|
||||||
|
TOWER_ENABLED_VAR = 'status'
|
||||||
|
TOWER_ENABLED_VALUE = 'enabled'
|
||||||
|
TOWER_GROUP_FILTER = r'^.+$'
|
||||||
|
TOWER_HOST_FILTER = r'^.+$'
|
||||||
|
TOWER_EXCLUDE_EMPTY_GROUPS = True
|
||||||
|
TOWER_INSTANCE_ID_VAR = 'id'
|
||||||
|
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# ----- Foreman -----
|
# ----- Foreman -----
|
||||||
# ---------------------
|
# ---------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user