ansible 노트
ansible-doc
ansible-playbook
ansible-vault
ansible-console
ansible-galaxy
ansible-pull
ansible-doc, 모듈 도움말 표시
ansible-doc [options] [module...]
-a
-l,--list
-s,--snippet playbook
예:
ansible-doc -l
ansible-doc ping
ansible-doc -s ping
1. 원격 실행 모듈:
command
vs shell
win_command
및 win_shell
모듈/bin/sh
의 원격 모드를 통해 실행command
과shell
동일한 문장cat /home/root/testfile
#!/usr/local/bin/ansible-playbook
---
- hosts: all
tasks:
- name: 1.1 command
command: cat /home/root/testfile
register: cmd_out
- name: 1.2 see command output
debug: var=cmd_out
- name: 2.1 shell
shell: cat /home/root/testfile
register: shell_out
- name: 2.2 see shell output
debug: var=shell_out
2. 파일 조작 모듈
모듈
기능
file
/ /
운영copy
로컬 또는 원격 파일을 원격 경로로 복사
template
copy 업그레이드 버전, jinja2 규칙에 따라 템플릿 파일을 구축하여 원격 디렉터리로 복사
assemble
하나의 경로의 모든 파일을 문자열 순서대로 집합하다