"Ansible"의 두 판 사이의 차이

오픈소스 비즈니스 컨설팅
둘러보기로 가기 검색하러 가기
잔글
잔글
 
(같은 사용자의 중간 판 10개는 보이지 않습니다)
2번째 줄: 2번째 줄:
  
 
*홈페이지 : [https://github.com/ansible/ansible https://github.com/ansible/ansible]
 
*홈페이지 : [https://github.com/ansible/ansible https://github.com/ansible/ansible]
 +
**Document : [http://docs.ansible.com/ http://docs.ansible.com/]
 +
**Module : [http://docs.ansible.com/ansible/modules.html http://docs.ansible.com/ansible/modules.html]
 +
***https://github.com/ansible/ansible-modules-core
 +
***https://github.com/ansible/ansible-modules-extras
 +
**Example : [https://github.com/ansible/ansible-examples https://github.com/ansible/ansible-examples]
 +
**[https://github.com/dominis/ansible-shell https://github.com/dominis/ansible-shell]
 +
**[https://github.com/openstack-ansible/openstack-ansible https://github.com/openstack-ansible/openstack-ansible]
 +
**[http://terry.im/wiki/terry/Ansible.html http://terry.im/wiki/terry/Ansible.html]
 
*다운로드 : 
 
*다운로드 : 
 
*라이선스 : GNU GPL
 
*라이선스 : GNU GPL
28번째 줄: 36번째 줄:
 
*$HOME/.ansible/
 
*$HOME/.ansible/
 
*/usr/share/ansible_plugins/
 
*/usr/share/ansible_plugins/
 +
* /usr/lib/python2.7/site-packages/ansible/modules
  
 
== Ansible 사용법 ==
 
== Ansible 사용법 ==
40번째 줄: 49번째 줄:
  
 
task : Ansible 모듈 호출
 
task : Ansible 모듈 호출
 +
 +
[http://yaml.org yaml], [http://jinja.pocoo.org/docs/ Jinja2] 사용
  
  
  
 
=== CLI ===
 
=== CLI ===
 +
<pre>ansible --help
 +
ansible-doc command
  
ansible<br/>&nbsp; &nbsp; --module-name=모듈 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -m<br/>&nbsp; &nbsp; --args=모듈_Args &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-a<br/>&nbsp; &nbsp; --module-path=MODULE_PATH &nbsp; -M<br/>&nbsp; &nbsp; --check &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -C<br/>&nbsp; &nbsp;&nbsp;<br/>&nbsp; &nbsp; --extra-vars="name1=value1 name2=value2" &nbsp; &nbsp; &nbsp;-e &nbsp; &nbsp;#--- &#x7B;&#x7B;name1&#x7D;&#x7D;<br/>&nbsp; &nbsp; --output=OUTPUT_FILE
+
ansible
 +
    --module-name=MODULE_NAME          -m MODULE_NAME
 +
    --args=MODULE_ARGS                  -a MODULE_ARGS
 +
    --module-path=MODULE_PATH           -M MODULE_PATH
 +
    --check                             -C
 +
   
 +
    --extra-vars=EXTRA_VARS            -e EXTRA_VARS
 +
    --output=OUTPUT_FILE
  
ansible-playbook release.yml --extra-vars "host=~ user=~"<br/>&nbsp;&#x7B;&#x7B;host&#x7D;&#x7D;, &#x7B;&#x7B;user&#x7D;&#x7D;
+
ansible all -m ping
 +
ansible controller -a "pwd"
 +
ansible controller -m command -a pwd
 +
ansible controller -m shell -a "ls -alF | grep ceph"
 +
ansible controller -m script -a ~.bash</pre><pre>ansible-playbook release.yml --extra-vars "host=~ user=~" [-vvvv]
 +
{{host}}, {{user}}</pre>
  
 
== 참고 문헌 ==
 
== 참고 문헌 ==

2016년 2월 22일 (월) 10:21 기준 최신판

DevOps 도우인 Ansible을 정리 합니다.


Ansible 개요

Ansible 설치

CentOS에서 yum으로 설치

yum -y install ansible ansible-*
ansible --version

#--- ansible --version 명령에서 오류가 발생할 경우
pip uninstall ansible
pip install ansible

ansible controller -m shell -a "ls -alF | grep ceph"


폴더 구조

  • /etc/ansible/
    • hosts : Hosts 파일 정보, Hosts간에는 ssh로 자동 접속이 가능하도록 설정이 되어야 합니다.
  • $HOME/.ansible/
  • /usr/share/ansible_plugins/
  •  /usr/lib/python2.7/site-packages/ansible/modules

Ansible 사용법

구조

playbook : 하나 이상의 play

play : role과 task를 매핑

role

task : Ansible 모듈 호출

yaml, Jinja2 사용


CLI

ansible --help
ansible-doc command

ansible
    --module-name=MODULE_NAME           -m MODULE_NAME
    --args=MODULE_ARGS                  -a MODULE_ARGS
    --module-path=MODULE_PATH           -M MODULE_PATH
    --check                             -C
    
    --extra-vars=EXTRA_VARS             -e EXTRA_VARS
    --output=OUTPUT_FILE

ansible all -m ping
ansible controller -a "pwd"
ansible controller -m command -a pwd
ansible controller -m shell -a "ls -alF | grep ceph"
ansible controller -m script -a ~.bash
ansible-playbook release.yml --extra-vars "host=~ user=~" [-vvvv]
 {{host}}, {{user}}

참고 문헌