diff --git a/awx/main/conf.py b/awx/main/conf.py index e635fbc08d..a9802f9289 100644 --- a/awx/main/conf.py +++ b/awx/main/conf.py @@ -277,6 +277,16 @@ register( placeholder={'HTTP_PROXY': 'myproxy.local:8080'}, ) +register( + 'AWX_ROLES_ENABLED', + field_class=fields.BooleanField, + default=True, + label=_('Enable Role Download'), + help_text=_('Allows roles to be dynamically downlaoded from a requirements.yml file for SCM projects.'), + category=_('Jobs'), + category_slug='jobs', +) + register( 'STDOUT_MAX_BYTES_DISPLAY', field_class=fields.IntegerField, diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 3e6c407824..28c11b13a2 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -1521,6 +1521,7 @@ class RunProjectUpdate(BaseTask): 'scm_full_checkout': True if project_update.job_type == 'run' else False, 'scm_revision_output': self.revision_path, 'scm_revision': project_update.project.scm_revision, + 'roles_enabled': getattr(settings, 'AWX_ROLES_ENABLED', True) }) extra_vars_path = self.build_extra_vars_file(vars=extra_vars, **kwargs) args.extend(['-e', '@%s' % (extra_vars_path)]) diff --git a/awx/playbooks/project_update.yml b/awx/playbooks/project_update.yml index cefbdef1bb..1dd94b38b5 100644 --- a/awx/playbooks/project_update.yml +++ b/awx/playbooks/project_update.yml @@ -13,6 +13,7 @@ # scm_accept_hostkey: true/false (only for git, set automatically) # scm_revision: current revision in tower # scm_revision_output: where to store gathered revision (temporary file) +# roles_enabled: Allow us to pull roles from a requirements.yml file - hosts: all connection: local @@ -152,4 +153,4 @@ chdir: "{{project_path|quote}}/roles" when: doesRequirementsExist.stat.exists and scm_result is defined - when: scm_full_checkout|bool + when: scm_full_checkout|bool and roles_enabled|bool diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index 978cbf05c0..56614bad81 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -649,6 +649,11 @@ AWX_REBUILD_SMART_MEMBERSHIP = False # By default, allow arbitrary Jinja templating in extra_vars defined on a Job Template ALLOW_JINJA_IN_EXTRA_VARS = 'template' +# 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 bubblewrap support for running jobs (playbook runs only). # Note: This setting may be overridden by database settings. AWX_PROOT_ENABLED = True diff --git a/awx/settings/development.py b/awx/settings/development.py index 0061157ec4..30cecdaa1d 100644 --- a/awx/settings/development.py +++ b/awx/settings/development.py @@ -77,6 +77,11 @@ CELERYD_LOG_COLOR = True 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 diff --git a/awx/ui/client/src/configuration/jobs-form/configuration-jobs.form.js b/awx/ui/client/src/configuration/jobs-form/configuration-jobs.form.js index b945d44f44..e897a6ba4e 100644 --- a/awx/ui/client/src/configuration/jobs-form/configuration-jobs.form.js +++ b/awx/ui/client/src/configuration/jobs-form/configuration-jobs.form.js @@ -58,6 +58,9 @@ export default ['i18n', function(i18n) { type: 'text', reset: 'ANSIBLE_FACT_CACHE_TIMEOUT', }, + AWX_ROLES_ENABLED: { + type: 'toggleSwitch', + }, AWX_TASK_ENV: { type: 'textarea', reset: 'AWX_TASK_ENV',