Ansible學習記錄六:Tower安裝

0.特別說明

    1. 本文檔沒有特殊說明,均已root用戶安裝python

    2. 本文檔中ftp傳輸文件的工具採用filezillamongodb

    3. 本文檔中的執行命令必須嚴格按照順序而來。瀏覽器

    4. 本文檔中所用瀏覽器爲Google Chrome安全

 

1.基礎安裝

  1.添加源

    ssh鏈接到Tower服務器服務器

 

    [root]# cd /etc/yum.repos.ddom

    [root]# touch ansible-tower.repopython2.7

    [root]# touch media.repossh

    [root]# vi ansible-tower.repoide

    添加以下內容:工具

    [tower]

    name=Ansible Tower Offline Repository $releasever $basearch

    baseurl=file:///var/lib/tower-bundle/tower

    enabled=0

    gpgcheck=1

    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ansible-release

    cost=10

 

    [epel_bundled]

    name=Extra Packages for Enterprise Linux 7 - $basearch

    baseurl=file:///var/lib/tower-bundle/epel

    failovermethod=priority

    enabled=1

    gpgcheck=1

    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

    cost=10

 

    [pgdg94]

    name=PostgreSQL 9.4 $releasever - $basearch

    baseurl=file:///var/lib/tower-bundle/pgdg94

    enabled=1

    gpgcheck=1

    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-94

    cost=10

 

    [mongodb-org]

    name=MongoDB Repository

    baseurl=file:///var/lib/tower-bundle/mongodb-org

    gpgcheck=0

    enabled=1

    cost=10

 

    [jlaska-proot]

    name=Copr repo for proot owned by jlaska

    baseurl=file:///var/lib/tower-bundle/jlaska-proot

    gpgcheck=1

    gpgkey=file:///etc/pki/rpm-gpg/jlaska-proot-epel.gpg

    enabled=1

    enabled_metadata=1

    cost=10

 

    [root]# vi media.repo

    添加以下內容:#xx.xx.xx.xx換成Yum服務器IP地址

    [rhel-7-server-rpms]

    name=rhel-7-server-rpms

      baseurl=http://xx.xx.xx.xx/repos/rhel-7-server-rpms

    gpgcheck=0

    enabled=1

    [rhel-7-server-extras-rpms]

    name=rhel-7-server-extras-rpms

    baseurl=http://xx.xx.xx.xx/repos/rhel-7-server-extras-rpms

    gpgcheck=0

    enabled=1

    [rhel-7-server-optional-rpms]

    name=rhel-7-server-optional-rpms

    baseurl=http://xx.xx.xx.xx/repos/rhel-7-server-optional-rpms

    gpgcheck=0

    enabled=1

    [rhel-7-server-ose-3.1-rpms]

    name=rhel-7-server-ose-3.1-rpms

    baseurl=http://xx.xx.xx.xx/repos/rhel-7-server-ose-3.1-rpms

    gpgcheck=0

    enabled=1

    [zabbix247]

    name=zabbix247

    baseurl=http://xx.xx.xx.xx/repos/zabbix247

    gpgcheck=0

    enabled=1

   2.將所需依賴拷貝至Tower服務器

    將ansible-tower-setup-bundle-2.4.3-1.el7.tgzlisence.rtfrpm-gpg.ziptask_engine.pyotower-bundle.zipxlrd-0.9.4.tar.gzgen_inventory.pyproject.zip拷貝至Tower服務器中。

      SSH登陸到Tower服務器

    [root]# cd ~

    [root]# scp -r root@xx.xx.xx.xx:/data/tower/* . #xx.xx.xx.xx表示跳起色IP地址

    The authenticity of host '172.16.1.120 (172.16.1.120)' can't be established.

    RSA key fingerprint is b4:3c:68:d5:a7:fe:6e:b8:37:aa:84:8a:94:0c:b3:e9.

    Are you sure you want to continue connecting (yes/no)? Yes  [輸入Yes回車]

    Warning: Permanently added '172.16.1.120' (RSA) to the list of known hosts.

    Red Hat Enterprise Linux Server release 6.7 (Santiago)

    Kernel \r on an \m

    root@172.16.1.120's password: [輸入密碼回車回車]

    拷貝成功過下圖所示:

    

 

    [root]# unzip tower-bundle.zip -d /var/lib

    [root]# unzip -o rpm-gpg.zip -d /etc/pki/

    [root]# tar -zxvf xlrd-0.9.4.tar.gz

    [root]# cd xlrd-0.9.4

    [root]# python setup.py install

    [root]# cd /root

    [root]# tar -zxvf ansible-tower-setup-bundle-2.4.3-1.el7.tgz

    [root]# cd ansible-tower-setup-bundle-2.4.3-1.el7

    [root]#  ./configure

        執行這個文件:./configure,會交互式收集安裝信息,按照以下順序應答:

                第一個問題:回車

                第二個問題:i

                第三個問題:admin

                確認密碼:admin

                第四個問題:y

    [root]#  ./setup.sh

  安裝成功以下圖所示:

   

 

    [root]#  cd /root

    [root]#  cp get_inventory.py /var/lib/awx

    [root]#  ssh-keygen -t rsa -P ''

      Generating public/private rsa key pair.

      Enter file in which to save the key (/root/.ssh/id_rsa):   【回車】

      Created directory '/root/.ssh'.

      Your identification has been saved in /root/.ssh/id_rsa.

      Your public key has been saved in /root/.ssh/id_rsa.pub.

      The key fingerprint is:

      4b:d1:b8:eb:b9:79:93:1e:a7:6d:07:33:32:14:74:d1 root@i-psx9pwbx

      The key's randomart image is:

      +--[ RSA 2048]----+

      |         .. oo   |

      |         o..  E  |

      |        o ..     |

      |         o.      |

      |        S.       |

      |       . oo +    |

      |        o .+.+   |

      |       . o+=. .  |

      |        =+oo..   |

      +-----------------+

    [root]#  cp task_engine.pyo /usr/lib/python2.7/site-packages/awx/main/task_engine.pyo   [提示覆蓋,請輸入Y]

    [root]#  chmod u+x get_inventory.py

    [root]#  unzip -o projects.zip -d /var/lib/awx/  

    [root]#  systemctl restart httpd 

 

2.登陸Tower服務器初始化配置

  瀏覽器中輸入Tower服務器的IP地址

   

  選擇「繼續前往XX.XX.XX.XX(不安全)

  

  輸入Tower的用戶名和密碼,點擊 Sign in 。默認用戶名和密碼爲:admin/admin

   

  將註冊的License拷貝至「1」中,並將「2」選中,點擊「Submit」。

  提交完成表示整個Tower初始化成功。

3.初始化認證

   

  點擊右上角的圖標。

  

  點擊Credentials

   

  點擊右邊圖標。

   

  填寫完上面信息,鼠標滑到最下面,點擊「Save」保存。

4.參考資料

  Ansible Tower官網:

  https://www.ansible.com/tower

  ansible&Tower無限hosts的License修改方法

  http://tower.blog.51cto.com/3711105/1701339/

相關文章
相關標籤/搜索