리눅스/설치

[LINUX] 1. ANSIBLE 설치

ㅎㄷㄹㅁㅇ 2022. 3. 1. 17:13
반응형

Ansible 설치 

목차

    Ansible 이란?

    Ansible은 오픈소스 IT 자동화 툴입니다. 이전과 달리 데이터의 전체적인 증가로 인해 클라우드 인프라 방식으로 변하고 있습니다. 관리해야 할 대상이 많아졌고 동시다발적인 형태의 서버의 배포와 자동화가 필요해졌습니다. 이를 더 쉽고 간단하게 도와주는 것이 Ansible입니다. 프로비저닝, 구성 관리, 서버 및 애플리케이션 배포 등을 자동화합니다. 소프트웨어의 설치뿐만 아니라, Task 등록과 Server에 맞는 패치 등을 진행합니다. 

     

     

    구성 환경 ( Ansible Control / Managed Node )

    [가상머신_Ansible server_Control Node]
    Processor : 1
    RAM : 2G
    Network : 
     enp0s3 : 10.0.2.15(NAT)
     enp0s8 : 192.168.59.11
     
    [가상머신_Managed Node]
    Processor : 1
    RAM : 2G
    Network : 
     enp0s3 : 10.0.2.15(NAT)
     enp0s8 : 192.168.59.12
     
    [OS Version_CentOS 7.9]
    # cat /etc/redhat-release 
    CentOS Linux release 7.9.2009 (Core)

     

    Step 1. Epel 레포지토리 추가

     

    # yum install -y epel-release
    Loaded plugins: fastestmirror
    Determining fastest mirrors
     * base: mirror.kakao.com
     * extras: mirror.kakao.com
     * updates: mirror.kakao.com
    base                                                                            | 3.6 kB  00:00:00     
    extras                                                                          | 2.9 kB  00:00:00     
    updates                                                                         | 2.9 kB  00:00:00     
    (1/4): base/7/x86_64/group_gz                                                   | 153 kB  00:00:00     
    (2/4): extras/7/x86_64/primary_db                                               | 243 kB  00:00:00     
    (3/4): base/7/x86_64/primary_db                                                 | 6.1 MB  00:00:03     
    (4/4): updates/7/x86_64/primary_db                                              |  14 MB  00:00:04     
    Resolving Dependencies
    --> Running transaction check
    ---> Package epel-release.noarch 0:7-11 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    =======================================================================================================
     Package                      Arch                   Version              Repository              Size
    =======================================================================================================
    Installing:
     epel-release                 noarch                 7-11                 extras                  15 k
    
    Transaction Summary
    =======================================================================================================
    Install  1 Package
    
    Total download size: 15 k
    Installed size: 24 k
    Downloading packages:
    warning: /var/cache/yum/x86_64/7/extras/packages/epel-release-7-11.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
    Public key for epel-release-7-11.noarch.rpm is not installed
    epel-release-7-11.noarch.rpm                                                    |  15 kB  00:00:00     
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
    Importing GPG key 0xF4A80EB5:
     Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
     Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
     Package    : centos-release-7-9.2009.0.el7.centos.x86_64 (@anaconda)
     From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : epel-release-7-11.noarch                                                            1/1 
      Verifying  : epel-release-7-11.noarch                                                            1/1 
    
    Installed:
      epel-release.noarch 0:7-11                                                                           
    
    Complete!
    
    
    # yum repolist
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirror.kakao.com
     * epel: ftp.jaist.ac.jp
     * extras: mirror.kakao.com
     * updates: mirror.kakao.com
    repo id                       repo name                                                       status
    base/7/x86_64                 CentOS-7 - Base                                                 10,072
    epel/x86_64                   Extra Packages for Enterprise Linux 7 - x86_64                  13,743
    extras/7/x86_64               CentOS-7 - Extras                                                  500
    updates/7/x86_64              CentOS-7 - Updates                                                3,56
    * 참고
    EPEL은 Extra Packages of Enterprise Linux의 약자로 리눅스의 추가 패키지를 말합니다.
    정식 버전에서 업데이트되지 않은 새로운 패키지의 버전을 제공하는 커뮤니티 기반의 저장소라고 생각하면 됩니다. 

     

     

     

    Step 2. Ansible  설치

     

    # yum install ansible
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    epel/x86_64/metalink                                                            | 9.5 kB  00:00:00     
     * base: mirror.kakao.com
     * epel: ftp.jaist.ac.jp
     * extras: mirror.kakao.com
     * updates: mirror.kakao.com
    epel                                                                            | 4.7 kB  00:00:00     
    (1/3): epel/x86_64/group_gz                                                     |  96 kB  00:00:00     
    (2/3): epel/x86_64/primary_db                                                   | 7.0 MB  00:00:02     
    (3/3): epel/x86_64/updateinfo                                                   | 1.1 MB  00:00:02     
    Resolving Dependencies
    ...
    
    Dependencies Resolved
    
    =======================================================================================================
     Package                                    Arch          Version                  Repository     Size
    =======================================================================================================
    Installing:
     ansible                                    noarch        2.9.27-1.el7             epel           17 M
    Installing for dependencies:
     PyYAML                                     x86_64        3.10-11.el7              base          153 k
     libyaml                                    x86_64        0.1.4-11.el7_0           base           55 k
     python-babel                               noarch        0.9.6-8.el7              base          1.4 M
     python-backports                           x86_64        1.0-8.el7                base          5.8 k
     python-backports-ssl_match_hostname        noarch        3.5.0.1-1.el7            base           13 k
     python-cffi                                x86_64        1.6.0-5.el7              base          218 k
     python-enum34                              noarch        1.0.4-1.el7              base           52 k
     python-idna                                noarch        2.4-1.el7                base           94 k
     python-ipaddress                           noarch        1.0.16-2.el7             base           34 k
     python-jinja2                              noarch        2.7.2-4.el7              base          519 k
     python-markupsafe                          x86_64        0.11-10.el7              base           25 k
     python-paramiko                            noarch        2.1.1-9.el7              base          269 k
     python-ply                                 noarch        3.4-11.el7               base          123 k
     python-pycparser                           noarch        2.14-1.el7               base          104 k
     python-setuptools                          noarch        0.9.8-7.el7              base          397 k
     python-six                                 noarch        1.9.0-2.el7              base           29 k
     python2-cryptography                       x86_64        1.7.2-2.el7              base          502 k
     python2-httplib2                           noarch        0.18.1-3.el7             epel          125 k
     python2-jmespath                           noarch        0.9.4-2.el7              epel           41 k
     python2-pyasn1                             noarch        0.1.9-7.el7              base          100 k
     sshpass                                    x86_64        1.06-2.el7               extras         21 k
    
    Transaction Summary
    =======================================================================================================
    Install  1 Package (+21 Dependent packages)
    
    Total download size: 21 M
    Installed size: 122 M
    Is this ok [y/d/N]: y
    
    ...
    
    Installed:
      ansible.noarch 0:2.9.27-1.el7                                                                        
    
    Dependency Installed:
      PyYAML.x86_64 0:3.10-11.el7                                  libyaml.x86_64 0:0.1.4-11.el7_0         
      python-babel.noarch 0:0.9.6-8.el7                            python-backports.x86_64 0:1.0-8.el7     
      python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7   python-cffi.x86_64 0:1.6.0-5.el7        
      python-enum34.noarch 0:1.0.4-1.el7                           python-idna.noarch 0:2.4-1.el7          
      python-ipaddress.noarch 0:1.0.16-2.el7                       python-jinja2.noarch 0:2.7.2-4.el7      
      python-markupsafe.x86_64 0:0.11-10.el7                       python-paramiko.noarch 0:2.1.1-9.el7    
      python-ply.noarch 0:3.4-11.el7                               python-pycparser.noarch 0:2.14-1.el7    
      python-setuptools.noarch 0:0.9.8-7.el7                       python-six.noarch 0:1.9.0-2.el7         
      python2-cryptography.x86_64 0:1.7.2-2.el7                    python2-httplib2.noarch 0:0.18.1-3.el7  
      python2-jmespath.noarch 0:0.9.4-2.el7                        python2-pyasn1.noarch 0:0.1.9-7.el7     
      sshpass.x86_64 0:1.06-2.el7                                 
    
    Complete!
    * 참고
    agent less인 ansible은 control node에만 설치를 진행하면 됩니다.
    두 서버 모두 ssh는 설치되어야 합니다. 

     

     

    Step 3. Ansible  버전 확인

     

    # rpm -qa | grep ansible
    ansible-2.9.27-1.el7.noarch
    
    # ansible --version
    ansible 2.9.27
      config file = /etc/ansible/ansible.cfg
      configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
      ansible python module location = /usr/lib/python2.7/site-packages/ansible
      executable location = /usr/bin/ansible
      python version = 2.7.5 (default, Oct 14 2020, 14:45:30) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

     

    * 참고
    rpm 명령어를 통해서 버전을 확인합니다. 

     

    반응형

    '리눅스 > 설치' 카테고리의 다른 글

    [LINUX] SuSE 15 설치  (0) 2023.02.16
    [리눅스] Rescue Mode  (0) 2022.02.07
    [리눅스] ReaR(Relax-and-Recover) 백업  (0) 2022.02.03
    [Ubuntu] DevStack 설치하기  (0) 2021.12.30
    TOP