feat: integrate awx-tui to the awx_devel image (#16399)

This commit is contained in:
Adrià Sala
2026-04-14 10:08:19 +02:00
committed by GitHub
parent b8c9ae73cd
commit da996c01a0
3 changed files with 45 additions and 0 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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