mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
Initial env var implementation of private galaxy server
This commit is contained in:
@@ -410,6 +410,15 @@ register(
|
|||||||
category_slug='system',
|
category_slug='system',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
register(
|
||||||
|
'PROJECT_UPDATE_VVV',
|
||||||
|
field_class=fields.BooleanField,
|
||||||
|
label=_('Run Project Updates With Higher Verbosity'),
|
||||||
|
help_text=_('Adds the CLI -vvv flag to ansible-playbook runs of project_update.yml used for project updates.'),
|
||||||
|
category=_('Jobs'),
|
||||||
|
category_slug='jobs',
|
||||||
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
'AWX_ROLES_ENABLED',
|
'AWX_ROLES_ENABLED',
|
||||||
field_class=fields.BooleanField,
|
field_class=fields.BooleanField,
|
||||||
@@ -430,6 +439,52 @@ register(
|
|||||||
category_slug='jobs',
|
category_slug='jobs',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
register(
|
||||||
|
'PRIVATE_GALAXY_URL',
|
||||||
|
field_class=fields.URLField,
|
||||||
|
label=_('Private Galaxy Server Host'),
|
||||||
|
help_text=_('For using a private galaxy server at higher precedence than the public Ansible Galaxy. '
|
||||||
|
'The URL of the galaxy instance to connect to, this is required if using a private galaxy server.'),
|
||||||
|
category=_('Jobs'),
|
||||||
|
category_slug='jobs',
|
||||||
|
)
|
||||||
|
|
||||||
|
register(
|
||||||
|
'PRIVATE_GALAXY_USERNAME',
|
||||||
|
field_class=fields.CharField,
|
||||||
|
label=_('Private Galaxy Server Username'),
|
||||||
|
help_text=_('For using a private galaxy server at higher precedence than the public Ansible Galaxy. '
|
||||||
|
'The username to use for basic authentication against the Galaxy instance, '
|
||||||
|
'this is mutually exclusive with PRIVATE_GALAXY_TOKEN.'),
|
||||||
|
category=_('Jobs'),
|
||||||
|
category_slug='jobs',
|
||||||
|
depends_on=['PRIVATE_GALAXY_URL']
|
||||||
|
)
|
||||||
|
|
||||||
|
register(
|
||||||
|
'PRIVATE_GALAXY_PASSWORD',
|
||||||
|
field_class=fields.CharField,
|
||||||
|
label=_('Private Galaxy Server Password'),
|
||||||
|
help_text=_('For using a private galaxy server at higher precedence than the public Ansible Galaxy. '
|
||||||
|
'The password to use for basic authentication against the Galaxy instance, '
|
||||||
|
'this is mutually exclusive with PRIVATE_GALAXY_TOKEN.'),
|
||||||
|
category=_('Jobs'),
|
||||||
|
category_slug='jobs',
|
||||||
|
depends_on=['PRIVATE_GALAXY_URL']
|
||||||
|
)
|
||||||
|
|
||||||
|
register(
|
||||||
|
'PRIVATE_GALAXY_TOKEN',
|
||||||
|
field_class=fields.CharField,
|
||||||
|
label=_('Private Galaxy Server Token'),
|
||||||
|
help_text=_('For using a private galaxy server at higher precedence than the public Ansible Galaxy. '
|
||||||
|
'The username to use for basic authentication against the Galaxy instance, '
|
||||||
|
'this is mutually exclusive with corresponding username and password settings.'),
|
||||||
|
category=_('Jobs'),
|
||||||
|
category_slug='jobs',
|
||||||
|
depends_on=['PRIVATE_GALAXY_URL']
|
||||||
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
'STDOUT_MAX_BYTES_DISPLAY',
|
'STDOUT_MAX_BYTES_DISPLAY',
|
||||||
field_class=fields.IntegerField,
|
field_class=fields.IntegerField,
|
||||||
|
|||||||
@@ -1883,6 +1883,19 @@ class RunProjectUpdate(BaseTask):
|
|||||||
env['TMP'] = settings.AWX_PROOT_BASE_PATH
|
env['TMP'] = settings.AWX_PROOT_BASE_PATH
|
||||||
env['PROJECT_UPDATE_ID'] = str(project_update.pk)
|
env['PROJECT_UPDATE_ID'] = str(project_update.pk)
|
||||||
env['ANSIBLE_CALLBACK_PLUGINS'] = self.get_path_to('..', 'plugins', 'callback')
|
env['ANSIBLE_CALLBACK_PLUGINS'] = self.get_path_to('..', 'plugins', 'callback')
|
||||||
|
private_galaxy_url = settings.PRIVATE_GALAXY_URL
|
||||||
|
if private_galaxy_url:
|
||||||
|
# set up the fallback server, which is the normal Ansible Galaxy
|
||||||
|
env['ANSIBLE_GALAXY_SERVER_GALAXY_URL'] = 'https://galaxy.ansible.com'
|
||||||
|
env['ANSIBLE_GALAXY_SERVER_PRIVATE_GALAXY_URL'] = private_galaxy_url
|
||||||
|
for key in ('url', 'username', 'password', 'token'):
|
||||||
|
setting_name = 'PRIVATE_GALAXY_{}'.format(key.upper())
|
||||||
|
value = getattr(settings, setting_name)
|
||||||
|
if value:
|
||||||
|
env_key = 'ANSIBLE_GALAXY_SERVER_PRIVATE_GALAXY_{}'.format(key.upper())
|
||||||
|
env[env_key] = value
|
||||||
|
# now set the precedence
|
||||||
|
env['ANSIBLE_GALAXY_SERVER_LIST'] = 'private_galaxy,galaxy'
|
||||||
return env
|
return env
|
||||||
|
|
||||||
def _build_scm_url_extra_vars(self, project_update):
|
def _build_scm_url_extra_vars(self, project_update):
|
||||||
|
|||||||
@@ -609,6 +609,9 @@ AWX_REBUILD_SMART_MEMBERSHIP = False
|
|||||||
# By default, allow arbitrary Jinja templating in extra_vars defined on a Job Template
|
# By default, allow arbitrary Jinja templating in extra_vars defined on a Job Template
|
||||||
ALLOW_JINJA_IN_EXTRA_VARS = 'template'
|
ALLOW_JINJA_IN_EXTRA_VARS = 'template'
|
||||||
|
|
||||||
|
# Run project updates with extra verbosity
|
||||||
|
PROJECT_UPDATE_VVV = False
|
||||||
|
|
||||||
# Enable dynamically pulling roles from a requirement.yml file
|
# Enable dynamically pulling roles from a requirement.yml file
|
||||||
# when updating SCM projects
|
# when updating SCM projects
|
||||||
# Note: This setting may be overridden by database settings.
|
# Note: This setting may be overridden by database settings.
|
||||||
@@ -619,6 +622,12 @@ AWX_ROLES_ENABLED = True
|
|||||||
# Note: This setting may be overridden by database settings.
|
# Note: This setting may be overridden by database settings.
|
||||||
AWX_COLLECTIONS_ENABLED = True
|
AWX_COLLECTIONS_ENABLED = True
|
||||||
|
|
||||||
|
# Settings for private galaxy server, should be set in the UI
|
||||||
|
PRIVATE_GALAXY_URL = None
|
||||||
|
PRIVATE_GALAXY_USERNAME = None
|
||||||
|
PRIVATE_GALAXY_TOKEN = None
|
||||||
|
PRIVATE_GALAXY_PASSWORD = None
|
||||||
|
|
||||||
# Enable bubblewrap support for running jobs (playbook runs only).
|
# Enable bubblewrap support for running jobs (playbook runs only).
|
||||||
# Note: This setting may be overridden by database settings.
|
# Note: This setting may be overridden by database settings.
|
||||||
AWX_PROOT_ENABLED = True
|
AWX_PROOT_ENABLED = True
|
||||||
|
|||||||
@@ -58,12 +58,19 @@ export default ['i18n', function(i18n) {
|
|||||||
type: 'text',
|
type: 'text',
|
||||||
reset: 'ANSIBLE_FACT_CACHE_TIMEOUT',
|
reset: 'ANSIBLE_FACT_CACHE_TIMEOUT',
|
||||||
},
|
},
|
||||||
|
PROJECT_UPDATE_VVV: {
|
||||||
|
type: 'toggleSwitch',
|
||||||
|
},
|
||||||
AWX_ROLES_ENABLED: {
|
AWX_ROLES_ENABLED: {
|
||||||
type: 'toggleSwitch',
|
type: 'toggleSwitch',
|
||||||
},
|
},
|
||||||
AWX_COLLECTIONS_ENABLED: {
|
AWX_COLLECTIONS_ENABLED: {
|
||||||
type: 'toggleSwitch',
|
type: 'toggleSwitch',
|
||||||
},
|
},
|
||||||
|
PRIVATE_GALAXY_URL: {
|
||||||
|
type: 'text',
|
||||||
|
reset: 'PRIVATE_GALAXY_URL',
|
||||||
|
},
|
||||||
AWX_TASK_ENV: {
|
AWX_TASK_ENV: {
|
||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
reset: 'AWX_TASK_ENV',
|
reset: 'AWX_TASK_ENV',
|
||||||
|
|||||||
Reference in New Issue
Block a user