fengjian
作者fengjian·2021-04-02 11:41
系统工程师·ips

Ansible-AWX on AIX安装测试

字数 4061阅读 5528评论 0赞 4

AWX 是一个开源的 web 应用,它是 Ansible Tower 的开源版本。 和 Tower 一样, AWX 允许我们使用 web 接口去管理 Ansible 的 playbooks 、 inventoris 和调度任务,同时提供了展示任务调度和运行的 Dashboard, 以及基于角色的用户管理。

我们可以在 AIX 环境使用 Ansible ,同样我们也可以在 AIX 上安装 AWX 。以下是 AWX 安装及简单测试的说明。

  • 系统环境准备

首先我们要准备一个 AIX 分区,本次测试使用的是 AIX 7200-05.

# oslevel -s
    • -

7200-05-01-2038

    • -

由于安装过程需要联网安装相应软件包( AIX Toolbox for Linux ),所以先设置 DNS ,如果使用本地镜像可以不用设置

添加DNS

# /usr/sbin/namerslv -a -i '202.106.0.20'

测试网络连接

# ping www.baidu.com
    • -

PING www.a.shifen.com: (110.242.68.4): 56 data bytes
64 bytes from 110.242.68.4: icmp_seq=0 ttl=54 time=8 ms
64 bytes from 110.242.68.4: icmp_seq=1 ttl=54 time=8 ms

    • -

确保文件系统空间充足

# chfs -a size=10G /var
# chfs -a size=10G /opt
# chfs -a size=5G /home
# chfs -a size=5G /tmp
  • 配置YUM

AIX Toolbox for Linux 中提供了一组用于 AIX 系统的开源软件 RPM 包,为了方便安装, AIX 上可以像 Linux 一样配置 YUM ,配置过程如下:

查看系统当前rpm版本

# lslpp -l rpm.rte
    • -

Fileset Level State Description
Path: /usr/lib/objrepos rpm.rte 4.15.1.1 COMMITTED RPM Package Manager
Path: /etc/objrepos rpm.rte 4.15.1.1 COMMITTED RPM Package Manager

    • -

创建文件夹

# mkdir -p /home/yum

下载新版rpm.rte(4.15.1.2)和yum_bundle.tar(v6),上传至/home/yum目录。

下载地址如下:

https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/ezinstall/ppc/
http://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/INSTALLP/ppc/

# cd /home/yum
# ls -l
    • -

total 187288
-rw-r—r— 1 root system 40987648 Apr 01 11:58 rpm.rte.4.15.1.2
-rw-r—r— 1 root system 54896640 Apr 01 11:54 yum_bundle_v6.tar

    • -

安装rpm.rte

# installp -qacXYd rpm.rte.4.15.1.2 all
    • -

rpm.rte 4.15.1.2 USR APPLY SUCCESS
rpm.rte 4.15.1.2 ROOT APPLY SUCCESS

    • -

安装YUM软件包

# tar -xvf yum_bundle_v6.tar
# rpm -Uvh *.rpm

YUM源配置

YUM 安装完成后配置了默认的安装源,配置文件为
/opt/freeware/etc/yum/yum.conf

可以修改配置文件,自行选择安装源

测试YUM源

# yum repolist
    • -

AIX_Toolbox | 2.6 kB 00:00:00

AIX_Toolbox/primary_db | 1.9 MB 00:00:03

AIX_Toolbox_72 | 2.5 kB 00:00:00

AIX_Toolbox_72/primary_db | 203 kB 00:00:00

AIX_Toolbox_noarch | 2.5 kB 00:00:00

AIX_Toolbox_noarch/primary_db | 96 kB 00:00:00

repo id repo name status

AIX_Toolbox AIX generic repository 2,802

AIX_Toolbox_72 AIX 7.2 specific repository 320

AIX_Toolbox_noarch AIX noarch repository 259

repolist: 3,381

    • -

至此 YUM 安装完毕

  • 安装Kerberos and rsyslog

安装 AWX 需要用到 Kerberos and rsyslog 两个软件包,这两个安装包可以在 AIX_v7.2_Expansion_Pack 光盘中找到,安装命令如下:

# installp -acgXYd /home/Exp/usr/sys/inst.images krb5.client.rte rsyslog.base
  • 安装ansible
# yum -y install ansible
# vi /etc/profile # 添加: export PATH=$PATH:/opt/freeware/bin
# ansible --version
    • -

ansible 2.9.14
config file = /etc/ansible/ansible.cfg
configured module search path = [‘/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /opt/freeware/lib/python3.7/site-packages/ansible
executable location = /opt/freeware/bin/ansible
python version = 3.7.9 (default, Sep 14 2020, 06:09:55) [GCC 8.3.0]

    • -
  • 安装AWX

上传ansible-awx安装文件并解压

# gzip -dc ansible-awx-17.1.0.aix7.2.install.tar.gz | tar xf -
# cd awx-install

修改check脚本

由于 AIX7205 比较新,需要修改 AWX 的 check 脚本,在系统版本检查中添加 AIX7200-05

# vi files/check_awx_prereq.ksh
    • -

OSLEVEL=$(oslevel -s 2>/dev/null)

if [[ $OSLEVEL != 7200-03-_]] && [[ $OSLEVEL != 7200-04-_ ]] && [[ $OSLEVEL != 7200-05-* ]]; then

    • -

修改AWX projects的Base目录地址

如果不修改,后面添加本地项目时会遇到如下报错

WARNING:

There are no available playbook directories in /var/lib/awx/projects. Either that directory is empty, or all of the contents are already assigned to other projects. Create a new directory there and make sure the playbook files can be read by the “awx” system user, or have AWX directly retrieve your playbooks from source control using the Source Control Type option above.

修改文件

# vi /etc/tower/settings.py
    • -

PROJECTS_ROOT = ‘/home/awx/projects

    • -

如果已经安装好 AWX 后遇到此问题,可以在修改 settings.py 文件后执行 update

# ansible-playbook -i localhost, -c local awx_update.yml

开始安装

ansible-playbook -i localhost, -c local awx_install.yml


修改admin用户密码,此用户用于登录ansible-awx

# su - awx -c awx-manage changepassword admin
    • -

Changing password for user ‘admin’

Password:

Password (again):

Password changed successfully for user ‘admin’

    • -

访问WEB页面,使用admin用户登录


  • 测试

我们使用之前准备的 Ansible 部署 PowerVC 虚机的 playbook 进行测试

首先创建项目

Playbook 选择 VM_deploy_PowerVC

创建作业模板

变量中设置了新建虚机的名称

执行作业并查看结果


如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

4

添加新评论0 条评论

Ctrl+Enter 发表

作者其他文章

相关文章

相关问题

相关资料

X社区推广