07/访问 AWX Web 界面
最后,打开浏览器并使用服务器的 IP 或者 FQDN 访问 awxWeb 界面,用户名是 admin,密码是 password。
将打开awx仪表板
AWX 项目 (AWX) 是一个开源社区项目。
此外,它是由 Red Hat 赞助的 Ansible Tower 软件的开源版本,使用户能够更好地控制其在 IT 环境中的 Ansible 项目使用。
在本教程中,我们将展示如何使用 RPM 社区版在 CentOS 7/RHEL 7 上安装和配置没有 Docker 的 AWX。
04/RabbitMQ安装
01 首先,创建 RabbitMQ和 Erlang存储库,如下所示:
# echo "[bintraybintray-rabbitmq-erlang-rpm] name=bintray-rabbitmq-erlang-rpm baseurl=https://dl.bintray.com/rabbitmq-erlang/rpm/erlang/21/el/7/ gpgcheck=0 repo_gpgcheck=0 enabled=1" > /etc/yum.repos.d/rabbitmq-erlang.repo
# echo "[bintraybintray-rabbitmq-rpm] name=bintray-rabbitmq-rpm baseurl=https://dl.bintray.com/rabbitmq/rpm/rabbitmq-server/v3.7.x/el/7/ gpgcheck=0 repo_gpgcheck=0 enabled=1" > /etc/yum.repos.d/rabbitmq.repo
02 其次,安装RabbitMQ,然后我们可以通过执行以下命令继续启用/启动RabbitMQ服务:
# yum install -y rabbitmq-server # systemctl enable rabbitmq-server # systemctl start rabbitmq-server
01/Selinux和防火墙设置
01首先,让我们安装policycoreutils-python并允许Nginx连接到网络,如下所示:
# yum -y install policycoreutils-python # setsebool -P httpd_can_network_connect 1
02 如果firewalld处于活动状态,则需要启用http流量时,执行以下命令:
# firewall-cmd --permanent --add-service=http success # firewall-cmd --reload success
02/Memcached、Ansible 和必要的包安装
01 现在,运行以下命令来安装 EPEL Release存储库、memchached和 Ansible:
# yum install -y memcached ansible epel-release
02 安装完成后,我们必须通过运行来启用并启动Memcached服务:
# systemctl enable memcached # systemctl start memcached
03/PostgreSQL服务器安装
01在一切之前,Awx需要PostgreSQL数据库服务器,请按照本教程如何在 CentOS 7/RHEL 7 上安装 PostgreSQL 10.
02 一旦我们完成安装和启动PostgrSQL服务器,我们必须创建名为awx的awx数据库并授予用户awx访问权限,如下所示:
# sudo -u postgres createuser -S awx # sudo -u postgres createdb -O awx awx
05/Nginx 安装和配置作为 AWX 的 Web 服务器代理
01 运行以下命令安装nginx
# yum install -y nginx
02 配置 nginx作为 awx的网络代理:
# cp -p /etc/nginx/nginx.conf{,.org}
# wget -O /etc/nginx/nginx.conf https://raw.githubusercontent.com/faudeltn/AnsibleTower-awx/master/ansible-awx-install/nginx.conf
03 启用并启动nginx:
# systemctl start nginx # systemctl enable nginx
06/AWX安装和初始化
01 要安装 awx,请运行以下命令:
# wget -O /etc/yum.repos.d/awx-rpm.repo https://copr.fedorainfracloud.org/coprs/mrmeee/awx/repo/epel-7/mrmeee-awx-epel-7.repo # yum install -y awx
02 让我们导入awx数据库数据:
# sudo -u awx /opt/awx/bin/awx-manage migrate Operations to perform: Apply all migrations: auth, conf, contenttypes, main, oauth2_provider, sessions, sites, social_django, sso, taggit Running migrations: Applying contenttypes.0001_initial... OK Applying taggit.0001_initial... OK Applying taggit.0002_auto_20140616_2121... OK Applying contenttypes.0002_remove_content_type_name... OK Applying auth.0001_initial... OK Applying main.0001_initial... OK
03 创建一个名为 admin的 awx Web 访问用户帐户并设置密码:
# echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', 'jack@onitroad', 'password')" | sudo -u awx /opt/awx/bin/awx-manage shell
04 通过运行以下命令初始化 awx:
# sudo -u awx /opt/awx/bin/awx-manage create_preload_data Default organization added. Demo Credential, Inventory, and Job Template added. (changed: True) # sudo -u awx /opt/awx/bin/awx-manage provision_instance --hostname=$(hostname) Successfully registered instance ylclawxas02.onitroad.local (changed: True) 2019-04-03 11:07:22,758 DEBUG awx.main.dispatch publish awx.main.tasks.apply_cluster_membership_policies(eec7263e-bf52-4dad-ad4d-7d4245c47ae4, queue=awx_private_queue) # sudo -u awx /opt/awx/bin/awx-manage register_queue --queuename=tower --hostnames=$(hostname) 2019-04-03 11:07:35,496 DEBUG awx.main.dispatch publish awx.main.tasks.apply_cluster_membership_policies(d4a3314d-b3da-42a6-8cbe-a177f97e2e79, queue=awx_private_queue) Creating instance group tower 2019-04-03 11:07:35,542 DEBUG awx.main.dispatch publish awx.main.tasks.apply_cluster_membership_policies(f6be7d7d-fcbd-47dd-a1ec-10abe56420c3, queue=awx_private_queue) Added instance ylclawxas02.onitroad.local to tower (changed: True)
04 之后,让我们启动并启用 awx服务:
# systemctl start awx-cbreceiver && systemctl enable awx-cbreceiver # systemctl start awx-dispatcher && systemctl enable awx-dispatcher # systemctl start awx-channels-worker && systemctl enable awx-channels-worker # systemctl start awx-daphne && systemctl enable awx-daphne # systemctl start awx-web && systemctl enable awx-web
AWX 服务器的系统要求
- 2GB 内存
- 2个CPU核心
- 20GB 空间
