用 docker 部署 AWX 平台

本贴最后更新于 1434 天前,其中的信息可能已经事过景迁

本地化部署 docker 版本的 AWX 自动化运维工具

一、部署总览

  1. 最新版的 CentOS7 操作系统
  2. 最新版的 python3
  3. 最新版的 ansible
  4. 最新版本 docker
  5. 最新版的 awx

二、部署步骤

  1. 准备编译环境
yum install -y libffi-devel openssl-dev python-devel
  1. 编译安装最新版本 python3:
curl -O https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
tar -xf Python-3.8.0.tgz
cd Python-3.8.0
./configure --enable-optimizations ;make -j `cat /proc/cpuinfo| grep "processor"| wc -l` && make install

if need to rebuild the makefile,run the follow command:
make clean
then compile and build, install:
make && make install

  1. 安装最新版 docker
sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo


sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo systemctl enable docker
  1. 准备 python3 的 virtualenv 环境
pip install virtualenv
virtualenv awxenv
cd awxenv/bin
source activate
  1. 给虚拟环境安装需要的包和 ansible
    pip install docker docker-compose ansible
  2. 克隆 awx 仓库
    git clone https://github.com/ansible/awx
  3. 修改 inventory 文件
    vi installer/inventory
    注意把 custom_venv_dir 参数的路径改为你的 venv 路径
  4. 执行安装命令:
    为了让 AWX 中文显示,先把系统的字符集设置为 zh_CN.UTF-8
localectl set-locale LANG=zh_CN.UTF-8

[root@Temp installer]# locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=

[root@Temp ins
taller]# localectl --help
localectl [OPTIONS...] COMMAND ...

Query or change system locale and keyboard settings.

  -h --help                Show this help
     --version             Show package version
     --no-pager            Do not pipe output into a pager
     --no-ask-password     Do not prompt for password
  -H --host=[USER@]HOST    Operate on remote host
  -M --machine=CONTAINER   Operate on local container
     --no-convert          Don't convert keyboard mappings

Commands:
  status                   Show current locale settings
  set-locale LOCALE...     Set system locale
  list-locales             Show known locales
  set-keymap MAP [MAP]     Set console and X11 keyboard mappings
  list-keymaps             Show known virtual console keyboard mappings
  set-x11-keymap LAYOUT [MODEL [VARIANT [OPTIONS]]]
                           Set X11 and console keyboard mappings
  list-x11-keymap-models   Show known X11 keyboard mapping models
  list-x11-keymap-layouts  Show known X11 keyboard mapping layouts
  list-x11-keymap-variants [LAYOUT]
                           Show known X11 keyboard mapping variants
  list-x11-keymap-options  Show known X11 keyboard mapping options
# Set the working directory to installer
$ cd installer

# Run the Ansible playbook
ansible-playbook -i inventory install.yml
或者有自己的docker私有仓库,可以执行下面的命令
$ ansible-playbook -i inventory -e docker_registry_password=password install.yml

三、参考资料

AWX 官方安装教程

  • awx
    1 引用 • 1 回帖

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...