Ansible - ansible-doc 명령 > Ansible 자료실

본문 바로가기
사이트 내 전체검색

Ansible 자료실

운영 Ansible - ansible-doc 명령

페이지 정보

profile_image
작성자 snow
댓글 0건 조회 390회 작성일 24-03-04 17:10

본문

0. 개요

이 게시글에서는 ansible-doc 명령의 다양한 사용법을 살펴보고, 실제 예시를 안내드리는 글입니다.
 

1. Ansible-doc 명령 기본 사용법

`ansible-doc` 명령은 다음과 같은 기본적인 형식으로 사용됩니다.
  • $ ansible-doc [옵션] 모듈명

여기서 `옵션`은 다음과 같습니다.
  • -l: 모듈 목록을 출력합니다.
  • -s: 특정 모듈에 대한 상세 정보를 출력합니다.
  • -t: 특정 모듈의 예시를 출력합니다.

예를 들어, 다음 명령은 모든 모듈 목록을 출력합니다.
  • $ ansible-doc -l

다음 명령은 `file` 모듈에 대한 상세 정보를 출력합니다.
  • $ ansible-doc -s file

다음 명령은 `file` 모듈의 예시를 출력합니다.
  • $ ansible-doc -t file

2. Ansible-doc 명령 활용 팁

`ansible-doc` 명령은 다음과 같은 다양한 옵션을 제공하여 모듈을 효과적으로 사용할 수 있도록 도와줍니다.
  • -F : 특정 플랫폼에서 사용 가능한 모듈만 필터링합니다.
  • -C : 특정 컬렉션에 속하는 모듈만 필터링합니다.
  • --search : 모듈 설명에서 특정 키워드를 검색합니다.

예를 들어, 다음 명령은 Red Hat Enterprise Linux에서 사용 가능한 `file` 모듈만 출력합니다. 
  • $ ansible-doc -F redhat -s file
 
다음 명령은 `core` 컬렉션에 속하는 모듈만 출력합니다.
  • $ ansible-doc -C core -l

다음 명령은 모듈 설명에서 `copy`라는 키워드를 검색합니다.
  • $ ansible-doc --search copy -l

3. Ansible-doc 명령 실습

`ansible-doc` 명령을 실제로 사용하여 모듈에 대한 정보를 확인해 보겠습니다.

3.1. `file` 모듈

다음 명령은 `file` 모듈에 대한 상세 정보를 출력합니다.
  • $ ansible-doc -s file

출력 결과는 다음과 같습니다.
- name: Manage files and file properties
  file:
      access_time:           # This parameter indicates the time the file's access time should be se
                               `YYYYMMDDHHMM.SS' when using default time format, or `now'. Default i
                               default for `state=[file,directory,link,hard]' and `now' is default f
      access_time_format:    # When used with `access_time', indicates the time format that must be 
      attributes:            # The attributes the resulting file or directory should have. To get su
                               This string should contain the attributes in the same order as the on
                               operator is assumed as default, otherwise `+' or `-' operators need t
      follow:                # This flag indicates that filesystem links, if they exist, should be f
      force:                 # Force the creation of the symlinks in two cases: the source file does
                               file (so, we need to unlink the `path' file and create symlink to the
      group:                 # Name of the group that should own the file/directory, as would be fed
      mode:                  # The permissions the resulting file or directory should have. For thos
                               numbers. You must either add a leading zero so that Ansible's YAML pa
                               `0644' or `01777') or quote it (like `'644'' or `'1777'') so Ansible 
                               conversion from string into number. Giving Ansible a number without f
                               with a decimal number which will have unexpected results. As of Ansib
                               symbolic mode (for example, `u+rwx' or `u=rw,g=r,o=r').

 

4. Ansible-doc 명령 활용 사례

ansible-doc 명령은 다음과 같은 다양한 상황에서 활용될 수 있습니다.


새로운 모듈을 배우는 경우: ansible-doc 명령을 사용하여 모듈의 기능, 옵션, 사용 방법 등을 빠르게 파악할 수 있습니다.

플레이북을 작성하는 경우: ansible-doc 명령을 사용하여 모듈의 예시를 참고하여 플레이북을 작성할 수 있습니다.

문제 해결 시: ansible-doc 명령을 사용하여 모듈의 작동 방식을 이해하고 문제를 해결할 수 있습니다.

 
 
 
 

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

사이트 정보

회사명 : (주)리눅스데이타시스템 / 대표 : 정정모
서울본사 : 서울특별시 강남구 봉은사로 114길 40 홍선빌딩 2층 / tel : 02-6207-1160
대전지사 : 대전광역시 유성구 노은로174 도원프라자 5층 / tel : 042-331-1161

접속자집계

오늘
570
어제
1,872
최대
3,935
전체
808,424
Copyright © www.linuxdata.org All rights reserved.