用docker部署AWX平台

  |   1 评论   |   77 浏览

本地化部署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官方安装教程


标题:用docker部署AWX平台
作者:SmiteLi
地址:https://smite.site/articles/2019/12/16/1576492978916.html

评论

发表评论