AWX는 Ansible을 GUI환경에서 작업하기 위해 사용됩니다.
크게 Tower,AWX,Semaphore 가 있는데 Tower는 돈내고 사용해야돼서..AWX 커뮤니티 버전을 설치해보았습니다.
awx 가 docker 기반으로 설치가 되기 때문에, centos 6 에서는 설치가 쉽지 않습니다.
(docker 에서 공식 지원을 하지 않는다.)
Ansible AWX는 ver 17을 기준으로 설치방법이 나뉩니다.
Version 17 이하는 Linux OS 위에 Docker를 기반으로 설치를 진행하며,
Version 18 이상부터는 Kubernetes 기반위에서 설치하는 것을 기본으로 합니다
▶Ansible 설치
[root@jh-awx ~]# yum -y install epel-release
[root@jh-awx ~]# yum -y install ansible
▶python 설치
[root@jh-awx ~]# yum -y install python-pip
▶ docker 설치
[root@jh-awx ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
[root@jh-awx ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror, langpacks
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@jh-awx ~]# yum install -y docker-ce docker-ce-cli containerd.io
▶docker compose
[root@jh-awx ~]# curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 664 100 664 0 0 1682 0 --:--:-- --:--:-- --:--:-- 1681
100 15.4M 100 15.4M 0 0 7417k 0 0:00:02 0:00:02 --:--:-- 22.0M
[root@jh-awx ~]# chmod +x /usr/local/bin/docker-compose
[root@jh-awx ~]# ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
[root@jh-awx ~]# docker-compose --version
docker-compose version 1.24.0, build 0aa59064
▶docker 구동 및 등록
[root@jh-awx ~]# systemctl start docker
[root@jh-awx ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2022-04-20 11:23:56 KST; 5s ago
Docs: https://docs.docker.com
Main PID: 20675 (dockerd)
Memory: 35.0M
CGroup: /system.slice/docker.service
└─20675 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Apr 20 11:23:55 jh-awx dockerd[20675]: time="2022-04-20T11:23:55.723365358+09:00" level=info msg="Creating filesystem xfs on device docker-202:3-69127555-base, mkfs args: [-m...devicemapper
Apr 20 11:23:55 jh-awx dockerd[20675]: time="2022-04-20T11:23:55.854392532+09:00" level=info msg="Successfully created filesystem xfs on device docker-202:3-69127555-base" st...devicemapper
Apr 20 11:23:55 jh-awx dockerd[20675]: time="2022-04-20T11:23:55.936762712+09:00" level=warning msg="[graphdriver] WARNING: the devicemapper storage-driver is deprecated, and...ure release"
Apr 20 11:23:55 jh-awx dockerd[20675]: time="2022-04-20T11:23:55.958661367+09:00" level=info msg="Loading containers: start."
Apr 20 11:23:56 jh-awx dockerd[20675]: time="2022-04-20T11:23:56.629778889+09:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemo... IP address"
Apr 20 11:23:56 jh-awx dockerd[20675]: time="2022-04-20T11:23:56.716100551+09:00" level=info msg="Loading containers: done."
Apr 20 11:23:56 jh-awx dockerd[20675]: time="2022-04-20T11:23:56.733275720+09:00" level=info msg="Docker daemon" commit=87a90dc graphdriver(s)=devicemapper version=20.10.14
Apr 20 11:23:56 jh-awx dockerd[20675]: time="2022-04-20T11:23:56.733418816+09:00" level=info msg="Daemon has completed initialization"
Apr 20 11:23:56 jh-awx systemd[1]: Started Docker Application Container Engine.
Apr 20 11:23:56 jh-awx dockerd[20675]: time="2022-04-20T11:23:56.758668269+09:00" level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.
[root@jh-awx ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
▶Make working directory (root)
[root@jh-awx ~]# mkdir /work
[root@jh-awx ~]# cd /work
▶ Source 복제
[root@jh-awx work]# git clone -b 17.1.0 https://github.com/Ansible/awx.git
Cloning into 'awx'...
remote: Enumerating objects: 298584, done.
remote: Counting objects: 100% (346/346), done.
remote: Compressing objects: 100% (201/201), done.
remote: Total 298584 (delta 170), reused 263 (delta 144), pack-reused 298238
Receiving objects: 100% (298584/298584), 259.08 MiB | 10.82 MiB/s, done.
Resolving deltas: 100% (230288/230288), done.
Note: checking out 'c1ab815c80cac96508d9779d92bc1280d0347627'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
▶ inventory파일 수정
[root@jh-awx work]# cd /work/awx/installer
##project파일을 로컬에 저장하고 싶으면 project_data_dir 경로 지정
안할 시 awx에서 로컬저장시 Docker 안에 저장이 될 것입니다.
[root@jh-awx installer]# vi inventory
localhost ansible_connection=local ansible_python_interpreter="/usr/bin/python"
admin_password=password
▶awx 설치
[root@jh-awx installer]# ansible-playbook -i inventory install.yml
[DEPRECATION WARNING]: Ansible will require Python 3.8 or newer on the controller starting
with Ansible 2.12. Current version: 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5
20150623 (Red Hat 4.8.5-11)]. This feature will be removed from ansible-core in version
2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in
ansible.cfg.
/usr/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
from cryptography.exceptions import InvalidSignature
PLAY [Build and deploy AWX] *****************************************************************
TASK [Gathering Facts] **********************************************************************
ok: [localhost]
TASK [check_vars : admin_password should be defined] ****************************************
ok: [localhost] => {
"changed": false,
"msg": "All assertions passed"
}
TASK [check_vars : include_tasks] ***********************************************************
skipping: [localhost]
TASK [check_vars : include_tasks] ***********************************************************
included: /work/awx/installer/roles/check_vars/tasks/check_docker.yml for localhost
TASK [check_vars : postgres_data_dir should be defined] *************************************
ok: [localhost] => {
"changed": false,
"msg": "All assertions passed"
}
TASK [image_build : Set global version if not provided] *************************************
skipping: [localhost]
TASK [image_build : Verify awx-logos directory exists for official install] *****************
skipping: [localhost]
TASK [image_build : Copy logos for inclusion in sdist] **************************************
skipping: [localhost]
TASK [image_build : Set awx image name] *****************************************************
skipping: [localhost]
TASK [image_build : Render Dockerfile] ******************************************************
skipping: [localhost]
TASK [image_build : Build AWX image] ********************************************************
skipping: [localhost]
TASK [image_build : Tag awx images as latest] ***********************************************
skipping: [localhost] => (item=awx)
TASK [image_push : Authenticate with Docker registry if registry password given] ************
skipping: [localhost]
TASK [image_push : Remove awx image] ********************************************************
skipping: [localhost]
TASK [image_push : Tag and push awx image to registry] **************************************
skipping: [localhost]
TASK [image_push : Set full image path for Registry] ****************************************
skipping: [localhost]
TASK [kubernetes : Generate broadcast websocket secret] *************************************
skipping: [localhost]
TASK [kubernetes : fail] ********************************************************************
skipping: [localhost]
TASK [kubernetes : include_tasks] ***********************************************************
skipping: [localhost] => (item=openshift_auth.yml)
skipping: [localhost] => (item=openshift.yml)
TASK [kubernetes : include_tasks] ***********************************************************
skipping: [localhost] => (item=kubernetes_auth.yml)
skipping: [localhost] => (item=kubernetes.yml)
TASK [kubernetes : Use kubectl or oc] *******************************************************
skipping: [localhost]
TASK [kubernetes : set_fact] ****************************************************************
skipping: [localhost]
TASK [kubernetes : Record deployment size] **************************************************
skipping: [localhost]
TASK [kubernetes : Set expected post-deployment Replicas value] *****************************
skipping: [localhost]
TASK [kubernetes : Delete existing Deployment (or StatefulSet)] *****************************
skipping: [localhost]
TASK [kubernetes : Get Postgres Service Detail] *********************************************
skipping: [localhost]
TASK [kubernetes : Template PostgreSQL Deployment (OpenShift)] ******************************
skipping: [localhost]
TASK [kubernetes : Deploy and Activate Postgres (OpenShift)] ********************************
skipping: [localhost]
TASK [kubernetes : Create Temporary Values File (Kubernetes)] *******************************
skipping: [localhost]
TASK [kubernetes : Populate Temporary Values File (Kubernetes)] *****************************
skipping: [localhost]
TASK [kubernetes : Deploy and Activate Postgres (Kubernetes)] *******************************
skipping: [localhost]
TASK [kubernetes : Remove tempfile] *********************************************************
skipping: [localhost]
TASK [kubernetes : Set postgresql hostname to helm package service (Kubernetes)] ************
skipping: [localhost]
TASK [kubernetes : Wait for Postgres to activate] *******************************************
skipping: [localhost]
TASK [kubernetes : Check if Postgres 10 is being used] **************************************
skipping: [localhost]
TASK [kubernetes : Set new pg image] ********************************************************
skipping: [localhost]
TASK [kubernetes : Wait for change to take affect] ******************************************
skipping: [localhost]
TASK [kubernetes : Set env var for pg upgrade] **********************************************
skipping: [localhost]
TASK [kubernetes : Wait for change to take affect] ******************************************
skipping: [localhost]
TASK [kubernetes : Set env var for new pg version] ******************************************
skipping: [localhost]
TASK [kubernetes : Wait for Postgres to redeploy] *******************************************
skipping: [localhost]
TASK [kubernetes : Wait for Postgres to finish upgrading] ***********************************
skipping: [localhost]
TASK [kubernetes : Unset upgrade env var] ***************************************************
skipping: [localhost]
TASK [kubernetes : Wait for Postgres to redeploy] *******************************************
skipping: [localhost]
TASK [kubernetes : Set awx image name] ******************************************************
skipping: [localhost]
TASK [kubernetes : Determine Deployment api version] ****************************************
skipping: [localhost]
TASK [kubernetes : Get Root CA file contents] ***********************************************
skipping: [localhost]
TASK [kubernetes : Render Root CA template] *************************************************
skipping: [localhost]
TASK [kubernetes : Apply Root CA template] **************************************************
skipping: [localhost]
TASK [kubernetes : Set Root CA file name] ***************************************************
skipping: [localhost]
TASK [kubernetes : Set Root CA file location] ***********************************************
skipping: [localhost]
TASK [kubernetes : Render deployment templates] *********************************************
skipping: [localhost] => (item=None)
skipping: [localhost] => (item=None)
skipping: [localhost] => (item=None)
skipping: [localhost] => (item=None)
skipping: [localhost]
TASK [kubernetes : Apply Deployment] ********************************************************
skipping: [localhost]
TASK [kubernetes : Delete any existing management pod] **************************************
skipping: [localhost]
TASK [kubernetes : Template management pod] *************************************************
skipping: [localhost]
TASK [kubernetes : Create management pod] ***************************************************
skipping: [localhost]
TASK [kubernetes : Wait for management pod to start] ****************************************
skipping: [localhost]
TASK [kubernetes : Migrate database] ********************************************************
skipping: [localhost]
TASK [kubernetes : Check for Tower Super users] *********************************************
skipping: [localhost]
TASK [kubernetes : create django super user if it does not exist] ***************************
skipping: [localhost]
TASK [kubernetes : update django super user password] ***************************************
skipping: [localhost]
TASK [kubernetes : Create the default organization if it is needed.] ************************
skipping: [localhost]
TASK [kubernetes : Delete management pod] ***************************************************
skipping: [localhost]
TASK [kubernetes : Scale up deployment] *****************************************************
skipping: [localhost]
TASK [local_docker : Generate broadcast websocket secret] ***********************************
ok: [localhost]
TASK [local_docker : Create ~/.awx/pgdocker directory] **************************************
ok: [localhost]
TASK [local_docker : Get full path of postgres data dir] ************************************
changed: [localhost]
TASK [local_docker : Register temporary docker container] ***********************************
ok: [localhost]
TASK [local_docker : Check for existing Postgres data (run from inside the container for access to file)] ***
fatal: [localhost]: FAILED! => {"changed": true, "cmd": "docker run --rm -v '/root/.awx/pgdocker:/var/lib/postgresql' centos:8 bash -c \"[[ -f /var/lib/postgresql/10/data/PG_VERSION ]] && echo 'exists'\"\n", "delta": "0:00:01.642618", "end": "2022-04-20 17:07:21.308033", "msg": "non-zero return code", "rc": 1, "start": "2022-04-20 17:07:19.665415", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
...ignoring
TASK [local_docker : Record Postgres version] ***********************************************
skipping: [localhost]
TASK [local_docker : Determine whether to upgrade postgres] *********************************
skipping: [localhost]
TASK [local_docker : Set up new postgres paths pre-upgrade] *********************************
skipping: [localhost]
TASK [local_docker : Stop AWX before upgrading postgres] ************************************
skipping: [localhost]
TASK [local_docker : Upgrade Postgres] ******************************************************
skipping: [localhost]
TASK [local_docker : Copy old pg_hba.conf] **************************************************
skipping: [localhost]
TASK [local_docker : Remove old data directory] *********************************************
skipping: [localhost]
TASK [local_docker : Export Docker awx image if it isnt local and there isnt a registry defined] ***
skipping: [localhost]
TASK [local_docker : Set docker base path] **************************************************
skipping: [localhost]
TASK [local_docker : Ensure directory exists] ***********************************************
skipping: [localhost]
TASK [local_docker : Copy awx image to docker execution] ************************************
skipping: [localhost]
TASK [local_docker : Load awx image] ********************************************************
skipping: [localhost]
TASK [local_docker : Set full image path for local install] *********************************
skipping: [localhost]
TASK [local_docker : Set DockerHub Image Paths] *********************************************
ok: [localhost]
TASK [local_docker : Create ~/.awx/awxcompose directory] ************************************
ok: [localhost]
TASK [local_docker : Create Redis socket directory] *****************************************
ok: [localhost]
TASK [local_docker : Create Docker Compose Configuration] ***********************************
ok: [localhost] => (item={u'mode': u'0600', u'file': u'environment.sh'})
changed: [localhost] => (item={u'mode': u'0600', u'file': u'credentials.py'})
ok: [localhost] => (item={u'mode': u'0600', u'file': u'docker-compose.yml'})
ok: [localhost] => (item={u'mode': u'0600', u'file': u'nginx.conf'})
ok: [localhost] => (item={u'mode': u'0664', u'file': u'redis.conf'})
TASK [local_docker : Render SECRET_KEY file] ************************************************
ok: [localhost]
TASK [local_docker : Remove AWX containers before migrating postgres so that the old postgres container does not get used] ***
changed: [localhost]
TASK [local_docker : Run migrations in task container] **************************************
changed: [localhost]
TASK [local_docker : Start the containers] **************************************************
changed: [localhost]
TASK [local_docker : Update CA trust in awx_web container] **********************************
changed: [localhost]
TASK [local_docker : Update CA trust in awx_task container] *********************************
changed: [localhost]
TASK [local_docker : Wait for launch script to create user] *********************************
ok: [localhost -> localhost]
TASK [local_docker : Create Preload data] ***************************************************
ok: [localhost]
PLAY RECAP **********************************************************************************
localhost : ok=21 changed=8 unreachable=0 failed=0 skipped=73 rescued=0 ignored=1
▶docker 구동 확인
[root@jh-awx installer]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bcb1699ddaa0 ansible/awx:17.1.0 "/usr/bin/tini -- /u…" 2 minutes ago Up 2 minutes 8052/tcp awx_task
bdcd7b390fa4 ansible/awx:17.1.0 "/usr/bin/tini -- /b…" 2 minutes ago Up 2 minutes 0.0.0.0:80->8052/tcp awx_web
63e1f8056379 postgres:12 "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 5432/tcp awx_postgres
5f3ed0bd0d0c redis "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 6379/tcp awx_redis
▶Ansible AWX 웹 접속
접속 URL : http://server_ip
초기계정 : Inventory에 쓴대로(default : admin/password)
참고
'Others > Opensource Tool' 카테고리의 다른 글
[Ansible - Semaphore Web설정] part 2 (0) | 2022.04.24 |
---|---|
[Ansible - Semaphore 설치] part 1 (0) | 2022.04.24 |
[pt-query-digest - Mysql slowquery 분석 ] (0) | 2022.03.12 |
[Ansible - MySQL 설치 & 배포] (0) | 2022.02.05 |
[Pacemaker & corosync 구성 Vip failover] (0) | 2022.01.20 |