문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
build_deploy_management:ansible [2020/09/13 13:21] kwon37xi |
build_deploy_management:ansible [2020/12/16 21:39] kwon37xi |
||
---|---|---|---|
줄 4: | 줄 4: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// | ||
* 자동화 툴 | * 자동화 툴 | ||
===== AWS ===== | ===== AWS ===== | ||
* https:// | * https:// | ||
+ | |||
+ | ===== become ===== | ||
+ | * '' | ||
+ | * 이때, 비밀번호를 받는 다양한 방법이 존재할 수 있는데, 일단 '' | ||
+ | * 혹은 다음과 같이 '' | ||
+ | <code sh> | ||
+ | ansible-playbook playbook.yml ... --user=username \ | ||
+ | | ||
+ | </ | ||
+ | * 그런데, | ||
+ | <code sh> | ||
+ | ansible-playbook playbook.yml ... \ | ||
+ | --extra-vars=" | ||
+ | </ | ||
+ | * [[linux: | ||
===== Local 실행 ===== | ===== Local 실행 ===== | ||
* [[https:// | * [[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:// | ||
+ | |||
+ | ===== 특정 태스크 지정 ===== | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | ===== retries ===== | ||
+ | * '' | ||
+ | * 현재의 '' | ||
+ | * [[https:// | ||
+ | |||
+ | ===== ansible-pull ===== | ||
+ | * [[: | ||
+ | * 실행할 플레이북 파일명을 명시하지 않으면 기본적으로 저장소 최상위 디렉토리의 '' | ||
- | ====== 참조 ====== | + | ===== 참조 ===== |
+ | * [[https:// | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
* [[https:// | * [[https:// | ||
* [[http:// | * [[http:// | ||
+ | * [[https:// | ||