본문 바로가기

리눅스

[draft] CentOS 7에서 Ansible 설치 및 업그레이드하는 방법

CentOS 7에서 Ansible 설치 및 업그레이드하는 방법

테스트 환경

운영체제 정보

$ cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

기본 Python 환경 확인

  • CentOS 7의 기본 Python은 2.x 계열입니다.
$ python --version
Python 2.7.5

Ansible 설치

yum을 이용한 Ansible 설치

yum install -y ansible ansible-python3

Ansible 버전 확인

ansible --version
$ 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 = /bin/ansible
  python version = 2.7.5 (default, Nov 16 2020, 22:23:17) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

온프레미스 Ansible Automation Platform에 포함된 패키지 및 버전

Ansible Automation Platform on-premises included packages and versions

Python 3 기반 Ansible 설치 (pip 방식)

Python 3 및 pip 확인

python3 -m pip -V
$ python3 -m pip -V
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)

Ansible 설치 (User 영역)

python3 -m pip install --user ansible

Ansible 정보 확인

python3 -m pip show ansible
$ python3 -m pip show ansible
Name: ansible
Version: 4.10.0
Summary: Radically simple IT automation
Home-page: https://ansible.com/
Author: Ansible, Inc.
Author-email: info@ansible.com
License: GPLv3+
Location: /root/.local/lib/python3.6/site-packages
Requires: ansible-core
이 방식은 Ansible 4.x (ansible-core 기반) 를 설치합니다.

pip 업그레이드

python3 -m pip install --upgrade pip
$ python3 -m pip -V
pip 21.3.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)

Ansible 업그레이드

python3 -m pip install --upgrade --user ansible

 

참고URL

- https://github.com/ansible/ansible

- https://pip.pypa.io/en/stable/installation/

- https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#control-node-requirements