Bboysoul's Blog

首页 公告 RSS

awx安装

February 25, 2021 本文有 594 个字 需要花费 2 分钟阅读

简介

因为家中的主机加虚拟机多多少少也大概有20多台了,所以有时候会批量执行一些任务,如果一个一个去登陆执行显然是不太现实的,所以就需要批量执行任务的工具,那么就肯定需要使用ansible了,用到ansible的话我就想着找个主机搭建一下awx好了,所以记录下流程

准备

虚拟机至少需要4核心4g内存的配置

首先部署awx的机器上需要下面这些东西

  • docker
  • docker的python模块pip3 install docker还有pip3 install docker-compose
  • ansible
  • Python 3.6+

说下碰到的一个坑pip安装docker-compose的时候报错

    Complete output from command python setup.py egg_info:

            =============================DEBUG ASSISTANCE==========================
            If you are seeing an error here please try the following to
            successfully install cryptography:

            Upgrade to the latest pip and try again. This will fix errors for most
            users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
            =============================DEBUG ASSISTANCE==========================

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-31288a1o/cryptography/setup.py", line 14, in <module>
        from setuptools_rust import RustExtension
    ModuleNotFoundError: No module named 'setuptools_rust'

提示要更新pip

pip3 install --upgrade pip

更新完成就好了

部署

之后下载代码

wget https://github.com/ansible/awx/archive/17.0.1.zip

unzip 17.0.1.zip

下载完成之后进入installer文件夹修改inventory文件,下面是我修改的参数

pg的数据文件夹

postgres_data_dir="/data/awx/pgdocker"

pg的用户名密码什么的

pg_username=awx
# pg_password should be random 10 character alphanumeric string, when postgresql is running on kubernetes
# NB: it's a limitation of the "official" postgres helm chart
pg_password=awxpass
pg_database=awx
pg_port=5432

登陆awx的账号和密码

# This will create or update a default admin (superuser) account in AWX, if not provided
# then these default values are used
admin_user=admin
admin_password=password

还有secret_key

secret_key=awxsecret

最后执行下面命令安装

ansible-playbook -i inventory install.yml

等一段时间如果没有报错的话就是安装成功了,如果没有安装成功重新运行就好了

最后说一句,因为awx具有定时调度的功能,所以使用他去当一个定时任务管理平台也不错

欢迎关注我的博客www.bboy.app

Have Fun


Tags:

本站总访问量 本站总访客数