From 7c6975baec64acf89728b02a2a3e7e0b9fc25382 Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Tue, 29 Sep 2020 23:17:42 -0400 Subject: [PATCH] Collections volume permission fix, and container group fix Use same image for both types of container isolation Inventory move fix related to container groups --- awx/main/tasks.py | 15 ++++++++++----- awx/playbooks/project_update.yml | 3 +++ awx/settings/defaults.py | 6 +++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 50230c0e98..1c5b04fff9 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -1467,7 +1467,6 @@ class BaseTask(object): 'job_timeout': self.get_instance_timeout(self.instance), 'suppress_ansible_output': True, #**process_isolation_params, - **execution_environment_params, **resource_profiling_params, }, } @@ -1476,6 +1475,10 @@ class BaseTask(object): # We don't want HOME passed through to container groups. # TODO: remove this conditional after everything is containerized params['envvars'].pop('HOME', None) + else: + # TODO: container group jobs will not work with container isolation settings + # but both will run with same settings when worker_in and worker_out are added + params['settings'].update(execution_environment_params) if isinstance(self.instance, AdHocCommand): params['module'] = self.build_module_name(self.instance) @@ -1503,10 +1506,12 @@ class BaseTask(object): module_args = ansible_runner.utils.args2cmdline( params.get('module_args'), ) - shutil.move( - params.pop('inventory'), - os.path.join(private_data_dir, 'inventory') - ) + # TODO on merge: delete if https://github.com/ansible/awx/pull/8185 is merged + if not os.path.exists(os.path.join(private_data_dir, 'inventory')): + shutil.move( + params.pop('inventory'), + os.path.join(private_data_dir, 'inventory') + ) ansible_runner.utils.dump_artifacts(params) isolated_manager_instance = isolated_manager.IsolatedManager( diff --git a/awx/playbooks/project_update.yml b/awx/playbooks/project_update.yml index 49618909fb..664f189a28 100644 --- a/awx/playbooks/project_update.yml +++ b/awx/playbooks/project_update.yml @@ -204,6 +204,9 @@ ANSIBLE_FORCE_COLOR: false ANSIBLE_COLLECTIONS_PATHS: "{{projects_root}}/.__awx_cache/{{local_path}}/stage/requirements_collections" GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no" + # Put the local tmp directory in same volume as collection destination + # otherwise, files cannot be moved accross volumes and will cause error + ANSIBLE_LOCAL_TEMP: "{{projects_root}}/.__awx_cache/{{local_path}}/stage/tmp" when: - "ansible_version.full is version_compare('2.9', '>=')" diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index 849d6220bc..0a2a7043d6 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -59,13 +59,13 @@ DATABASES = { } } +AWX_EXECUTION_ENVIRONMENT_DEFAULT_IMAGE = 'quay.io/ansible/ansible-runner:devel' + AWX_CONTAINER_GROUP_K8S_API_TIMEOUT = 10 AWX_CONTAINER_GROUP_POD_LAUNCH_RETRIES = 100 AWX_CONTAINER_GROUP_POD_LAUNCH_RETRY_DELAY = 5 AWX_CONTAINER_GROUP_DEFAULT_NAMESPACE = 'default' -AWX_CONTAINER_GROUP_DEFAULT_IMAGE = 'ansible/ansible-runner' - -AWX_EXECUTION_ENVIRONMENT_DEFAULT_IMAGE = 'quay.io/ansible/ansible-runner:devel' +AWX_CONTAINER_GROUP_DEFAULT_IMAGE = AWX_EXECUTION_ENVIRONMENT_DEFAULT_IMAGE # Internationalization # https://docs.djangoproject.com/en/dev/topics/i18n/