mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
A user may try to use an EE that does not have the custom entrypoint script used by the default AWX EE
28 lines
849 B
Python
28 lines
849 B
Python
from django.conf import settings
|
|
|
|
from awx.main.models.execution_environments import ExecutionEnvironment
|
|
|
|
|
|
def get_default_execution_environment():
|
|
if settings.DEFAULT_EXECUTION_ENVIRONMENT is not None:
|
|
return settings.DEFAULT_EXECUTION_ENVIRONMENT
|
|
return ExecutionEnvironment.objects.filter(organization=None, managed_by_tower=True).first()
|
|
|
|
|
|
def get_default_pod_spec():
|
|
|
|
return {
|
|
"apiVersion": "v1",
|
|
"kind": "Pod",
|
|
"metadata": {"namespace": settings.AWX_CONTAINER_GROUP_DEFAULT_NAMESPACE},
|
|
"spec": {
|
|
"containers": [
|
|
{
|
|
"image": get_default_execution_environment().image,
|
|
"name": 'worker',
|
|
"args": ['ansible-runner', 'worker', '--private-data-dir=/runner'],
|
|
}
|
|
],
|
|
},
|
|
}
|