AWX를 CentOS 7에 Docker Container 기반으로 설치하는 방법을 기술한 문서임

 

설치 정보

  • 서버 구성 위치
    • vmware esxi 상의 VM
  • VM OS
    • CentOS 7.9
  • AWX 구성 형태
    • docker container

 

구성 과정

  • AWX 구성 과정
    • CentOS 7.9 에서 아래와 같이 순서대로 수행

- selinux, firewalld disable
# systemctl stop firewalld ; systemctl disable firewalld
# vi /etc/sysconfig/selinux
selinux=disabled
 
- Docker 및 Ansible 환경 구성
# yum install -y epel-release
# yum install -y yum-utils device-mapper-persistent-data lvm2 ansible git python-devel python-pip python-docker-py vim-enhanced wget net-tools
#### 아래 1줄은 생략할 것####
(# yum install docker-ce -y && systemctl start docker && systemctl enable docker)
# yum install dnf -y
# dnf install git gcc gcc-c++ ansible nodejs gettext device-mapper-persistent-data lvm2 bzip2 python3-pip -y
 
#### 아래 4줄은 생략할 것 ####
( # update-alternatives --config python
# update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
# update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2
# update-alternatives --config python )
 
# dnf install -y 'dnf-command(config-manager)'
# dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
# dnf install -y docker-ce-3:18.09.1-3.el7
# pip3 install --upgrade setuptools
# pip3 install setuptools-rust
# pip3 install wheel
# pip3 install "pip>=20"
# pip3 install docker-compose
 
- inventory에 넣을 키값 생성
# openssl rand -base64 30
dYdVs6g5p+ckjsAvvhC4vZFvZxjBJ1WA0T+0T3Qe  --> 메모장에 복사
 
- awx 설치 파일 다운로드 (15.0.0 버전 외의 다른 버전을 사용 시 이 문서대로 설치가 안될 수 있음)
# cd /root ; wget https://github.com/ansible/awx/archive/15.0.0.tar.gz
# tar zxvf 15.0.0.tar.gz
# ln -s awx-15.0.0/ awx
# mkdir /var/lib/pgdocker
# cd awx/installer
 
- awx deploy를 위한 ansible inventory 설정 (기존 inventory 내용을 모두 지우고 아래 설정만 넣어도 됨)
# vi inventory
localhost ansible_connection=local ansible_python_interpreter="/usr/bin/env python3"  --> 이 라인은 기본으로 존재 아래 [all:vars] 밑에 설정값 넣기
 
[all:vars]
dockerhub_base=ansible
awx_task_hostname=awx
awx_web_hostname=awxweb
postgres_data_dir="/var/lib/pgdocker"
host_port=80
host_port_ssl=443
docker_compose_dir="~/.awx/awxcompose"
pg_username=awx
pg_password=awxpass
pg_database=awx
pg_port=5432
pg_admin_password=password
rabbitmq_password=awxpass
rabbitmq_erlang_cookie=cookiemonster
admin_user=admin
admin_password=password
create_preload_data=True
secret_key=dYdVs6g5p+ckjsAvvhC4vZFvZxjBJ1WA0T+0T3Qe   ===> 위에서 복사한 openssl 값을 입력
awx_official=true
awx_alternate_dns_servers="8.8.8.8,8.8.4.4"
project_data_dir=/var/lib/awx/projects
 
 
 
- ansible playbook을 통해 deploy
# ansible-playbook -i inventory install.yml
 
 
- 구동중인 awx 컨테이너 확인
# docker ps
CONTAINER ID   IMAGE                COMMAND                  CREATED         STATUS              PORTS                  NAMES
b5e92a7c6b41   ansible/awx:15.0.0   "/usr/bin/tini -- /u…"   2 minutes ago   Up 2 minutes        8052/tcp               awx_task
5cc8f34de098   ansible/awx:15.0.0   "/usr/bin/tini -- /b…"   2 minutes ago   Up 2 minutes        0.0.0.0:80->8052/tcp   awx_web
ff8e6c29502a   postgres:10          "docker-entrypoint.s…"   2 minutes ago   Up About a minute   5432/tcp               awx_postgres
32cc3bea3554   redis                "docker-entrypoint.s…"   2 minutes ago   Up 2 minutes        6379/tcp               awx_redis

 

  • awx 접속
    • 웹브라우저 192.168.122.x

      -> 처음 접속 시 위와 같이 upgrade 화면이 출력되면서 진행이 무한루프 됨
    • docker restart 또는 OS를 재부팅한 후 접속하면 수분 후 login 창이 뜸.

# docker ps
CONTAINER ID   IMAGE                COMMAND                  CREATED        STATUS          PORTS                  NAMES
1a6496707a04   ansible/awx:15.0.0   "/usr/bin/tini -- /u…"   18 hours ago   Up 14 seconds   8052/tcp               awx_task
7fa01d996838   ansible/awx:15.0.0   "/usr/bin/tini -- /b…"   18 hours ago   Up 14 seconds   0.0.0.0:80->8052/tcp   awx_web
5859936a18c3   postgres:10          "docker-entrypoint.s…"   18 hours ago   Up 14 seconds   5432/tcp               awx_postgres
31e70b33e4e1   redis                "docker-entrypoint.s…"   18 hours ago   Up 14 seconds   6379/tcp               awx_redis
 
# docker restart 1a6496707a04  7fa01d996838 5859936a18c3 31e70b33e4e1
1a6496707a04
7fa01d996838
5859936a18c3
31e70b33e4e1

 

    • 로그인 후 화면
Install AWX on CentOS 7
태그:                             

Install AWX on CentOS 7”에 대한 2개의 생각

  • 2022년 2월 13일 1:59 오전
    고유주소

    TASK [local_docker : Start the containers] **************************************************************************************************************************************************************************************************
    fatal: [localhost]: FAILED! => {"changed": false, "msg": "Cannot have both the docker-py and docker python modules (old and new version of Docker SDK for Python) installed together as they use the same namespace and cause a corrupt installation. Please uninstall both packages, and re-install only the docker-py or docker python module (for cent7's Python /usr/bin/python3). It is recommended to install the docker module if no support for Python 2.6 is required. Please note that simply uninstalling one of the modules can leave the other module in a broken state."}

    이런에러는 왜 나는걸까요?

    응답
    • 2022년 2월 18일 12:45 오전
      고유주소

      ansible-playbook -i inventory install.yml 실행중에 에러가 났을까요?

      응답

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다