diff --git a/.dockerignore b/.dockerignore
index f5faf1f0e3..46c83b0467 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,2 +1 @@
-.git
awx/ui/node_modules
diff --git a/Makefile b/Makefile
index 783547930f..54bbf2175f 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,8 @@ PYCURL_SSL_LIBRARY ?= openssl
COMPOSE_TAG ?= $(GIT_BRANCH)
COMPOSE_HOST ?= $(shell hostname)
-VENV_BASE ?= /venv
+VENV_BASE ?= /var/lib/awx/venv/
+COLLECTION_BASE ?= /var/lib/awx/vendor/awx_ansible_collections
SCL_PREFIX ?=
CELERY_SCHEDULE_FILE ?= /var/lib/awx/beat.db
@@ -270,7 +271,7 @@ uwsgi: collectstatic
@if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \
fi; \
- uwsgi -b 32768 --socket 127.0.0.1:8050 --module=awx.wsgi:application --home=/venv/awx --chdir=/awx_devel/ --vacuum --processes=5 --harakiri=120 --master --no-orphans --py-autoreload 1 --max-requests=1000 --stats /tmp/stats.socket --lazy-apps --logformat "%(addr) %(method) %(uri) - %(proto) %(status)" --hook-accepting1="exec:supervisorctl restart tower-processes:awx-dispatcher tower-processes:awx-receiver"
+ uwsgi -b 32768 --socket 127.0.0.1:8050 --module=awx.wsgi:application --home=/var/lib/awx/venv/awx --chdir=/awx_devel/ --vacuum --processes=5 --harakiri=120 --master --no-orphans --py-autoreload 1 --max-requests=1000 --stats /tmp/stats.socket --lazy-apps --logformat "%(addr) %(method) %(uri) - %(proto) %(status)" --hook-accepting1="exec:supervisorctl restart tower-processes:awx-dispatcher tower-processes:awx-receiver"
daphne:
@if [ "$(VENV_BASE)" ]; then \
@@ -340,7 +341,7 @@ check: flake8 pep8 # pyflakes pylint
awx-link:
[ -d "/awx_devel/awx.egg-info" ] || python3 /awx_devel/setup.py egg_info_dev
- cp -f /tmp/awx.egg-link /venv/awx/lib/python$(PYTHON_VERSION)/site-packages/awx.egg-link
+ cp -f /tmp/awx.egg-link /var/lib/awx/venv/awx/lib/python$(PYTHON_VERSION)/site-packages/awx.egg-link
TEST_DIRS ?= awx/main/tests/unit awx/main/tests/functional awx/conf/tests awx/sso/tests
@@ -622,3 +623,6 @@ psql-container:
VERSION:
@echo "awx: $(VERSION)"
+
+Dockerfile: installer/roles/image_build/templates/Dockerfile.j2
+ ansible localhost -m template -a "src=installer/roles/image_build/templates/Dockerfile.j2 dest=Dockerfile"
diff --git a/awx/main/management/commands/inventory_import.py b/awx/main/management/commands/inventory_import.py
index 30529cdf72..a86cc3db48 100644
--- a/awx/main/management/commands/inventory_import.py
+++ b/awx/main/management/commands/inventory_import.py
@@ -133,7 +133,7 @@ class AnsibleInventoryLoader(object):
# NOTE: why do we add "python" to the start of these args?
# the script that runs ansible-inventory specifies a python interpreter
# that makes no sense in light of the fact that we put all the dependencies
- # inside of /venv/ansible, so we override the specified interpreter
+ # inside of /var/lib/awx/venv/ansible, so we override the specified interpreter
# https://github.com/ansible/ansible/issues/50714
bargs = ['python', ansible_inventory_path, '-i', self.source]
bargs.extend(['--playbook-dir', functioning_dir(self.source)])
diff --git a/awx/main/tests/functional/models/test_job.py b/awx/main/tests/functional/models/test_job.py
index ac8912506f..c6c4d2d6e6 100644
--- a/awx/main/tests/functional/models/test_job.py
+++ b/awx/main/tests/functional/models/test_job.py
@@ -16,7 +16,7 @@ def test_awx_virtualenv_from_settings(inventory, project, machine_credential):
)
jt.credentials.add(machine_credential)
job = jt.create_unified_job()
- assert job.ansible_virtualenv_path == '/venv/ansible'
+ assert job.ansible_virtualenv_path == '/var/lib/awx/venv/ansible'
@pytest.mark.django_db
@@ -43,28 +43,28 @@ def test_awx_custom_virtualenv(inventory, project, machine_credential, organizat
jt.credentials.add(machine_credential)
job = jt.create_unified_job()
- job.organization.custom_virtualenv = '/venv/fancy-org'
+ job.organization.custom_virtualenv = '/var/lib/awx/venv/fancy-org'
job.organization.save()
- assert job.ansible_virtualenv_path == '/venv/fancy-org'
+ assert job.ansible_virtualenv_path == '/var/lib/awx/venv/fancy-org'
- job.project.custom_virtualenv = '/venv/fancy-proj'
+ job.project.custom_virtualenv = '/var/lib/awx/venv/fancy-proj'
job.project.save()
- assert job.ansible_virtualenv_path == '/venv/fancy-proj'
+ assert job.ansible_virtualenv_path == '/var/lib/awx/venv/fancy-proj'
- job.job_template.custom_virtualenv = '/venv/fancy-jt'
+ job.job_template.custom_virtualenv = '/var/lib/awx/venv/fancy-jt'
job.job_template.save()
- assert job.ansible_virtualenv_path == '/venv/fancy-jt'
+ assert job.ansible_virtualenv_path == '/var/lib/awx/venv/fancy-jt'
@pytest.mark.django_db
def test_awx_custom_virtualenv_without_jt(project):
- project.custom_virtualenv = '/venv/fancy-proj'
+ project.custom_virtualenv = '/var/lib/awx/venv/fancy-proj'
project.save()
job = Job(project=project)
job.save()
job = Job.objects.get(pk=job.id)
- assert job.ansible_virtualenv_path == '/venv/fancy-proj'
+ assert job.ansible_virtualenv_path == '/var/lib/awx/venv/fancy-proj'
@pytest.mark.django_db
diff --git a/awx/main/tests/unit/test_tasks.py b/awx/main/tests/unit/test_tasks.py
index f94c70c739..b1c7765328 100644
--- a/awx/main/tests/unit/test_tasks.py
+++ b/awx/main/tests/unit/test_tasks.py
@@ -180,7 +180,7 @@ def test_openstack_client_config_generation(mocker, source, expected, private_da
'source_vars_dict': {},
'get_cloud_credential': mocker.Mock(return_value=credential),
'get_extra_credentials': lambda x: [],
- 'ansible_virtualenv_path': '/venv/foo'
+ 'ansible_virtualenv_path': '/var/lib/awx/venv/foo'
})
cloud_config = update.build_private_data(inventory_update, private_data_dir)
cloud_credential = yaml.safe_load(
@@ -224,7 +224,7 @@ def test_openstack_client_config_generation_with_project_domain_name(mocker, sou
'source_vars_dict': {},
'get_cloud_credential': mocker.Mock(return_value=credential),
'get_extra_credentials': lambda x: [],
- 'ansible_virtualenv_path': '/venv/foo'
+ 'ansible_virtualenv_path': '/var/lib/awx/venv/foo'
})
cloud_config = update.build_private_data(inventory_update, private_data_dir)
cloud_credential = yaml.safe_load(
@@ -267,7 +267,7 @@ def test_openstack_client_config_generation_with_private_source_vars(mocker, sou
'source_vars_dict': {'private': source},
'get_cloud_credential': mocker.Mock(return_value=credential),
'get_extra_credentials': lambda x: [],
- 'ansible_virtualenv_path': '/venv/foo'
+ 'ansible_virtualenv_path': '/var/lib/awx/venv/foo'
})
cloud_config = update.build_private_data(inventory_update, private_data_dir)
cloud_credential = yaml.load(
@@ -625,13 +625,13 @@ class TestGenericRun():
def test_invalid_custom_virtualenv(self, patch_Job, private_data_dir):
job = Job(project=Project(), inventory=Inventory())
- job.project.custom_virtualenv = '/venv/missing'
+ job.project.custom_virtualenv = '/var/lib/awx/venv/missing'
task = tasks.RunJob()
with pytest.raises(tasks.InvalidVirtualenvError) as e:
task.build_env(job, private_data_dir)
- assert 'Invalid virtual environment selected: /venv/missing' == str(e.value)
+ assert 'Invalid virtual environment selected: /var/lib/awx/venv/missing' == str(e.value)
class TestAdhocRun(TestJobExecution):
diff --git a/awx/settings/development.py b/awx/settings/development.py
index 108767b98c..9846705fa5 100644
--- a/awx/settings/development.py
+++ b/awx/settings/development.py
@@ -148,9 +148,9 @@ 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 = '/vendor/awx_ansible_collections'
+AWX_ANSIBLE_COLLECTIONS_PATHS = '/var/lib/awx/vendor/awx_ansible_collections'
-BASE_VENV_PATH = "/venv/"
+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")
diff --git a/awx/settings/local_settings.py.docker_compose b/awx/settings/local_settings.py.docker_compose
index 213f4efe4b..f853f35e12 100644
--- a/awx/settings/local_settings.py.docker_compose
+++ b/awx/settings/local_settings.py.docker_compose
@@ -53,7 +53,7 @@ if "pytest" in sys.modules:
PROJECTS_ROOT = '/var/lib/awx/projects/'
# Location for cross-development of inventory plugins
-AWX_ANSIBLE_COLLECTIONS_PATHS = '/vendor/awx_ansible_collections'
+AWX_ANSIBLE_COLLECTIONS_PATHS = '/var/lib/awx/vendor/awx_ansible_collections'
# Absolute filesystem path to the directory for job status stdout
# This directory should not be web-accessible
diff --git a/awx/ui_next/src/components/AnsibleSelect/AnsibleSelect.test.jsx b/awx/ui_next/src/components/AnsibleSelect/AnsibleSelect.test.jsx
index d9bd7c669d..ced058754a 100644
--- a/awx/ui_next/src/components/AnsibleSelect/AnsibleSelect.test.jsx
+++ b/awx/ui_next/src/components/AnsibleSelect/AnsibleSelect.test.jsx
@@ -6,12 +6,12 @@ const mockData = [
{
key: 'baz',
label: 'Baz',
- value: '/venv/baz/',
+ value: '/var/lib/awx/venv/baz/',
},
{
key: 'default',
label: 'Default',
- value: '/venv/ansible/',
+ value: '/var/lib/awx/venv/ansible/',
},
];
diff --git a/awx/ui_next/src/screens/Host/data.hostFacts.json b/awx/ui_next/src/screens/Host/data.hostFacts.json
index a8427e0003..2507d267e3 100644
--- a/awx/ui_next/src/screens/Host/data.hostFacts.json
+++ b/awx/ui_next/src/screens/Host/data.hostFacts.json
@@ -83,7 +83,7 @@
"PWD": "/tmp/awx_13_r1ffeqze/project",
"HOME": "/var/lib/awx",
"LANG": "\"en-us\"",
- "PATH": "/venv/ansible/bin:/venv/awx/bin:/venv/awx/bin:/usr/local/n/versions/node/10.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
+ "PATH": "/var/lib/awx/venv/ansible/bin:/var/lib/awx/venv/awx/bin:/var/lib/awx/venv/awx/bin:/usr/local/n/versions/node/10.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"SHLVL": "4",
"JOB_ID": "13",
"LC_ALL": "en_US.UTF-8",
@@ -96,9 +96,9 @@
"SDB_PORT": "7899",
"MAKEFLAGS": "w",
"MAKELEVEL": "2",
- "PYTHONPATH": "/venv/ansible/lib/python3.6/site-packages:/awx_devel/awx/lib:/venv/awx/lib/python3.6/site-packages/ansible_runner/callbacks",
+ "PYTHONPATH": "/var/lib/awx/venv/ansible/lib/python3.6/site-packages:/awx_devel/awx/lib:/var/lib/awx/venv/awx/lib/python3.6/site-packages/ansible_runner/callbacks",
"CURRENT_UID": "501",
- "VIRTUAL_ENV": "/venv/ansible",
+ "VIRTUAL_ENV": "/var/lib/awx/venv/ansible",
"INVENTORY_ID": "1",
"MAX_EVENT_RES": "700000",
"PROOT_TMP_DIR": "/tmp",
@@ -106,7 +106,7 @@
"SDB_NOTIFY_HOST": "docker.for.mac.host.internal",
"AWX_GROUP_QUEUES": "tower",
"PROJECT_REVISION": "9e2cd25bfb26ba82f40cf31276e1942bf38b3a30",
- "ANSIBLE_VENV_PATH": "/venv/ansible",
+ "ANSIBLE_VENV_PATH": "/var/lib/awx/venv/ansible",
"ANSIBLE_ROLES_PATH": "/tmp/awx_13_r1ffeqze/requirements_roles:~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles",
"RUNNER_OMIT_EVENTS": "False",
"SUPERVISOR_ENABLED": "1",
@@ -119,7 +119,7 @@
"DJANGO_SETTINGS_MODULE": "awx.settings.development",
"ANSIBLE_STDOUT_CALLBACK": "awx_display",
"SUPERVISOR_PROCESS_NAME": "awx-dispatcher",
- "ANSIBLE_CALLBACK_PLUGINS": "/awx_devel/awx/plugins/callback:/venv/awx/lib/python3.6/site-packages/ansible_runner/callbacks",
+ "ANSIBLE_CALLBACK_PLUGINS": "/awx_devel/awx/plugins/callback:/var/lib/awx/venv/awx/lib/python3.6/site-packages/ansible_runner/callbacks",
"ANSIBLE_COLLECTIONS_PATHS": "/tmp/awx_13_r1ffeqze/requirements_collections:~/.ansible/collections:/usr/share/ansible/collections",
"ANSIBLE_HOST_KEY_CHECKING": "False",
"RUNNER_ONLY_FAILED_EVENTS": "False",
diff --git a/awx/ui_next/src/screens/Inventory/InventorySourceDetail/InventorySourceDetail.test.jsx b/awx/ui_next/src/screens/Inventory/InventorySourceDetail/InventorySourceDetail.test.jsx
index 1071b91cc3..50a0f13f67 100644
--- a/awx/ui_next/src/screens/Inventory/InventorySourceDetail/InventorySourceDetail.test.jsx
+++ b/awx/ui_next/src/screens/Inventory/InventorySourceDetail/InventorySourceDetail.test.jsx
@@ -58,7 +58,7 @@ describe('InventorySourceDetail', () => {
assertDetail(wrapper, 'Description', 'mock description');
assertDetail(wrapper, 'Source', 'Sourced from a Project');
assertDetail(wrapper, 'Organization', 'Mock Org');
- assertDetail(wrapper, 'Ansible environment', '/venv/custom');
+ assertDetail(wrapper, 'Ansible environment', '/var/lib/awx/venv/custom');
assertDetail(wrapper, 'Project', 'Mock Project');
assertDetail(wrapper, 'Inventory file', 'foo');
assertDetail(wrapper, 'Verbosity', '2 (Debug)');
diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceForm.jsx
index f1286e9a2b..2b1cff9115 100644
--- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceForm.jsx
+++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceForm.jsx
@@ -55,7 +55,7 @@ const InventorySourceFormFields = ({ source, sourceOptions, i18n }) => {
const [venvField] = useField('custom_virtualenv');
const defaultVenv = {
label: i18n._(t`Use Default Ansible Environment`),
- value: '/venv/ansible/',
+ value: '/var/lib/awx/venv/ansible/',
key: 'default',
};
diff --git a/awx/ui_next/src/screens/Inventory/shared/data.hostFacts.json b/awx/ui_next/src/screens/Inventory/shared/data.hostFacts.json
index a8427e0003..2507d267e3 100644
--- a/awx/ui_next/src/screens/Inventory/shared/data.hostFacts.json
+++ b/awx/ui_next/src/screens/Inventory/shared/data.hostFacts.json
@@ -83,7 +83,7 @@
"PWD": "/tmp/awx_13_r1ffeqze/project",
"HOME": "/var/lib/awx",
"LANG": "\"en-us\"",
- "PATH": "/venv/ansible/bin:/venv/awx/bin:/venv/awx/bin:/usr/local/n/versions/node/10.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
+ "PATH": "/var/lib/awx/venv/ansible/bin:/var/lib/awx/venv/awx/bin:/var/lib/awx/venv/awx/bin:/usr/local/n/versions/node/10.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"SHLVL": "4",
"JOB_ID": "13",
"LC_ALL": "en_US.UTF-8",
@@ -96,9 +96,9 @@
"SDB_PORT": "7899",
"MAKEFLAGS": "w",
"MAKELEVEL": "2",
- "PYTHONPATH": "/venv/ansible/lib/python3.6/site-packages:/awx_devel/awx/lib:/venv/awx/lib/python3.6/site-packages/ansible_runner/callbacks",
+ "PYTHONPATH": "/var/lib/awx/venv/ansible/lib/python3.6/site-packages:/awx_devel/awx/lib:/var/lib/awx/venv/awx/lib/python3.6/site-packages/ansible_runner/callbacks",
"CURRENT_UID": "501",
- "VIRTUAL_ENV": "/venv/ansible",
+ "VIRTUAL_ENV": "/var/lib/awx/venv/ansible",
"INVENTORY_ID": "1",
"MAX_EVENT_RES": "700000",
"PROOT_TMP_DIR": "/tmp",
@@ -106,7 +106,7 @@
"SDB_NOTIFY_HOST": "docker.for.mac.host.internal",
"AWX_GROUP_QUEUES": "tower",
"PROJECT_REVISION": "9e2cd25bfb26ba82f40cf31276e1942bf38b3a30",
- "ANSIBLE_VENV_PATH": "/venv/ansible",
+ "ANSIBLE_VENV_PATH": "/var/lib/awx/venv/ansible",
"ANSIBLE_ROLES_PATH": "/tmp/awx_13_r1ffeqze/requirements_roles:~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles",
"RUNNER_OMIT_EVENTS": "False",
"SUPERVISOR_ENABLED": "1",
@@ -119,7 +119,7 @@
"DJANGO_SETTINGS_MODULE": "awx.settings.development",
"ANSIBLE_STDOUT_CALLBACK": "awx_display",
"SUPERVISOR_PROCESS_NAME": "awx-dispatcher",
- "ANSIBLE_CALLBACK_PLUGINS": "/awx_devel/awx/plugins/callback:/venv/awx/lib/python3.6/site-packages/ansible_runner/callbacks",
+ "ANSIBLE_CALLBACK_PLUGINS": "/awx_devel/awx/plugins/callback:/var/lib/awx/venv/awx/lib/python3.6/site-packages/ansible_runner/callbacks",
"ANSIBLE_COLLECTIONS_PATHS": "/tmp/awx_13_r1ffeqze/requirements_collections:~/.ansible/collections:/usr/share/ansible/collections",
"ANSIBLE_HOST_KEY_CHECKING": "False",
"RUNNER_ONLY_FAILED_EVENTS": "False",
diff --git a/awx/ui_next/src/screens/Inventory/shared/data.inventory_source.json b/awx/ui_next/src/screens/Inventory/shared/data.inventory_source.json
index ad1e313611..550cb8138e 100644
--- a/awx/ui_next/src/screens/Inventory/shared/data.inventory_source.json
+++ b/awx/ui_next/src/screens/Inventory/shared/data.inventory_source.json
@@ -98,7 +98,7 @@
"credential": 8,
"overwrite":true,
"overwrite_vars":true,
- "custom_virtualenv":"/venv/custom",
+ "custom_virtualenv":"/var/lib/awx/venv/custom",
"timeout":0,
"verbosity":2,
"last_job_run":null,
diff --git a/awx/ui_next/src/screens/Job/shared/data.job.json b/awx/ui_next/src/screens/Job/shared/data.job.json
index 8bebbbda67..98d071c876 100644
--- a/awx/ui_next/src/screens/Job/shared/data.job.json
+++ b/awx/ui_next/src/screens/Job/shared/data.job.json
@@ -114,7 +114,7 @@
"started": "2019-08-08T19:24:18.329589Z",
"finished": "2019-08-08T19:24:50.119995Z",
"elapsed": 31.79,
- "job_args": "[\"bwrap\", \"--unshare-pid\", \"--dev-bind\", \"/\", \"/\", \"--proc\", \"/proc\", \"--bind\", \"/tmp/ansible_runner_pi_pzufy15c/ansible_runner_pi_r_aeukpy/tmpvsg8ly2y\", \"/etc/ssh\", \"--bind\", \"/tmp/ansible_runner_pi_pzufy15c/ansible_runner_pi_r_aeukpy/tmpq_grmdym\", \"/projects\", \"--bind\", \"/tmp/ansible_runner_pi_pzufy15c/ansible_runner_pi_r_aeukpy/tmpfq8ea2z6\", \"/tmp\", \"--bind\", \"/tmp/ansible_runner_pi_pzufy15c/ansible_runner_pi_r_aeukpy/tmpq6v4y_tt\", \"/var/lib/awx\", \"--bind\", \"/tmp/ansible_runner_pi_pzufy15c/ansible_runner_pi_r_aeukpy/tmpupj_jhhb\", \"/var/log\", \"--ro-bind\", \"/venv/ansible\", \"/venv/ansible\", \"--ro-bind\", \"/venv/awx\", \"/venv/awx\", \"--bind\", \"/projects/_6__demo_project\", \"/projects/_6__demo_project\", \"--bind\", \"/tmp/awx_2_a4b1afiw\", \"/tmp/awx_2_a4b1afiw\", \"--chdir\", \"/projects/_6__demo_project\", \"ansible-playbook\", \"-u\", \"admin\", \"-i\", \"/tmp/awx_2_a4b1afiw/tmppb57i4_e\", \"-e\", \"@/tmp/awx_2_a4b1afiw/env/extravars\", \"chatty_tasks.yml\"]",
+ "job_args": "[\"bwrap\", \"--unshare-pid\", \"--dev-bind\", \"/\", \"/\", \"--proc\", \"/proc\", \"--bind\", \"/tmp/ansible_runner_pi_pzufy15c/ansible_runner_pi_r_aeukpy/tmpvsg8ly2y\", \"/etc/ssh\", \"--bind\", \"/tmp/ansible_runner_pi_pzufy15c/ansible_runner_pi_r_aeukpy/tmpq_grmdym\", \"/projects\", \"--bind\", \"/tmp/ansible_runner_pi_pzufy15c/ansible_runner_pi_r_aeukpy/tmpfq8ea2z6\", \"/tmp\", \"--bind\", \"/tmp/ansible_runner_pi_pzufy15c/ansible_runner_pi_r_aeukpy/tmpq6v4y_tt\", \"/var/lib/awx\", \"--bind\", \"/tmp/ansible_runner_pi_pzufy15c/ansible_runner_pi_r_aeukpy/tmpupj_jhhb\", \"/var/log\", \"--ro-bind\", \"/var/lib/awx/venv/ansible\", \"/var/lib/awx/venv/ansible\", \"--ro-bind\", \"/var/lib/awx/venv/awx\", \"/var/lib/awx/venv/awx\", \"--bind\", \"/projects/_6__demo_project\", \"/projects/_6__demo_project\", \"--bind\", \"/tmp/awx_2_a4b1afiw\", \"/tmp/awx_2_a4b1afiw\", \"--chdir\", \"/projects/_6__demo_project\", \"ansible-playbook\", \"-u\", \"admin\", \"-i\", \"/tmp/awx_2_a4b1afiw/tmppb57i4_e\", \"-e\", \"@/tmp/awx_2_a4b1afiw/env/extravars\", \"chatty_tasks.yml\"]",
"job_cwd": "/projects/_6__demo_project",
"job_env": {
"HOSTNAME": "awx",
@@ -123,9 +123,9 @@
"LC_ALL": "en_US.UTF-8",
"SDB_HOST": "0.0.0.0",
"MAKELEVEL": "2",
- "VIRTUAL_ENV": "/venv/ansible",
+ "VIRTUAL_ENV": "/var/lib/awx/venv/ansible",
"MFLAGS": "-w",
- "PATH": "/venv/ansible/bin:/venv/awx/bin:/venv/awx/bin:/usr/local/n/versions/node/10.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
+ "PATH": "/var/lib/awx/venv/ansible/bin:/var/lib/awx/venv/awx/bin:/var/lib/awx/venv/awx/bin:/usr/local/n/versions/node/10.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"SUPERVISOR_GROUP_NAME": "tower-processes",
"PWD": "/awx_devel",
"LANG": "\"en-us\"",
@@ -138,7 +138,7 @@
"SUPERVISOR_SERVER_URL": "unix:///tmp/supervisor.sock",
"SUPERVISOR_PROCESS_NAME": "awx-dispatcher",
"CURRENT_UID": "501",
- "_": "/venv/awx/bin/python3",
+ "_": "/var/lib/awx/venv/awx/bin/python3",
"DJANGO_SETTINGS_MODULE": "awx.settings.development",
"DJANGO_LIVE_TEST_SERVER_ADDRESS": "localhost:9013-9199",
"SDB_NOTIFY_HOST": "docker.for.mac.host.internal",
@@ -147,11 +147,11 @@
"ANSIBLE_HOST_KEY_CHECKING": "False",
"ANSIBLE_INVENTORY_UNPARSED_FAILED": "True",
"ANSIBLE_PARAMIKO_RECORD_HOST_KEYS": "False",
- "ANSIBLE_VENV_PATH": "/venv/ansible",
+ "ANSIBLE_VENV_PATH": "/var/lib/awx/venv/ansible",
"PROOT_TMP_DIR": "/tmp",
"AWX_PRIVATE_DATA_DIR": "/tmp/awx_2_a4b1afiw",
"ANSIBLE_COLLECTIONS_PATHS": "/tmp/collections",
- "PYTHONPATH": "/venv/ansible/lib/python2.7/site-packages:/awx_devel/awx/lib:",
+ "PYTHONPATH": "/var/lib/awx/venv/ansible/lib/python2.7/site-packages:/awx_devel/awx/lib:",
"JOB_ID": "2",
"INVENTORY_ID": "1",
"PROJECT_REVISION": "23f070aad8e2da131d97ea98b42b553ccf0b0b82",
@@ -184,5 +184,5 @@
"play_count": 1,
"task_count": 1
},
- "custom_virtualenv": "/venv/ansible"
+ "custom_virtualenv": "/var/lib/awx/venv/ansible"
}
diff --git a/awx/ui_next/src/screens/Organization/OrganizationAdd/OrganizationAdd.test.jsx b/awx/ui_next/src/screens/Organization/OrganizationAdd/OrganizationAdd.test.jsx
index ff969b86b5..8fa4e2cbc2 100644
--- a/awx/ui_next/src/screens/Organization/OrganizationAdd/OrganizationAdd.test.jsx
+++ b/awx/ui_next/src/screens/Organization/OrganizationAdd/OrganizationAdd.test.jsx
@@ -153,7 +153,7 @@ describe('', () => {
.find('FormSelectOption')
.first()
.prop('value')
- ).toEqual('/venv/ansible/');
+ ).toEqual('/var/lib/awx/venv/ansible/');
});
test('AnsibleSelect component does not render if there are 0 virtual environments', async () => {
diff --git a/awx/ui_next/src/screens/Organization/shared/OrganizationForm.jsx b/awx/ui_next/src/screens/Organization/shared/OrganizationForm.jsx
index c78b178943..094e6ac5b6 100644
--- a/awx/ui_next/src/screens/Organization/shared/OrganizationForm.jsx
+++ b/awx/ui_next/src/screens/Organization/shared/OrganizationForm.jsx
@@ -31,7 +31,7 @@ function OrganizationFormFields({ i18n, instanceGroups, setInstanceGroups }) {
const defaultVenv = {
label: i18n._(t`Use Default Ansible Environment`),
- value: '/venv/ansible/',
+ value: '/var/lib/awx/venv/ansible/',
key: 'default',
};
const { custom_virtualenvs } = useContext(ConfigContext);
diff --git a/awx/ui_next/src/screens/Organization/shared/OrganizationForm.test.jsx b/awx/ui_next/src/screens/Organization/shared/OrganizationForm.test.jsx
index 004c7d1577..67cf0a60d6 100644
--- a/awx/ui_next/src/screens/Organization/shared/OrganizationForm.test.jsx
+++ b/awx/ui_next/src/screens/Organization/shared/OrganizationForm.test.jsx
@@ -200,7 +200,7 @@ describe('', () => {
.find('FormSelectOption')
.first()
.prop('value')
- ).toEqual('/venv/ansible/');
+ ).toEqual('/var/lib/awx/venv/ansible/');
});
test('onSubmit associates and disassociates instance groups', async () => {
diff --git a/awx/ui_next/src/screens/Project/ProjectAdd/ProjectAdd.test.jsx b/awx/ui_next/src/screens/Project/ProjectAdd/ProjectAdd.test.jsx
index e6141bebb7..8bc136b889 100644
--- a/awx/ui_next/src/screens/Project/ProjectAdd/ProjectAdd.test.jsx
+++ b/awx/ui_next/src/screens/Project/ProjectAdd/ProjectAdd.test.jsx
@@ -24,7 +24,7 @@ describe('', () => {
scm_update_on_launch: true,
scm_update_cache_timeout: 3,
allow_override: false,
- custom_virtualenv: '/venv/custom-env',
+ custom_virtualenv: '/var/lib/awx/venv/custom-env',
};
const projectOptionsResolve = {
diff --git a/awx/ui_next/src/screens/Project/ProjectEdit/ProjectEdit.test.jsx b/awx/ui_next/src/screens/Project/ProjectEdit/ProjectEdit.test.jsx
index dc1a49eb78..1a62a3f2f0 100644
--- a/awx/ui_next/src/screens/Project/ProjectEdit/ProjectEdit.test.jsx
+++ b/awx/ui_next/src/screens/Project/ProjectEdit/ProjectEdit.test.jsx
@@ -25,7 +25,7 @@ describe('', () => {
scm_update_on_launch: true,
scm_update_cache_timeout: 3,
allow_override: false,
- custom_virtualenv: '/venv/custom-env',
+ custom_virtualenv: '/var/lib/awx/venv/custom-env',
summary_fields: {
credential: {
id: 100,
diff --git a/awx/ui_next/src/screens/Project/shared/ProjectForm.jsx b/awx/ui_next/src/screens/Project/shared/ProjectForm.jsx
index fe0c8b1bb2..c5b454246f 100644
--- a/awx/ui_next/src/screens/Project/shared/ProjectForm.jsx
+++ b/awx/ui_next/src/screens/Project/shared/ProjectForm.jsx
@@ -284,11 +284,11 @@ function ProjectFormFields({
data={[
{
label: i18n._(t`Use Default Ansible Environment`),
- value: '/venv/ansible/',
+ value: '/var/lib/awx/venv/ansible/',
key: 'default',
},
...custom_virtualenvs
- .filter(datum => datum !== '/venv/ansible/')
+ .filter(datum => datum !== '/var/lib/awx/venv/ansible/')
.map(datum => ({
label: datum,
value: datum,
diff --git a/awx/ui_next/src/screens/Project/shared/ProjectForm.test.jsx b/awx/ui_next/src/screens/Project/shared/ProjectForm.test.jsx
index 03defe391a..7e88bc7f10 100644
--- a/awx/ui_next/src/screens/Project/shared/ProjectForm.test.jsx
+++ b/awx/ui_next/src/screens/Project/shared/ProjectForm.test.jsx
@@ -22,7 +22,7 @@ describe('', () => {
scm_update_on_launch: true,
scm_update_cache_timeout: 3,
allow_override: false,
- custom_virtualenv: '/venv/custom-env',
+ custom_virtualenv: '/var/lib/awx/venv/custom-env',
summary_fields: {
credential: {
id: 100,
diff --git a/awx_collection/plugins/modules/tower_project.py b/awx_collection/plugins/modules/tower_project.py
index 3e6d6ab442..ca848e7d69 100644
--- a/awx_collection/plugins/modules/tower_project.py
+++ b/awx_collection/plugins/modules/tower_project.py
@@ -153,7 +153,7 @@ EXAMPLES = '''
organization: "test"
scm_update_on_launch: True
scm_update_cache_timeout: 60
- custom_virtualenv: "/var/lib/awx/venv/ansible-2.2"
+ custom_virtualenv: "/var/lib/awx/var/lib/awx/venv/ansible-2.2"
state: present
tower_config_file: "~/tower_cli.cfg"
'''
diff --git a/awx_collection/test/awx/test_inventory_source.py b/awx_collection/test/awx/test_inventory_source.py
index 1bced2eb67..3e65feaddb 100644
--- a/awx_collection/test/awx/test_inventory_source.py
+++ b/awx_collection/test/awx/test_inventory_source.py
@@ -133,10 +133,10 @@ def test_custom_venv_no_op(run_module, admin_user, base_inventory, mocker, proje
inventory=base_inventory,
source_project=project,
source='scm',
- custom_virtualenv='/venv/foobar/'
+ custom_virtualenv='/var/lib/awx/venv/foobar/'
)
# mock needed due to API behavior, not incorrect client behavior
- with mocker.patch('awx.main.models.mixins.get_custom_venv_choices', return_value=['/venv/foobar/']):
+ with mocker.patch('awx.main.models.mixins.get_custom_venv_choices', return_value=['/var/lib/awx/venv/foobar/']):
result = run_module('tower_inventory_source', dict(
name='foo',
description='this is the changed description',
@@ -148,7 +148,7 @@ def test_custom_venv_no_op(run_module, admin_user, base_inventory, mocker, proje
), admin_user)
assert result.pop('changed', None), result
inv_src.refresh_from_db()
- assert inv_src.custom_virtualenv == '/venv/foobar/'
+ assert inv_src.custom_virtualenv == '/var/lib/awx/venv/foobar/'
assert inv_src.description == 'this is the changed description'
diff --git a/installer/build.yml b/installer/build.yml
index 8ef6f2b1ce..0bea5821e3 100644
--- a/installer/build.yml
+++ b/installer/build.yml
@@ -1,6 +1,6 @@
---
- name: Build AWX Docker Images
- hosts: all
+ hosts: localhost
gather_facts: true
roles:
- {role: image_build}
diff --git a/installer/inventory b/installer/inventory
index 89d0684a70..d4596f5d96 100644
--- a/installer/inventory
+++ b/installer/inventory
@@ -101,17 +101,6 @@ pg_port=5432
# containerized postgres deployment on OpenShift
# pg_admin_password=postgrespass
-# Use a local distribution build container image for building the AWX package
-# This is helpful if you don't want to bother installing the build-time dependencies as
-# it is taken care of already.
-# NOTE: IMPORTANT: If you are running a mininshift install, using this container might not work
-# if you are using certain drivers like KVM where the source tree can't be mapped
-# into the build container.
-# Thus this setting must be set to False which will trigger a local build. To view the
-# typical dependencies that you might need to install see:
-# installer/image_build/files/Dockerfile.sdist
-# use_container_for_build=true
-
# This will create or update a default admin (superuser) account in AWX, if not provided
# then these default values are used
admin_user=admin
diff --git a/installer/roles/image_build/files/Dockerfile.sdist b/installer/roles/image_build/files/Dockerfile.sdist
deleted file mode 100644
index c4ed45477f..0000000000
--- a/installer/roles/image_build/files/Dockerfile.sdist
+++ /dev/null
@@ -1,22 +0,0 @@
-FROM centos:8
-
-RUN dnf -y update && dnf -y install epel-release && \
- dnf install -y bzip2 \
- gcc-c++ \
- gettext \
- git \
- make \
- nodejs \
- python3 \
- python3-setuptools
-
-# Use the distro provided npm to bootstrap our required version of node
-RUN npm install -g n && n 14.15.1 && dnf remove -y nodejs
-
-RUN mkdir -p /.npm && chmod g+rwx /.npm
-
-ENV PATH=/usr/local/n/versions/node/14.15.1/bin:$PATH
-
-WORKDIR "/awx"
-
-CMD ["make", "sdist"]
diff --git a/installer/roles/image_build/tasks/main.yml b/installer/roles/image_build/tasks/main.yml
index 46add2552c..463e12ec73 100644
--- a/installer/roles/image_build/tasks/main.yml
+++ b/installer/roles/image_build/tasks/main.yml
@@ -7,7 +7,6 @@
- name: Verify awx-logos directory exists for official install
stat:
path: "../../awx-logos"
- delegate_to: localhost
register: logosdir
failed_when: logosdir.stat.isdir is not defined or not logosdir.stat.isdir
when: awx_official|default(false)|bool
@@ -16,79 +15,8 @@
copy:
src: "../../awx-logos/awx/ui/client/assets/"
dest: "../awx/ui_next/public/static/media/"
- delegate_to: localhost
when: awx_official|default(false)|bool
-- name: Set sdist file name
- set_fact:
- awx_sdist_file: "awx-{{ awx_version }}.tar.gz"
-
-- name: AWX Distribution
- debug:
- msg: "{{ awx_sdist_file }}"
-
-- name: Stat distribution file
- stat:
- path: "../dist/{{ awx_sdist_file }}"
- delegate_to: localhost
- register: sdist
-
-- name: Clean distribution
- command: make clean
- args:
- chdir: ..
- ignore_errors: true
- when: not sdist.stat.exists
- delegate_to: localhost
-
-- name: Build sdist builder image
- docker_image:
- build:
- path: "{{ role_path }}/files"
- dockerfile: Dockerfile.sdist
- pull: false
- args:
- http_proxy: "{{ http_proxy | default('') }}"
- https_proxy: "{{ https_proxy | default('') }}"
- no_proxy: "{{ no_proxy | default('') }}"
- name: awx_sdist_builder
- tag: "{{ awx_version }}"
- source: 'build'
- force_source: true
- delegate_to: localhost
- when: use_container_for_build|default(true)|bool
-
-- name: Get current uid
- command: id -u
- register: uid
-
-- name: Build AWX distribution using container
- docker_container:
- env:
- http_proxy: "{{ http_proxy | default('') }}"
- https_proxy: "{{ https_proxy | default('') }}"
- no_proxy: "{{ no_proxy | default('') }}"
- image: "awx_sdist_builder:{{ awx_version }}"
- name: awx_sdist_builder
- state: started
- user: "{{ uid.stdout }}"
- detach: false
- volumes:
- - ../:/awx:Z
- delegate_to: localhost
- when: use_container_for_build|default(true)|bool
-
-- name: Build AWX distribution locally
- command: make sdist
- args:
- chdir: ..
- delegate_to: localhost
- when: not use_container_for_build|default(true)|bool
-
-- name: Set docker build base path
- set_fact:
- docker_base_path: "{{ awx_local_base_config_path|default('/tmp') }}/docker-image"
-
- name: Set awx image name
set_fact:
awx_image: "{{ awx_image|default('awx') }}"
@@ -98,31 +26,11 @@
src: Dockerfile.j2
dest: ../Dockerfile
-- name: Build base awx image
- docker_image:
- build:
- path: ".."
- dockerfile: Dockerfile
- pull: false
- args:
- http_proxy: "{{ http_proxy | default('') }}"
- https_proxy: "{{ https_proxy | default('') }}"
- no_proxy: "{{ no_proxy | default('') }}"
- name: "{{ awx_image }}"
- tag: "{{ awx_version }}"
- source: 'build'
- force_source: true
- delegate_to: localhost
+# Calling Docker directly because docker-py doesnt support BuildKit
+- name: Build AWX image
+ command: docker build -t {{ awx_image }}:{{ awx_version }} ..
- name: Tag awx images as latest
command: "docker tag {{ item }}:{{ awx_version }} {{ item }}:latest"
- delegate_to: localhost
with_items:
- "{{ awx_image }}"
-
-- name: Clean docker base directory
- file:
- path: "{{ docker_base_path }}"
- state: absent
- when: cleanup_docker_base|default(True)|bool
- delegate_to: localhost
diff --git a/installer/roles/image_build/templates/Dockerfile.j2 b/installer/roles/image_build/templates/Dockerfile.j2
index 64417060c7..ebbd4f885e 100644
--- a/installer/roles/image_build/templates/Dockerfile.j2
+++ b/installer/roles/image_build/templates/Dockerfile.j2
@@ -1,21 +1,19 @@
-{% if build_dev|bool %}
+{% if build_dev|default(False)|bool %}
### This file is generated from
### installer/roles/image_build/templates/Dockerfile.j2
###
### DO NOT EDIT
###
+{% else %}
+ {% set build_dev = False %}
{% endif %}
# Locations - set globally to be used across stages
-ARG VENV_BASE="{% if not build_dev|bool %}/var/lib/awx{% endif %}/venv"
-ARG COLLECTION_BASE="{% if not build_dev|bool %}/var/lib/awx{% endif %}/vendor/awx_ansible_collections"
+ARG COLLECTION_BASE="/var/lib/awx/vendor/awx_ansible_collections"
# Build container
FROM centos:8 as builder
-ARG VENV_BASE
-ARG COLLECTION_BASE
-
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
@@ -72,16 +70,21 @@ RUN cd /tmp && make requirements_collections
ADD requirements/requirements_dev.txt /tmp/requirements
RUN cd /tmp && make requirements_awx_dev requirements_ansible_dev
{% endif %}
+
{% if not build_dev|bool %}
-COPY dist/{{ awx_sdist_file }} /tmp/{{ awx_sdist_file }}
-RUN mkdir -p -m 755 /var/lib/awx && \
- OFFICIAL=yes /var/lib/awx/venv/awx/bin/pip install /tmp/{{ awx_sdist_file }}
+# Use the distro provided npm to bootstrap our required version of node
+RUN npm install -g n && n 14.15.1 && dnf remove -y nodejs
+
+# Copy source into builder, build sdist, install it into awx venv
+COPY . /tmp/src/
+WORKDIR /tmp/src/
+RUN make sdist && \
+ /var/lib/awx/venv/awx/bin/pip install dist/awx-$(cat VERSION).tar.gz
{% endif %}
# Final container(s)
FROM centos:8
-ARG VENV_BASE
ARG COLLECTION_BASE
ENV LANG en_US.UTF-8
@@ -90,28 +93,6 @@ ENV LC_ALL en_US.UTF-8
USER root
-{% if build_dev|bool %}
-# Install development/test requirements
-RUN dnf -y install \
- gtk3 \
- gettext \
- alsa-lib \
- libX11-xcb \
- libXScrnSaver \
- strace \
- vim \
- nmap-ncat \
- nodejs \
- nss \
- make \
- patch \
- tmux \
- wget \
- diffutils \
- unzip && \
- npm install -g n && n 14.15.1 && dnf remove -y nodejs
-{% endif %}
-
# Install runtime requirements
RUN dnf -y update && \
dnf -y install epel-release 'dnf-command(config-manager)' && \
@@ -163,16 +144,40 @@ RUN cd /usr/local/bin && \
curl -L https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz | \
tar -xz --strip-components=1 --wildcards --no-anchored 'oc'
+{% if build_dev|bool %}
+# Install development/test requirements
+RUN dnf --enablerepo=debuginfo -y install \
+ gdb \
+ gtk3 \
+ gettext \
+ alsa-lib \
+ libX11-xcb \
+ libXScrnSaver \
+ strace \
+ vim \
+ nmap-ncat \
+ nodejs \
+ nss \
+ make \
+ patch \
+ python3-debuginfo \
+ socat \
+ tmux \
+ wget \
+ diffutils \
+ unzip && \
+ npm install -g n && n 14.15.1 && dnf remove -y nodejs
+{% endif %}
+
# Copy app from builder
+COPY --from=builder /var/lib/awx /var/lib/awx
+
{%if build_dev|bool %}
-COPY --from=builder /venv /venv
-COPY --from=builder /vendor /vendor
RUN openssl req -nodes -newkey rsa:2048 -keyout /etc/nginx/nginx.key -out /etc/nginx/nginx.csr \
-subj "/C=US/ST=North Carolina/L=Durham/O=Ansible/OU=AWX Development/CN=awx.localhost" && \
openssl x509 -req -days 365 -in /etc/nginx/nginx.csr -signkey /etc/nginx/nginx.key -out /etc/nginx/nginx.crt && \
chmod 640 /etc/nginx/nginx.{csr,key,crt}
{% else %}
-COPY --from=builder /var/lib/awx /var/lib/awx
RUN ln -s /var/lib/awx/venv/awx/bin/awx-manage /usr/bin/awx-manage
{% endif %}
@@ -221,17 +226,17 @@ RUN chmod u+s /usr/bin/bwrap ; \
{% if build_dev|bool %}
RUN for dir in \
- /venv \
- /venv/awx/lib/python3.6 \
+ /var/lib/awx/venv \
+ /var/lib/awx/venv/awx/lib/python3.6 \
/var/lib/awx/projects \
/var/lib/awx/rsyslog \
/var/run/awx-rsyslog \
/.ansible \
- /vendor ; \
+ /var/lib/awx/vendor ; \
do mkdir -m 0775 -p $dir ; chmod g+rw $dir ; chgrp root $dir ; done && \
for file in \
/var/run/nginx.pid \
- /venv/awx/lib/python3.6/site-packages/awx.egg-link ; \
+ /var/lib/awx/venv/awx/lib/python3.6/site-packages/awx.egg-link ; \
do touch $file ; chmod g+rw $file ; done
{% endif %}
diff --git a/installer/roles/image_push/tasks/main.yml b/installer/roles/image_push/tasks/main.yml
index e005af1096..9561af8ac8 100644
--- a/installer/roles/image_push/tasks/main.yml
+++ b/installer/roles/image_push/tasks/main.yml
@@ -6,7 +6,6 @@
password: "{{ docker_registry_password }}"
reauthorize: true
when: docker_registry is defined and docker_registry_password is defined
- delegate_to: localhost
- name: Remove local images to ensure proper push behavior
block:
@@ -15,7 +14,6 @@
name: "{{ docker_registry }}/{{ docker_registry_repository }}/{{ awx_image }}"
tag: "{{ awx_version }}"
state: absent
- delegate_to: localhost
- name: Tag and Push Container Images
block:
@@ -28,7 +26,6 @@
with_items:
- "latest"
- "{{ awx_version }}"
- delegate_to: localhost
- name: Set full image path for Registry
set_fact:
diff --git a/pytest.ini b/pytest.ini
index ff89dc85f3..fc407b5f17 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -1,7 +1,7 @@
[pytest]
DJANGO_SETTINGS_MODULE = awx.settings.development
-python_paths = /venv/tower/lib/python3.6/site-packages
-site_dirs = /venv/tower/lib/python3.6/site-packages
+python_paths = /var/lib/awx/venv/tower/lib/python3.6/site-packages
+site_dirs = /var/lib/awx/venv/tower/lib/python3.6/site-packages
python_files = *.py
addopts = --reuse-db --nomigrations --tb=native
markers =
diff --git a/tools/scripts/awx-python b/tools/scripts/awx-python
index f2116c574c..00d5e7363e 100755
--- a/tools/scripts/awx-python
+++ b/tools/scripts/awx-python
@@ -9,7 +9,7 @@ for scl in rh-postgresql10; do
done
# Enable Tower virtualenv
-for venv_path in /var/lib/awx/venv/awx /venv/awx; do
+for venv_path in /var/lib/awx/venv/awx; do
if [ -f $venv_path/bin/activate ]; then
. $venv_path/bin/activate
fi