Initial commit
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
# Copyright (c) 2015 Ansible, Inc.
|
||||
# All Rights Reserved.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,192 @@
|
||||
# Copyright (c) 2015 Ansible, Inc.
|
||||
# All Rights Reserved.
|
||||
|
||||
# Development settings for AWX project.
|
||||
|
||||
# Python
|
||||
import os
|
||||
import socket
|
||||
import copy
|
||||
import sys
|
||||
import traceback
|
||||
import uuid
|
||||
|
||||
# Centos-7 doesn't include the svg mime type
|
||||
# /usr/lib64/python/mimetypes.py
|
||||
import mimetypes
|
||||
|
||||
# Django Split Settings
|
||||
from split_settings.tools import optional, include
|
||||
|
||||
# Load default settings.
|
||||
from .defaults import * # NOQA
|
||||
|
||||
if "pytest" in sys.modules:
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
||||
'LOCATION': 'unique-{}'.format(str(uuid.uuid4())),
|
||||
},
|
||||
}
|
||||
|
||||
# awx-manage shell_plus --notebook
|
||||
NOTEBOOK_ARGUMENTS = [
|
||||
'--NotebookApp.token=',
|
||||
'--ip', '0.0.0.0',
|
||||
'--port', '8888',
|
||||
'--allow-root',
|
||||
'--no-browser',
|
||||
]
|
||||
|
||||
# print SQL queries in shell_plus
|
||||
SHELL_PLUS_PRINT_SQL = False
|
||||
|
||||
# show colored logs in the dev environment
|
||||
# to disable this, set `COLOR_LOGS = False` in awx/settings/local_settings.py
|
||||
LOGGING['handlers']['console']['()'] = 'awx.main.utils.handlers.ColorHandler' # noqa
|
||||
# task system does not propagate to AWX, so color log these too
|
||||
LOGGING['handlers']['task_system'] = LOGGING['handlers']['console'].copy() # noqa
|
||||
COLOR_LOGS = True
|
||||
|
||||
# Pipe management playbook output to console
|
||||
LOGGING['loggers']['awx.isolated.manager.playbooks']['propagate'] = True # noqa
|
||||
|
||||
# celery is annoyingly loud when docker containers start
|
||||
LOGGING['loggers'].pop('celery', None) # noqa
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
mimetypes.add_type("image/svg+xml", ".svg", True)
|
||||
mimetypes.add_type("image/svg+xml", ".svgz", True)
|
||||
|
||||
# Disallow sending session cookies over insecure connections
|
||||
SESSION_COOKIE_SECURE = False
|
||||
|
||||
# Disallow sending csrf cookies over insecure connections
|
||||
CSRF_COOKIE_SECURE = False
|
||||
|
||||
# Override django.template.loaders.cached.Loader in defaults.py
|
||||
template = next((tpl_backend for tpl_backend in TEMPLATES if tpl_backend['NAME'] == 'default'), None) # noqa
|
||||
template['OPTIONS']['loaders'] = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
)
|
||||
|
||||
CALLBACK_QUEUE = "callback_tasks"
|
||||
|
||||
# Enable dynamically pulling roles from a requirement.yml file
|
||||
# when updating SCM projects
|
||||
# Note: This setting may be overridden by database settings.
|
||||
AWX_ROLES_ENABLED = True
|
||||
|
||||
# Enable PROOT for tower-qa integration tests.
|
||||
# Note: This setting may be overridden by database settings.
|
||||
AWX_PROOT_ENABLED = True
|
||||
|
||||
AWX_ISOLATED_USERNAME = 'root'
|
||||
AWX_ISOLATED_CHECK_INTERVAL = 1
|
||||
AWX_ISOLATED_PERIODIC_CHECK = 30
|
||||
|
||||
# Disable Pendo on the UI for development/test.
|
||||
# Note: This setting may be overridden by database settings.
|
||||
PENDO_TRACKING_STATE = "off"
|
||||
INSIGHTS_TRACKING_STATE = False
|
||||
|
||||
# Use Django-Jenkins if installed. Only run tests for awx.main app.
|
||||
try:
|
||||
import django_jenkins
|
||||
INSTALLED_APPS += [django_jenkins.__name__,] # noqa
|
||||
PROJECT_APPS = ('awx.main.tests', 'awx.api.tests',)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
if 'django_jenkins' in INSTALLED_APPS:
|
||||
JENKINS_TASKS = (
|
||||
# 'django_jenkins.tasks.run_pylint',
|
||||
# 'django_jenkins.tasks.run_flake8',
|
||||
# The following are not needed when including run_flake8
|
||||
# 'django_jenkins.tasks.run_pep8',
|
||||
# 'django_jenkins.tasks.run_pyflakes',
|
||||
# The following are handled by various grunt tasks and no longer required
|
||||
# 'django_jenkins.tasks.run_jshint',
|
||||
# 'django_jenkins.tasks.run_csslint',
|
||||
)
|
||||
PEP8_RCFILE = "setup.cfg"
|
||||
PYLINT_RCFILE = ".pylintrc"
|
||||
|
||||
|
||||
# debug toolbar and swagger assume that requirements/requirements_dev.txt are installed
|
||||
|
||||
INSTALLED_APPS += [ # NOQA
|
||||
'rest_framework_swagger',
|
||||
'debug_toolbar',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||
] + MIDDLEWARE # NOQA
|
||||
|
||||
DEBUG_TOOLBAR_CONFIG = {
|
||||
'ENABLE_STACKTRACES' : True,
|
||||
}
|
||||
|
||||
# Configure a default UUID for development only.
|
||||
SYSTEM_UUID = '00000000-0000-0000-0000-000000000000'
|
||||
INSTALL_UUID = '00000000-0000-0000-0000-000000000000'
|
||||
|
||||
# Store a snapshot of default settings at this point before loading any
|
||||
# customizable config files.
|
||||
DEFAULTS_SNAPSHOT = {}
|
||||
this_module = sys.modules[__name__]
|
||||
for setting in dir(this_module):
|
||||
if setting == setting.upper():
|
||||
DEFAULTS_SNAPSHOT[setting] = copy.deepcopy(getattr(this_module, setting))
|
||||
|
||||
# If there is an `/etc/tower/settings.py`, include it.
|
||||
# If there is a `/etc/tower/conf.d/*.py`, include them.
|
||||
include(optional('/etc/tower/settings.py'), scope=locals())
|
||||
include(optional('/etc/tower/conf.d/*.py'), scope=locals())
|
||||
|
||||
# Installed differently in Dockerfile compared to production versions
|
||||
AWX_ANSIBLE_COLLECTIONS_PATHS = '/var/lib/awx/vendor/awx_ansible_collections'
|
||||
|
||||
BASE_VENV_PATH = "/var/lib/awx/venv/"
|
||||
ANSIBLE_VENV_PATH = os.path.join(BASE_VENV_PATH, "ansible")
|
||||
AWX_VENV_PATH = os.path.join(BASE_VENV_PATH, "awx")
|
||||
|
||||
# If any local_*.py files are present in awx/settings/, use them to override
|
||||
# default settings for development. If not present, we can still run using
|
||||
# only the defaults.
|
||||
try:
|
||||
if os.getenv('AWX_KUBE_DEVEL', False):
|
||||
include(optional('minikube.py'), scope=locals())
|
||||
else:
|
||||
include(optional('local_*.py'), scope=locals())
|
||||
except ImportError:
|
||||
traceback.print_exc()
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
CELERYBEAT_SCHEDULE.update({ # noqa
|
||||
'isolated_heartbeat': {
|
||||
'task': 'awx.main.tasks.awx_isolated_heartbeat',
|
||||
'schedule': timedelta(seconds=AWX_ISOLATED_PERIODIC_CHECK), # noqa
|
||||
'options': {'expires': AWX_ISOLATED_PERIODIC_CHECK * 2}, # noqa
|
||||
}
|
||||
})
|
||||
|
||||
CLUSTER_HOST_ID = socket.gethostname()
|
||||
|
||||
|
||||
if 'Docker Desktop' in os.getenv('OS', ''):
|
||||
os.environ['SDB_NOTIFY_HOST'] = 'docker.for.mac.host.internal'
|
||||
else:
|
||||
try:
|
||||
os.environ['SDB_NOTIFY_HOST'] = os.popen('ip route').read().split(' ')[2]
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
AWX_CALLBACK_PROFILE = True
|
||||
|
||||
if 'sqlite3' not in DATABASES['default']['ENGINE']: # noqa
|
||||
DATABASES['default'].setdefault('OPTIONS', dict()).setdefault('application_name', f'{CLUSTER_HOST_ID}-{os.getpid()}-{" ".join(sys.argv)}'[:63]) # noqa
|
||||
@@ -0,0 +1,16 @@
|
||||
# Copyright (c) 2015 Ansible, Inc.
|
||||
# All Rights Reserved.
|
||||
|
||||
# Development settings for AWX project, but with DEBUG disabled
|
||||
|
||||
# Load development settings.
|
||||
from defaults import * # NOQA
|
||||
|
||||
# Load development settings.
|
||||
from development import * # NOQA
|
||||
|
||||
# Disable capturing DEBUG
|
||||
DEBUG = False
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
SQL_DEBUG = DEBUG
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
BROADCAST_WEBSOCKET_SECRET = '🤖starscream🤖'
|
||||
BROADCAST_WEBSOCKET_PORT = 8013
|
||||
BROADCAST_WEBSOCKET_VERIFY_CERT = False
|
||||
BROADCAST_WEBSOCKET_PROTOCOL = 'http'
|
||||
@@ -0,0 +1,102 @@
|
||||
# Copyright (c) 2015 Ansible, Inc.
|
||||
# All Rights Reserved.
|
||||
|
||||
# Production settings for AWX project.
|
||||
|
||||
# Python
|
||||
import os
|
||||
import copy
|
||||
import errno
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
# Django Split Settings
|
||||
from split_settings.tools import optional, include
|
||||
|
||||
# Load default settings.
|
||||
from .defaults import * # NOQA
|
||||
|
||||
DEBUG = False
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
SQL_DEBUG = DEBUG
|
||||
|
||||
# Clear database settings to force production environment to define them.
|
||||
DATABASES = {}
|
||||
|
||||
# Clear the secret key to force production environment to define it.
|
||||
SECRET_KEY = None
|
||||
|
||||
# Hosts/domain names that are valid for this site; required if DEBUG is False
|
||||
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
# The heartbeat file for the tower scheduler
|
||||
SCHEDULE_METADATA_LOCATION = '/var/lib/awx/.tower_cycle'
|
||||
|
||||
# Ansible base virtualenv paths and enablement
|
||||
BASE_VENV_PATH = os.path.realpath("/var/lib/awx/venv")
|
||||
ANSIBLE_VENV_PATH = os.path.join(BASE_VENV_PATH, "ansible")
|
||||
|
||||
# Tower base virtualenv paths and enablement
|
||||
AWX_VENV_PATH = os.path.join(BASE_VENV_PATH, "awx")
|
||||
|
||||
AWX_ISOLATED_USERNAME = 'awx'
|
||||
|
||||
# Store a snapshot of default settings at this point before loading any
|
||||
# customizable config files.
|
||||
DEFAULTS_SNAPSHOT = {}
|
||||
this_module = sys.modules[__name__]
|
||||
for setting in dir(this_module):
|
||||
if setting == setting.upper():
|
||||
DEFAULTS_SNAPSHOT[setting] = copy.deepcopy(getattr(this_module, setting))
|
||||
|
||||
# Load settings from any .py files in the global conf.d directory specified in
|
||||
# the environment, defaulting to /etc/tower/conf.d/.
|
||||
settings_dir = os.environ.get('AWX_SETTINGS_DIR', '/etc/tower/conf.d/')
|
||||
settings_files = os.path.join(settings_dir, '*.py')
|
||||
|
||||
# Load remaining settings from the global settings file specified in the
|
||||
# environment, defaulting to /etc/tower/settings.py.
|
||||
settings_file = os.environ.get('AWX_SETTINGS_FILE',
|
||||
'/etc/tower/settings.py')
|
||||
|
||||
# Attempt to load settings from /etc/tower/settings.py first, followed by
|
||||
# /etc/tower/conf.d/*.py.
|
||||
try:
|
||||
include(settings_file, optional(settings_files), scope=locals())
|
||||
except ImportError:
|
||||
traceback.print_exc()
|
||||
sys.exit(1)
|
||||
except IOError:
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
included_file = locals().get('__included_file__', '')
|
||||
if (not included_file or included_file == settings_file):
|
||||
# The import doesn't always give permission denied, so try to open the
|
||||
# settings file directly.
|
||||
try:
|
||||
e = None
|
||||
open(settings_file)
|
||||
except IOError:
|
||||
pass
|
||||
if e and e.errno == errno.EACCES:
|
||||
SECRET_KEY = 'permission-denied'
|
||||
LOGGING = {}
|
||||
else:
|
||||
msg = 'No AWX configuration found at %s.' % settings_file
|
||||
msg += '\nDefine the AWX_SETTINGS_FILE environment variable to '
|
||||
msg += 'specify an alternate path.'
|
||||
raise ImproperlyConfigured(msg)
|
||||
else:
|
||||
raise
|
||||
|
||||
# The below runs AFTER all of the custom settings are imported.
|
||||
|
||||
CELERYBEAT_SCHEDULE.update({ # noqa
|
||||
'isolated_heartbeat': {
|
||||
'task': 'awx.main.tasks.awx_isolated_heartbeat',
|
||||
'schedule': timedelta(seconds=AWX_ISOLATED_PERIODIC_CHECK), # noqa
|
||||
'options': {'expires': AWX_ISOLATED_PERIODIC_CHECK * 2}, # noqa
|
||||
}
|
||||
})
|
||||
|
||||
DATABASES['default'].setdefault('OPTIONS', dict()).setdefault('application_name', f'{CLUSTER_HOST_ID}-{os.getpid()}-{" ".join(sys.argv)}'[:63]) # noqa
|
||||
Reference in New Issue
Block a user