본문 바로가기

728x90

Ansible

앤서블 플레이북 키워드 앤서블 플레이북 키워드(Playbook Keywords)Ansible 플레이북(Playbook)은 Ansible에서 자동화 작업을 수행하기 위한 주요 구성 파일입니다. 각 플레이북은 여러 작업(task)들을 정의하며 시스템이나 네트워크 장비 등의 상태를 원하는 방향으로 변경하는 데 사용됩니다.주요 Ansible 플레이북 키워드name설명 : 작업 또는 플레이의 이름을 정의합니다. 사람이 이해하기 쉽게 설명하는 부분입니다위치 : 플레이북 또는 개별 작업에서 사용됩니다.name: Install NGINXhosts설명 : 이 플레이를 실행할 호스트 그룹을 지정합니다.위치 : 플레이 단위에서 사용됩니다.hosts: webserverstasks설명 : 실행할 작업 목록을 정의하는 곳입니다. 각 작업은 모듈 호출 .. 더보기
[Ansible] ansible-config 명령 ansible-config 명령 ansible-config -h $ ansible-config -h usage: ansible-config [-h] [--version] [-v] {list,dump,view,init} ... View ansible configuration. positional arguments: {list,dump,view,init} list Print all config options dump Dump configuration view View configuration file init Create initial configuration optional arguments: --version show program's version number, config file location, .. 더보기
[Ansible] ansible-doc 명령 ansible-doc 명령 : plugin documentation tool ansible-doc 사용법 ansible-doc -h $ ansible-doc -h usage: ansible-doc [-h] [--version] [-v] [-M MODULE_PATH] [--playbook-dir BASEDIR] [-t {become,cache,callback,cliconf,connection,httpapi,inventory,lookup,netconf,shell,vars,module,strategy,role,keyword}] [-j] [-r ROLES_PATH] [-e ENTRY_POINT | -s | -F | -l | --metadata-dump] [plugin [plugin ...]] plugin doc.. 더보기
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 user 모듈(user module) ansible user 모듈(user module) 불필요한 계정 삭제하기 userDelete.yaml 파일 작성 cat (item=lp) ok: [kube-node1] => (item=lp) changed: [kube-node3] => (item=lp) changed: [kube-node5] => (item=lp) ok: [kube-node1] => (item=news) changed: [kube-node2] => (item=news) changed: [kube-node4] => (item=lp) changed: [kube-node3] => (item=news) ok: [kube-node1] => (item=uucp) changed: [kube-node2] => (item=uucp) changed: [.. 더보기
[리눅스] 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 |.. 더보기
[url] Ansible Documentation URL Ansible Documentation URLhttps://docs.ansible.com/ansible/latest/getting_started/index.html Getting started with Ansible — Ansible Documentation© Copyright Ansible project contributors. Last updated on Aug 19, 2022.docs.ansible.com 더보기

반응형