본문 바로가기

728x90

ansible

우분투에서 최신 버전의 ansible을 설치하는 방법 우분투에서 최신 버전의 ansible을 설치하는 방법 테스트 환경 $ lsb_release -d Description: Ubuntu 22.04.2 LTS 우분투에서 apt를 사용하여 최신 버전의 ansible을 설치하려면 다음과 같은 단계를 따르면 됩니다. 1. 패키지 관리자의 패키지 목록을 업데이트합니다. sudo apt update sudo apt install software-properties-common 2. Ansible PPA 저장소를 추가합니다. sudo add-apt-repository --yes --update ppa:ansible/ansible $ sudo add-apt-repository --yes --update ppa:ansible/ansible Repository: 'deb h.. 더보기
Amazon Linux 2에서 Ansible을 설치하는 방법 Amazon Linux 2에서 Ansible을 설치하는 방법 테스트 환경 $ sudo cat /etc/os-release | grep PRETTY_NAME | cut -d'"' -f2 Amazon Linux 2 1. EPEL 레파지토리 설치 Amazon Linux 2는 기본적으로 Ansible 패키지를 제공하지 않기 때문에 EPEL 레파지토리를 설치해야 합니다. EPEL 레파지토리를 설치하려면 다음 명령어를 실행합니다. sudo amazon-linux-extras install -y epel amazon-linux-extras list $ amazon-linux-extras list 0 ansible2=latest enabled \ [ =2.4.2 =2.4.6 =2.8 =stable ] ... 2. An.. 더보기
[리눅스] Ansible을 초기 구성하는 방법 Ansible을 초기 구성하는 방법 구성 환경 Node 호스트 이름 아이피 주소 비고 Control node node-01 192.168.0.51 Managed node node-02 192.168.0.52 ssh keygen 생성 $ ssh-keygen -t rsa -C "vagrant@ControlNode" ssh key 교환 ssh-copy-id vagrant@192.168.0.51 ssh-copy-id vagrant@192.168.0.52 ansible.cfg 구성 Ansible 구성 설정 - https://docs.ansible.com/ansible/latest/reference_appendices/config.html ansible.cfg 파일 생성하기 ansible-config init --.. 더보기
[리눅스] 우분투에서 Ansible을 설치하는 방법 우분투에서 Ansible을 설치하는 방법 테스트 환경 $ lsb_release -d Description:Ubuntu 22.04.2 LTS Ansible의 최신 버전을 설치하려면 Ansible의 공식 PPA(Personal Package Archive)를 추가하여 설치할 수 있습니다. 1. 먼저, software-properties-common 패키지를 설치합니다. sudo apt update sudo apt install -y software-properties-common 2. 다음 명령어를 사용하여 Ansible PPA를 추가합니다. sudo apt-add-repository -y ppa:ansible/ansible $ sudo apt-add-repository -y ppa:ansible/ansib.. 더보기
Ansible을 위한 기본 Bash 완성을 설치하는 방법 Ansible을 위한 기본 Bash 완성을 설치하는 방법(Basic bash completion for Ansible) github 다운로드 git clone https://github.com/dysosmus/ansible-completion.git $ ls -l ansible-completion total 68 -rw-rw-r-- 1 vagrant vagrant 5835 Nov 7 14:01 ansible-completion.bash -rw-rw-r-- 1 vagrant vagrant 334 Nov 7 14:01 ansible-doc-completion.bash -rw-rw-r-- 1 vagrant vagrant 1072 Nov 7 14:01 ansible-galaxy-completion.bash -r.. 더보기
Ansible 인벤토리를 YAML 파일로 설정하는 방법 Ansible 인벤토리를 YAML 파일로 설정하는 방법 YAML 파일을 사용하여 호스트 그룹 및 호스트에 대한 정보를 정의할 수 있습니다. 기본적인 YAML 형식의 Ansible 인벤토리 예제 Ansible 인벤토리 파일 편집 vim hosts.yml --- all: # all 그룹 정의 hosts: webserver: ansible_host: 192.168.1.10 ansible_user: ubuntu ansible_ssh_private_key_file: /path/to/private_key.pem database: ansible_host: 192.168.1.11 ansible_user: centos ansible_password: your_password webservers: # webservers .. 더보기
Ansible 구성 설정(Configuration Settings) 파일의 우선 순위에 대한 설명 Ansible 구성 설정(Configuration Settings) 파일의 우선 순위에 대한 설명 구성 설정 파일(ansible.cfg)의 우선 순위 1. 환경 변수 (Environment Variables) Ansible은 ANSIBLE_CONFIG 환경 변수를 통해 구성 파일의 경로를 지정할 수 있습니다. 이 환경 변수가 설정되어 있으면 해당 경로의 구성 파일이 사용됩니다. export ANSIBLE_CONFIG=/path/to/your/ansible.cfg 2. 커맨드 라인 인수 (Command Line Arguments) ansible-playbook이나 ansible 명령을 실행할 때 -i나 -e와 같은 인수를 사용하여 구성을 지정할 수 있습니다. 이는 명령이 실행되는 동안 구성을 임시로 설정하.. 더보기
[리눅스] ansible apt 모듈(apt module) ansible apt 모듈(apt module) 인벤토리(inventory) 확인 ansible-inventory -i inventory/mycluster/inventory.ini --graph $ ansible-inventory -i inventory/mycluster/inventory.ini --graph @all: |--@etcd: | |--kube-control1 |--@k8s_cluster: | |--@calico_rr: | |--@kube_control_plane: | | |--kube-control1 | |--@kube_node: | | |--kube-node1 | | |--kube-node2 | | |--kube-node3 | | |--kube-node4 | | |--kube-node5 |.. 더보기

728x90