개요

이번에는 AWX 22.1.0 버전을 도커 환경에서 간편하게(?) 설치하는 방법에 대해 알아본다.

기본적으로 AWX 18.0 버전부터는 AWX Operator를 사용하여 AWX를 설치하는 것이 권장된다. Docker 환경에 설치 및 실행할 수 있지만, 개발/테스트 용으로만 권장된다.


설치 시 주의사항

  • 2026.03.04 기준 아래의 방법으로 설치 및 정상 동작을 확인했다.
  • 내부적으로 CentOS 9 Stream 최신 버전의 컨테이너 이미지를 사용하면서 각 패키지들끼리 호환이 안되는 상황이 종종 일어난다.
  • awx 소스 코드 내부에서도 github를 통해 필요한 패키지들을 다운로드 받는데 특정 버전이 아닌 가장 최신 버전 또는 개발 버전을 설치하도록 되어 있어 마찬가지로 호환 문제로 설치가 제대로 안되는 상황이 일어난다.


설치 환경

Docker 환경에서 AWX를 설치할 때 사용한 환경을 기술한다. OS로 Rocky Linux 9을 사용하면서, dnf의 기본 리포지토리를 통해 설치할 수 파이썬 버전 (3.9.x)을 사용했음에 유의한다.

  • Rocky Linux 9.7
  • Docker 26.1.4
  • Docker-compose 2.35.1
  • Python 3.9.25
  • ansible 7.5.0


AWX 소스 다운로드

(awx) [ahrah@jslim106 awx-builder]$ git clone -b 22.1.0 https://github.com/ansible/awx.git awx-22.1.0
(awx) [ahrah@jslim106 awx-builder]$ cd awx-22.1.0


설치 관련 파일 수정

Dockerfile.j2

  • 컨테이너 이미지 생성 시 특정 버전의 패키지가 설치되도록 아래와 같이 변경

rsyslog

  • rsyslog-8.2102.0-106.el9
    • dnf 를 통해서는 설치할 수 없으므로 rpm 파일을 다운로드 받아 설치하도록 수정
    • 변경 전: rsyslog-8.2102.0-106.el9
    • 변경 후: https://download.copr.fedorainfracloud.org/results/ansible/Rsyslog/epel-9-x86_64/06076718-rsyslog/rsyslog-8.2102.0-106.el9.x86_64.rpm

podman

  • 최신 버전은 5.6.0 인데 해당 버전을 설치하게 되면 AWX에서 실행되는 작업 (job)이 실행 중에 아래와 같은 에러 메시지가 출력되면서 실패함
# podman 호환성 문제로 인한 오류
Traceback (most recent call last):
  File "/awx_devel/awx/main/tasks/receptor.py", line 437, in _run_internal
    lines = resultfile.readlines()
OSError: read() should have returned a bytes object, not 'NoneType'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/awx_devel/awx/main/tasks/jobs.py", line 604, in run
    res = receptor_job.run()
  File "/awx_devel/awx/main/tasks/receptor.py", line 317, in run
    res = self._run_internal(receptor_ctl)
  File "/awx_devel/awx/main/tasks/receptor.py", line 446, in _run_internal
    raise RuntimeError(detail)
RuntimeError: exit status 1
  • AWX 22.0.1 릴리즈 날짜와 비슷한 시기에 사용된 podman 4.4.1 을 설치하려고 하는데 CentOS Stream 9 에서는 해당 패키지 설치를 지원해주지 않으므로 Rocky Linux 9 리포지토리에서 podman 4.4.1 을 가지고와서 설치하도록 변경해준다.

  • 변경 전 : Dockerfile.j2

(awx) [ahrah@jslim106 awx-22.1.0]$ vi tools/ansible/roles/dockerfile/templates/Dockerfile.j2

~~~~ (생략) ~~~~

# Install runtime requirements
RUN dnf -y update && dnf install -y 'dnf-command(config-manager)' && \
    dnf config-manager --set-enabled crb && \
    dnf -y install acl \
    git-core \
    git-lfs \
    glibc-langpack-en \
    krb5-workstation \
    nginx \
    "openldap >= 2.6.2-3" \
    postgresql \
    python3-devel \
    python3-libselinux \
    python3-pip \
    python3-psycopg2 \
    python3-setuptools \
    rsync \
    rsyslog-8.2102.0-106.el9 \
    subversion \
    sudo \
    vim-minimal \
    which \
    unzip \
    xmlsec1-openssl && \
    dnf -y clean all

~~~~ (생략) ~~~~

RUN dnf install -y podman && rpm --restore shadow-utils 2>/dev/null

  • 변경 후 : Dockerfile.j2
(awx) [ahrah@jslim106 awx-22.1.0]$ vi tools/ansible/roles/dockerfile/templates/Dockerfile.j2

~~~~ (생략) ~~~~

# Install runtime requirements
RUN dnf -y update && dnf install -y 'dnf-command(config-manager)' && \
    dnf config-manager --set-enabled crb && \
    dnf -y install acl \
    git-core \
    git-lfs \
    glibc-langpack-en \
    krb5-workstation \
    nginx \
    "openldap >= 2.6.2-3" \
    postgresql \
    python3-devel \
    python3-libselinux \
    python3-pip \
    python3-psycopg2 \
    python3-setuptools \
    rsync \
    https://download.copr.fedorainfracloud.org/results/ansible/Rsyslog/epel-9-x86_64/06076718-rsyslog/rsyslog-8.2102.0-106.el9.x86_64.rpm \
    subversion \
    sudo \
    vim-minimal \
    which \
    unzip \
    xmlsec1-openssl && \
    dnf -y clean all
    
~~~~ (생략) ~~~~

RUN dnf install -y https://dl.rockylinux.org/vault/rocky/9.2/AppStream/x86_64/os/Packages/p/podman-4.4.1-13.el9_2.x86_64.rpm && rpm --restore shadow-utils 2>/dev/null


requirements

  • 이미지 설치 시 ansible-runner 를 설치하게 되는데 가장 최신 브랜치 (devel) 소스 코드를 사용한다. 문제는 최신 코드는 python 3.10 이상을 요구하지만 centos 9 stream 에서 dnf 로 설치하게 되는 가장 최신 버전은 python 3.9 이다. 이대로 놔두면 설치가 안되기 때문에 python 3.9 를 사용하는 ansible-runner 를 다운로드 받도록 아래와 같이 수정한다.
# 이대로 빌드할 경우 보게 되는 에러 메시지

~~~~ (생략) ~~~~

49.96 INFO: pip is looking at multiple versions of aiohttp to determine which version is compatible with other requirements. This could take a while.
49.96 INFO: pip is looking at multiple versions of adal to determine which version is compatible with other requirements. This could take a while.
49.96 ERROR: Package 'ansible-runner' requires a different Python: 3.9.23 not in '>=3.10'
49.96 WARNING: You are using pip version 21.2.4; however, version 25.2 is available.
49.96 You should consider upgrading via the '/var/lib/awx/venv/awx/bin/python3.9 -m pip install --upgrade pip' command.
50.78 make: *** [Makefile:142: requirements_awx] Error 1
------
Dockerfile:59
--------------------
  57 |         /tmp/requirements/
  58 |     
  59 | >>> RUN cd /tmp && make requirements_awx
  60 |     
  61 |     ARG VERSION
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c cd /tmp && make requirements_awx" did not complete successfully: exit code: 2
make: *** [Makefile:562: docker-compose-build] Error 1
  • 변경
    (awx) [ahrah@jslim106 awx]$ vi requirements/requirements_git.txt
    
  • 변경 전 : requirements_git.txt
    git+https://github.com/ansible/ansible-runner.git@devel#egg=ansible-runner
    
  • 변경 후 : requirements_git.txt
    git+https://github.com/ansible/ansible-runner.git@2.3.2#egg=ansible-runner
    


이미지 빌드

  • receptor 설치 시 AWX 22.1.0 이 출시된 2023.4.19 시기와 맞는 v.1.4.0.dev2 버전을 사용하도록 설정 후 이미지 빌드
    • 현재 사용하고 있는 AWX 22.1.0 컨테이너 내부에 설치된 receptor 버전이 1.4.0.dev2 라 기존 버전과 맞추기 위한 조치
(awx) [ahrah@jslim106 awx-22.1.0]$ export RECEPTOR_IMAGE=quay.io/ansible/receptor:v1.4.0.dev2

(awx) [ahrah@jslim106 awx]$ make docker-compose-build

(awx) [ahrah@jslim106 awx]$ docker images
REPOSITORY                  TAG       IMAGE ID       CREATED              SIZE
ghcr.io/ansible/awx_devel   HEAD      c82f3ea03494   About a minute ago   2.04GB

컨테이너 생성

(awx) [ahrah@jslim106 awx]$ make docker-compose COMPOSE_UP_OPTS=-d

(awx) [ahrah@jslim106 awx]$ docker ps -a
CONTAINER ID   IMAGE                            COMMAND                  CREATED          STATUS          PORTS                                                                                                                                                                                                                                                                                                                                                                                NAMES
c10994c6dfee   ghcr.io/ansible/awx_devel:HEAD   "/entrypoint.sh laun…"   36 seconds ago   Up 34 seconds   0.0.0.0:2222->2222/tcp, :::2222->2222/tcp, 0.0.0.0:6899->6899/tcp, :::6899->6899/tcp, 0.0.0.0:7899-7999->7899-7999/tcp, :::7899-7999->7899-7999/tcp, 0.0.0.0:8013->8013/tcp, :::8013->8013/tcp, 0.0.0.0:8043->8043/tcp, :::8043->8043/tcp, 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 22/tcp, 0.0.0.0:8888->8888/tcp, :::8888->8888/tcp, 0.0.0.0:3000->3001/tcp, :::3000->3001/tcp   tools_awx_1
480ced22f5cc   postgres:12                      "docker-entrypoint.s…"   49 seconds ago   Up 35 seconds   5432/tcp                                                                                                                                                                                                                                                                                                                                                                             tools_postgres_1
f844a97efea1   redis:latest                     "redis-server /usr/l…"   49 seconds ago   Up 35 seconds   6379/tcp                                                                                                                                                                                                                                                                                                                                                                             tools_redis_1
  • 컨테이너가 실행되면서 awx 내부의 패키지들이 설치되고 실행된다. 이 때 awx 접속용 admin 계정의 임시 패스워드가 로그에 출력된다. 아래와 같이 로그를 통해 확인한다.
(awx) [ahrah@jslim106 awx]$ docker logs -f tools_awx_1

~~~~ (생략) ~~~~

  Applying taggit.0004_alter_taggeditem_content_type_alter_taggeditem_tag... OK
  Applying taggit.0005_auto_20220424_2025... OK
Superuser created successfully.
Admin password: AOEKcLLDLaIuKnBKTqdz
Default organization added.
Demo Credential, Inventory, and Job Template added.

~~~~ (생략) ~~~~
  • ui 초기화
    • VM을 사용하는 경우 최소 10GB 이상이 필요하다.
(awx) [ahrah@jslim106 awx]$ docker exec tools_awx_1 make clean-ui ui-devel

~~~~ (생략) ~~~~

File sizes after gzip:

  908.58 kB  build/static/js/main.5a8f0ae4.js
  99.09 kB   build/static/css/main.e706ca3d.css
  61.87 kB   build/static/js/489.3819ec1a.chunk.js
  48.76 kB   build/static/js/118.95d6fd59.chunk.js
  45.7 kB    build/static/js/138.b38e12c9.chunk.js
  44.34 kB   build/static/js/787.f176f441.chunk.js
  44.07 kB   build/static/js/896.e61dac86.chunk.js
  43.21 kB   build/static/js/11.02c5663e.chunk.js
  42.29 kB   build/static/js/418.5971f1ef.chunk.js
  30.72 kB   build/static/js/311.86ad5143.chunk.js
  386 B      build/static/js/979.f16bcc0c.chunk.js

The bundle size is significantly larger than recommended.
Consider reducing it with code splitting: https://goo.gl/9VhYWB
You can also analyze the project dependencies: https://goo.gl/LeUzfb

The project was built assuming it is hosted at ./.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.

Find out more about deployment here:

  https://cra.link/deployment

touch awx/ui/.ui-built
make[1]: Leaving directory '/awx_devel'
(awx) [ahrah@jslim106 awx]$ 


AWX 접속

앞서 확인한 admin 의 임시 패스워드를 통해 접속한다. 접속 시 다음의 tcp 포트를 이용하면 된다.

  • http 포트 : TCP 8013
  • https 포트 : TCP 8043


참고자료

Docker Compose for Development

Run the latest Ansible AWX in Docker containers

Basic Setup and Use of Podman in a Rootless environment

태그: ,

카테고리:

Published:

Updated: