문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
build_deploy_management:ansible [2020/09/19 12:38] kwon37xi |
— (현재) | ||
---|---|---|---|
줄 1: | 줄 1: | ||
- | ====== Ansible ====== | ||
- | * http:// | ||
- | * https:// | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | * 자동화 툴 | ||
- | |||
- | ===== AWS ===== | ||
- | * https:// | ||
- | |||
- | ===== become ===== | ||
- | * '' | ||
- | * 이때, 비밀번호를 받는 다양한 방법이 존재할 수 있는데, 일단 '' | ||
- | |||
- | ===== Local 실행 ===== | ||
- | * [[https:// | ||
- | * 해당 playbook yml 이 Local 전용일 경우에는 다음 yml 설정으로 충분함. | ||
- | |||
- | <code yml> | ||
- | - name: playbook name | ||
- | hosts: 127.0.0.1 | ||
- | connection: local | ||
- | tasks: | ||
- | - name: blah.. blah.. | ||
- | </ | ||
- | <code sh> | ||
- | # 실행 | ||
- | ansible-playbook playbook.yml | ||
- | </ | ||
- | |||
- | ===== File 생성 ===== | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | <code yml> | ||
- | tasks: | ||
- | - name: Ansible create file with content example | ||
- | copy: | ||
- | dest: "/ | ||
- | content: " | ||
- | mode: 0777 | ||
- | owner: mdtutorials2 | ||
- | </ | ||
- | |||
- | ===== 환경변수 읽기 ===== | ||
- | * [[https:// | ||
- | < | ||
- | - debug: msg=" | ||
- | </ | ||
- | |||
- | ===== 변수(var) 외부에 두고 include ===== | ||
- | * [[https:// | ||
- | * '' | ||
- | <code yml> | ||
- | - name: blah blah.. | ||
- | hosts: ... | ||
- | vars_files: | ||
- | - " | ||
- | tasks: ... | ||
- | </ | ||
- | * '' | ||
- | |||
- | <code yml> | ||
- | # key/value 쌍. | ||
- | ubuntu_release: | ||
- | current_user: | ||
- | vagrant_version: | ||
- | packer_version: | ||
- | ... | ||
- | </ | ||
- | |||
- | ===== playbook 을 윈해 환경변수 ===== | ||
- | * playbook 실행시 적용될 환경변수 지정 | ||
- | * https:// | ||
- | <code sh> | ||
- | - hosts: all | ||
- | roles: | ||
- | - php | ||
- | - nginx | ||
- | environment: | ||
- | MY_ENV_VARIABLE: | ||
- | </ | ||
- | |||
- | ===== 특정 Task 용 환경변수 ===== | ||
- | * 다른 태스크에는 적용안됨. | ||
- | <code sh> | ||
- | tasks: | ||
- | - name: Echo my_env_var | ||
- | shell: "echo $MY_ENV_VARIABLE" | ||
- | environment: | ||
- | MY_ENV_VARIABLE: | ||
- | </ | ||
- | |||
- | ===== shell & command ===== | ||
- | * [[https:// | ||
- | |||
- | ===== apt repository ===== | ||
- | * [[https:// | ||
- | |||
- | ===== 특정 태스크 지정 ===== | ||
- | * '' | ||
- | * '' | ||
- | |||
- | ===== 참조 ===== | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[https:// | ||
- | * [[http:// | ||