diff --git a/Makefile b/Makefile index 7c7e5d43ac..3f38633907 100644 --- a/Makefile +++ b/Makefile @@ -106,6 +106,12 @@ else DOCKER_KUBE_CACHE_FLAG=$(DOCKER_CACHE) endif +# AWX TUI variables +AWX_HOST ?= https://localhost:8043 +AWX_USER ?= admin +AWX_PASSWORD ?= $$(awk -F"'" '/^admin_password:/{print $$2}' tools/docker-compose/_sources/secrets/admin_password.yml 2>/dev/null || echo "admin") +AWX_VERIFY_SSL ?= false + .PHONY: awx-link clean clean-tmp clean-venv requirements requirements_dev \ update_requirements upgrade_requirements update_requirements_dev \ docker_update_requirements docker_upgrade_requirements docker_update_requirements_dev \ @@ -571,6 +577,20 @@ docker-compose-runtest: awx/projects docker-compose-sources docker-compose-build-schema: awx/projects docker-compose-sources $(DOCKER_COMPOSE) -f tools/docker-compose/_sources/docker-compose.yml run --rm --service-ports --no-deps awx_1 make genschema +awx-tui: + @if ! command -v awx-tui > /dev/null 2>&1; then \ + $(PYTHON) -m pip install awx-tui; \ + fi + @if [ -f "$(HOME)/.config/awx-tui/config.yaml" ]; then \ + $(PYTHON) -m awx_tui.main; \ + else \ + AWX_HOST=$(AWX_HOST) \ + AWX_USER=$(AWX_USER) \ + AWX_PASSWORD=$(AWX_PASSWORD) \ + AWX_VERIFY_SSL=$(AWX_VERIFY_SSL) \ + $(PYTHON) -m awx_tui.main --host $(AWX_HOST); \ + fi + SCHEMA_DIFF_BASE_FOLDER ?= awx SCHEMA_DIFF_BASE_BRANCH ?= devel detect-schema-change: genschema diff --git a/requirements/requirements_dev.txt b/requirements/requirements_dev.txt index 76ea567d7a..d9848967bf 100644 --- a/requirements/requirements_dev.txt +++ b/requirements/requirements_dev.txt @@ -24,6 +24,7 @@ atomicwrites flake8 yamllint pip>=25.3 # PEP 660 – Editable installs for pyproject.toml based builds (wheel based) +awx-tui # python debuggers debugpy diff --git a/tools/docker-compose/bootstrap_development.sh b/tools/docker-compose/bootstrap_development.sh index 0f40881af1..26baac0f80 100755 --- a/tools/docker-compose/bootstrap_development.sh +++ b/tools/docker-compose/bootstrap_development.sh @@ -35,6 +35,30 @@ if output=$(ANSIBLE_REVERSE_RESOURCE_SYNC=false awx-manage createsuperuser --noi fi echo "Admin password: ${DJANGO_SUPERUSER_PASSWORD}" +# Configure awx-tui to connect to the local AWX instance +AWX_TUI_CONFIG_DIR="${HOME}/.config/awx-tui" +AWX_TUI_CONFIG_FILE="${AWX_TUI_CONFIG_DIR}/config.yaml" +mkdir -p "${AWX_TUI_CONFIG_DIR}" +python3 -c " +import yaml, os +config = { + 'instances': { + 'local': { + 'url': 'https://localhost:8043', + 'auth': { + 'method': 'password', + 'username': 'admin', + 'password': os.environ['DJANGO_SUPERUSER_PASSWORD'], + }, + 'verify_ssl': False, + } + } +} +with open('${AWX_TUI_CONFIG_FILE}', 'w') as f: + yaml.dump(config, f, default_flow_style=False) +" +chmod 600 "${AWX_TUI_CONFIG_FILE}" + ANSIBLE_REVERSE_RESOURCE_SYNC=false awx-manage create_preload_data awx-manage register_default_execution_environments