ansible 썸네일형 리스트형 [draft] Ansible apt 모듈을 사용하는 방법 Ansible apt 모듈을 사용하는 방법 (Debian/Ubuntu 패키지 관리)Ansible의 apt 모듈은 Debian/Ubuntu 계열 시스템에서 apt-get, apt 기반의 패키지 설치, 제거, 업그레이드를 자동화하는 모듈입니다.패키지 설치/삭제APT 캐시 업데이트OS 전체 업그레이드idempotent(멱등성) 보장인벤토리(inventory) 구성 확인인벤토리 구조 확인ansible-inventory -i inventory/mycluster/inventory.ini --graph$ ansible-inventory -i inventory/mycluster/inventory.ini --graph @all: |--@etcd: | |--kube-control1 |--@k8s_cluster: .. 더보기 [draft] Ansible 구성 설정(Configuration Settings) 파일의 우선순위에 대한 설명 Ansible 구성 설정(Configuration Settings) 파일의 우선 순위에 대한 설명Ansible 구성 우선순위 한눈에 보기환경 변수 (ANSIBLE_CONFIG)현재 디렉터리의 ansible.cfg사용자 홈 디렉터리의 ~/.ansible.cfg시스템 전역 설정 (/etc/ansible/ansible.cfg)Command Line 옵션(-i, -e 등) 은 구성 파일 우선순위와는 별도로 모든 설정 중 최상위 우선순위를 가집니다.1. 환경 변수 (ANSIBLE_CONFIG)Ansible은 ANSIBLE_CONFIG 환경 변수를 통해 구성 파일의 경로를 지정할 수 있습니다. 이 환경 변수가 설정되어 있으면 해당 경로의 구성 파일이 사용됩니다.export ANSIBLE_CONFIG=/path/to.. 더보기 [draft] Ansible 아키텍처 Ansible 아키텍처Ansible은 에이전트(agent) 없이 SSH 기반으로 동작하는 자동화 도구로 중앙의 Control Node가 여러 Managed Node를 일괄 제어하는 구조를 가집니다.핵심 구성 요소1. Inventory (인벤토리)Inventory는 Ansible이 관리할 대상 서버(호스트)와 그룹을 정의한 목록입니다.주요 역할관리 대상 서버 목록 정의서버 그룹화 (web, db, api 등)호스트 및 그룹별 변수 관리특징정적 Inventory (INI, YAML)동적 Inventory (AWS, GCP, Azure 등)패턴 기반 실행 대상 선택 가능Ansible 자동화의 출발점이 되는 구성 요소2. Modules (모듈)Module은 Ansible에서 실제 작업을 수행하는 최소 실행 단위.. 더보기 [draft] Ansible 동적 인벤토리 설정하는 방법(aws_es2 plugin) Ansible 동적 인벤토리 설정하는 방법(aws_es2 plugin)Ansible 동적 인벤토리 설정 (AWS EC2 Plugin)Ansible은 동적 인벤토리(Dynamic Inventory) 를 사용하여 AWS EC2 인스턴스를 자동으로 검색하고, 태그·리전·상태 기준으로 인벤토리를 동적으로 생성할 수 있습니다.1. 사전 요구사항 (Requirements)pthon >= 3.6boto3 >= 1.16.0botocore >= 1.19.0AWS API 접근 가능한 Credential 설정2. boto3 설치Ubuntu/Debian 계열sudo apt install -y python3-boto3설치 확인python3 -c "import boto3; print(boto3.__version__)"3. AWS.. 더보기 [draft] Ansible inventory(인벤토리) 설정하는 방법 Ansible inventory(인벤토리) 설정하는 방법1. Ansible Inventory란?Ansible은 Inventory(인벤토리) 라고 불리는 호스트 목록(또는 그룹)을 기반으로 여러 서버(관리 대상 노드)에 대해 동시에 작업을 수행합니다.Inventory는 대상 서버 리스트 역할을 수행그룹 및 패턴을 사용해 실행 대상 선택 가능INI, YAML, 디렉터리 구조 등 다양한 방식 지원2. Ansible 설정 파일 우선순위ANSIBLE_CONFIG (환경 변수)ansible.cfg (현재 디렉토리)~/.ansible.cfg (홈 디렉토리)/etc/ansible/ansible.cfg (기본 설정)3. 사용자 전용 ansible.cfg 설정vim ~/.ansible.cfgcat ~/.ansible.cf.. 더보기 [draft] CentOS 7에서 Ansible 설치 및 업그레이드하는 방법 CentOS 7에서 Ansible 설치 및 업그레이드하는 방법테스트 환경운영체제 정보$ cat /etc/redhat-releaseCentOS Linux release 7.9.2009 (Core)기본 Python 환경 확인CentOS 7의 기본 Python은 2.x 계열입니다.$ python --versionPython 2.7.5Ansible 설치yum을 이용한 Ansible 설치yum install -y ansible ansible-python3Ansible 버전 확인ansible --version$ ansible --versionansible 2.9.27 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/... 더보기 [draft] macOS에서 Ansible 설치하는 방법 macOS에서 Ansible 설치하는 방법테스트 환경macOS 버전 확인system_profiler SPSoftwareDataType | egrep 'System Version'$ system_profiler SPSoftwareDataType | egrep 'System Version' System Version: macOS 12.5 (21G72)Ansible 설치(Homebrew Install)Homebrew를 통한 Ansible 패키지 검색Homebrew 저장소에 등록된 Ansible 관련 패키지를 확인합니다.brew search ansible$ brew search ansible==> Formulaeansible ansible-cmdb ansible-language-server .. 더보기 [draft] Amazon Linux 2에서 Ansible을 설치하는 방법 Amazon Linux 2에서 Ansible을 설치하는 방법테스트 환경$ sudo cat /etc/os-release | grep PRETTY_NAME | cut -d'"' -f2Amazon Linux 21. EPEL 레파지토리 설치Amazon Linux 2는 기본적으로 Ansible 패키지를 제공하지 않기 때문에 EPEL 레파지토리를 설치해야 합니다. EPEL 레파지토리를 설치하려면 다음 명령어를 실행합니다.sudo amazon-linux-extras install -y epelamazon-linux-extras list$ amazon-linux-extras list 0 ansible2=latest enabled \ [ =2.4.2 =2.4.6 =2.8 =.. 더보기 이전 1 2 3 4 다음