AWX 是开源的ansible web工具
该教程是在Centos7/8下完成部署。
配置SElinux
Centos/RHEL 7/8 在默认情况下 SELiunx是开启状态,这里需要时期失效,将SELinux配置文件中的 SELINUX=enforcing 修改为 SELINUX=disable。
1 | # vi /etc/sysconfig/selinux |
保存退出后,reboot重启服务器。
配置epel源
1 | yum -y update |
所需要的安装包
1 | yum -y install git gcc gcc-c++ ansible nodejs gettext device-mapper-persistent-data lvm2 bzip2 python3-pip nano wget |
安装docker
1 | wget https://download.docker.com/linux/centos/docker-ce.repo –directory-prefix /etc/yum.repos.d/ |
安装AWX
1 | git clone -b 17.1.0 https://github.com/ansible/awx.git |
1 | ansible-playbook -i ~/awx/installer/inventory ~/awx/installer/install.yml |
这里postgre docker容器起不起来,配置文件选择的12版本,修改为10版本就行,同时不做升级操作。网上有解决办法是改成12.1-apline版本,因此根据不同环境,自行选择
完成如下
1 | docker ps |
防火墙
1 | ``` |
“/home/ec2-user/work/awx_data/awx/awxcompose/nginx.conf:/etc/nginx/nginx.conf:ro”,
“/home/ec2-user/work/awx_data/awx/awxcompose/SECRET_KEY:/etc/tower/SECRET_KEY:rw”,
“awxcompose_rsyslog-socket:/var/run/awx-rsyslog:rw”,
“awxcompose_rsyslog-config:/var/lib/awx/rsyslog:rw”,
“awxcompose_supervisor-socket:/var/run/supervisor:rw”,
“/home/ec2-user/work/awx_data/awx/projects:/var/lib/awx/projects:rw”,
“/home/ec2-user/work/awx_data/awx/awxcompose/credentials.py:/etc/tower/conf.d/credentials.py:rw”,
“/home/ec2-user/work/awx_data/awx/awxcompose/redis_socket:/var/run/redis:rw”,
“/home/ec2-user/work/awx_data/awx/awxcompose/environment.sh:/etc/tower/conf.d/environment.sh:rw”
STATIC_ROOT = ‘/var/lib/awx/public/static’
PROJECTS_ROOT = ‘/var/lib/awx/projects’
AWX_ANSIBLE_COLLECTIONS_PATHS = ‘/var/lib/awx/vendor/awx_ansible_collections’
JOBOUTPUT_ROOT = ‘/var/lib/awx/job_status’
SECRET_KEY = get_secret()
ALLOWED_HOSTS = [‘*’]
1 |
docker exec -it awx_web bash
cat /etc/nginx/nginx.conf
location /static/ {
alias /var/lib/awx/public/static/;
}
location /favicon.ico { alias /var/lib/awx/public/static/favicon.ico; }
1 |
dnf -y update && dnf -y install epel-release ‘dnf-command(config-manager)’ && dnf module -y enable ‘postgresql:10’ && dnf config-manager –set-enabled powertools && dnf -y install ansible gcc gcc-c++ git-core glibc-langpack-en libcurl-devel libffi-devel libtool-ltdl-devel make nodejs nss openldap-devel patch @postgresql:10 postgresql-devel python3-devel python3-pip python3-psycopg2 python3-setuptools swig unzip xmlsec1-devel xmlsec1-openssl-devel
ansible-playbook -i installer/inventory installer/build.yml -vvvvvv &
1 | ## 自定义Ansible Tower LOGO |
awx 17.1.0 部署 参考
https://n-guitar.hatenablog.com/entry/2021/10/16/020000
https://mpolinowski.github.io/devnotes/2021-04-28-ansible-tower-rhel
免密登录
使用方法参考文献
免密登录
https://blog.csdn.net/qq_36830911/article/details/108107926
http://t.zoukankan.com/Nanaya-p-13202946.html
使用方法
https://blog.51cto.com/u_10616534/2407182
https://www.unixarena.com/2018/12/awx-ansible-tower-inventory-bulk-hosts-import.html/