Ansible Tower01

文檔:http://docs.ansible.com/ansible-tower/ 
本文以Ansible-tower-3.1.2 OS爲CentOS7.2爲例。

一、安裝前注意事項

  1. The Tower installer creates a self-signed SSL certificate and keyfile at /etc/tower/tower.cert and /etc/tower/tower.key for HTTPS communication. These can be replaced after install with your own custom SSL certificates if you desire, but the filenames are required to be the same.(如果需要替換之前的/etc/tower/tower.cert、/etc/tower/tower.key證書,需要保證替換之後的證書和之前的證書名稱相同)

  2. If using Ansible version 1.8 or later, ensure that fact caching using Redis is not enabled in ansible.cfg on the Tower machine.(如果使用可執行版本1.8或更高版本,請確保在Ansible Tower上的ansible.cfg中未啓用使用Redis的fact caching。)

  3. Note that the Tower installation must be run from an internet connected machine that can install software from trusted 3rd-party places such as Ansible’s software repository, and your OS vendor’s software repositories.(請注意,Tower安裝必須通過互聯網連接的機器運行,該機器可以從可靠的第三方場所安裝軟件,如Ansible的軟件倉庫和您的OS供應商的軟件庫。)

  4. (1)支持的操作系統: 
    Red Hat Enterprise Linux 7 64-bit 
    CentOS 7 64-bit 
    Ubuntu 14.04 LTS 64-bit 
    Ubuntu 16.04 LTS 64-bit 
    注意:Ansible Tower requires Red Hat Enterprise Linux 7.2 or later. 
    (2)最少2G內存,推薦4G+內存 
    (3)20 GB of dedicated hard disk space(20 GB專用硬盤空間) 
    10 GB of the 20 GB requirement must be dedicated to /var/, where Tower stores its files and working directories (dedicating less space will cause the installation to fail) 
    (4)64-bit support required (kernel and runtime)

二、安裝過程

1.下載ansible tower 
下載地址:http://releases.ansible.com/ansible-tower/setup/ 
含有安裝包文件的版本:http://releases.ansible.com/ansible-tower/setup-bundle/

wget http://releases.ansible.com/ansible-tower/setup-bundle/ansible-tower-setup-bundle-latest.el6.tar.gz
tar zxvf ansible-tower-setup-bundle-latest.el7.tar.gz
cd ansible-tower-setup-bundle-3.1.2-2.el7

2.安裝ansible tower 
a.設置主機信息

sed -i "s#admin_password=''#admin_password='123456'#g" inventory
sed -i "s#pg_host=''#pg_host='127.0.0.1'#g" inventory 
sed -i "s#pg_port=''#pg_port='5432'#g" inventory

b.修改yum源(操作中並沒有修改,原地址也挺快)

sed -i 's#dl.fedoraproject.org/pub#mirrors.ustc.edu.cn#g' roles/packages_el/defaults/main.yml
sed -i 's/#baseurl=/baseurl=/g' roles/packages_el/files/epel-6.repo
sed -i 's/mirrorlist=/#mirrorlist=/g' roles/packages_el/files/epel-6.repo
sed -i 's#download.fedoraproject.org/pub#mirrors.ustc.edu.cn#g' roles/packages_el/files/epel-6.repo

yum -y install centos-release-scl-rh centos-release-scl
sed -i 's#mirror.centos.org#centos.ustc.edu.cn#g' /etc/yum.repos.d/CentOS-SCLo-scl.repo
sed -i 's#mirror.centos.org#centos.ustc.edu.cn#g' /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
yum -y install supervisor

c.安裝Ansible tower

#./setup.sh

d.安裝過程中遇到的問題 
(1).在TASK [awx_install : Migrate the Tower database schema (may take awhile when upgrading).] 這一步會出現錯誤,提示信息是數據庫連接不上 

使用yum安裝

yum install
http://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7.2-x86_64/pgdg-redhat94-9.4-3.noarch.rpm
yum install postgresql94-server postgresql94-contrib

設置開機啓動

 systemctl enable postgresql-9.4.service 
 systemctl start postgresql-9.4.service

初始化數據庫

 /usr/pgsql-9.4/bin/postgresql94-setup initdb

啓動postgresql

service postgresql-9.4 start

創建用戶

su - postgres
-bash-4.2$ psql
    postgres=# CREATE ROLE awx CREATEDB PASSWORD 'admin' LOGIN; 
    postgres=# \q
    -bash-4.2$ exit
sed -i 's#peer#md5#g' /var/lib/pgsql/9.4/data/pg_hba.conf
sed -i 's#ident#md5#g' /var/lib/pgsql/9.4/data/pg_hba.conf
service postgresql-9.4 restart

測試awx用戶連接,輸入密碼連接,並創建數據庫

-bash-4.2$ psql -U awx -d postgres -h 127.0.0.1
postgres=# create database awx;
postgres=# \q

再次./setup.sh進行安裝tower 
(2).在TASK中fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "This machine does not have sufficient RAM to run Ansible Tower."} 
解決方法:增加內存,至少2G 
(3).在TASK中fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Please set rabbitmq_password in the inventory file before running setup"} 
解決方法:安裝RabbitMQ,具體見《RabbitMQ01》。

三、Web配置

訪問Web界面,http://192.168.1.34/#/ 
用戶名/密碼爲admin/123456

wKiom1jxneiRFMw1AAC7fF59BSc955.png-wh_50

導入license 
沒有的話,點擊REQUEST LICENSE,去官方申請免費試用。

wKioL1jxnfzCGZECAAO8JD9y6rE853.png-wh_50

提交license,就進入了DASHBOARD頁面。

wKiom1jx_oeR2FRmAAGAF4mkeDU283.png-wh_50

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章